1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmloff.hxx"
26 #include "PageMasterPropHdlFactory.hxx"
27 #include <xmloff/xmltypes.hxx>
28 #include <xmloff/xmltoken.hxx>
29 #include "xmlbahdl.hxx"
30 #include <xmloff/NamedBoolPropertyHdl.hxx>
31 #ifndef _XMLOFF_XMLTEXTCOLUMNSPPROPERTYHANDLER_HXX
32 #include "XMLTextColumnsPropertyHandler.hxx"
33 #endif
34 #include <xmloff/XMLConstantsPropertyHandler.hxx>
35 #include "PageMasterPropHdl.hxx"
36 #ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX
37 #include <xmloff/PageMasterStyleMap.hxx>
38 #endif
39 #include <com/sun/star/text/TextGridMode.hpp>
40
41
42 using ::rtl::OUString;
43 using ::rtl::OUStringBuffer;
44
45 using namespace ::xmloff::token;
46 using namespace ::com::sun::star;
47
48
49 SvXMLEnumMapEntry aXML_TextGridMode_ConstantMap[] =
50 {
51 { XML_NONE, text::TextGridMode::NONE },
52 { XML_LINE, text::TextGridMode::LINES },
53 { XML_BOTH, text::TextGridMode::LINES_AND_CHARS },
54 { XML_TOKEN_INVALID, 0 }
55 };
56
57 //______________________________________________________________________________
58
XMLPageMasterPropHdlFactory()59 XMLPageMasterPropHdlFactory::XMLPageMasterPropHdlFactory() :
60 XMLPropertyHandlerFactory()
61 {
62 }
63
~XMLPageMasterPropHdlFactory()64 XMLPageMasterPropHdlFactory::~XMLPageMasterPropHdlFactory()
65 {
66 }
67
GetPropertyHandler(sal_Int32 nType) const68 const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
69 {
70 nType &= MID_FLAG_MASK;
71
72 XMLPropertyHandler* pHdl = (XMLPropertyHandler*) XMLPropertyHandlerFactory::GetPropertyHandler( nType );
73 if( !pHdl )
74 {
75 switch( nType )
76 {
77 case XML_PM_TYPE_PAGESTYLELAYOUT:
78 pHdl = new XMLPMPropHdl_PageStyleLayout();
79 break;
80 case XML_PM_TYPE_NUMFORMAT:
81 pHdl = new XMLPMPropHdl_NumFormat();
82 break;
83 case XML_PM_TYPE_NUMLETTERSYNC:
84 pHdl = new XMLPMPropHdl_NumLetterSync();
85 break;
86 case XML_PM_TYPE_PAPERTRAYNUMBER:
87 pHdl = new XMLPMPropHdl_PaperTrayNumber();
88 break;
89 case XML_PM_TYPE_PRINTORIENTATION:
90 pHdl = new XMLNamedBoolPropertyHdl(
91 GetXMLToken( XML_LANDSCAPE ),
92 GetXMLToken( XML_PORTRAIT ) );
93 break;
94 case XML_PM_TYPE_PRINTANNOTATIONS:
95 pHdl = new XMLPMPropHdl_Print( XML_ANNOTATIONS );
96 break;
97 case XML_PM_TYPE_PRINTCHARTS:
98 pHdl = new XMLPMPropHdl_Print( XML_CHARTS );
99 break;
100 case XML_PM_TYPE_PRINTDRAWING:
101 pHdl = new XMLPMPropHdl_Print( XML_DRAWINGS );
102 break;
103 case XML_PM_TYPE_PRINTFORMULAS:
104 pHdl = new XMLPMPropHdl_Print( XML_FORMULAS );
105 break;
106 case XML_PM_TYPE_PRINTGRID:
107 pHdl = new XMLPMPropHdl_Print( XML_GRID );
108 break;
109 case XML_PM_TYPE_PRINTHEADERS:
110 pHdl = new XMLPMPropHdl_Print( XML_HEADERS );
111 break;
112 case XML_PM_TYPE_PRINTOBJECTS:
113 pHdl = new XMLPMPropHdl_Print( XML_OBJECTS );
114 break;
115 case XML_PM_TYPE_PRINTZEROVALUES:
116 pHdl = new XMLPMPropHdl_Print( XML_ZERO_VALUES );
117 break;
118 case XML_PM_TYPE_PRINTPAGEORDER:
119 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB ),
120 GetXMLToken( XML_LTR ) );
121 break;
122 case XML_PM_TYPE_FIRSTPAGENUMBER:
123 pHdl = new XMLNumberNonePropHdl( XML_CONTINUE, 2 );
124 break;
125 case XML_PM_TYPE_CENTER_HORIZONTAL:
126 pHdl = new XMLPMPropHdl_CenterHorizontal();
127 break;
128 case XML_PM_TYPE_CENTER_VERTICAL:
129 pHdl = new XMLPMPropHdl_CenterVertical();
130 break;
131 case XML_TYPE_TEXT_COLUMNS:
132 pHdl = new XMLTextColumnsPropertyHandler;
133 break;
134 case XML_TYPE_LAYOUT_GRID_MODE:
135 pHdl = new XMLConstantsPropertyHandler(
136 aXML_TextGridMode_ConstantMap, XML_NONE );
137 break;
138 }
139
140 if( pHdl )
141 PutHdlCache( nType, pHdl );
142 }
143 return pHdl;
144 }
145
146
147