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 // MARKER(update_precomp.py): autogen include statement, do not remove
23 #include "precompiled_xmloff.hxx"
24 
25 #include "PageMasterPropHdlFactory.hxx"
26 #include <xmloff/xmltypes.hxx>
27 #include <xmloff/xmltoken.hxx>
28 #include "xmlbahdl.hxx"
29 #include <xmloff/NamedBoolPropertyHdl.hxx>
30 #include "XMLTextColumnsPropertyHandler.hxx"
31 #include <xmloff/XMLConstantsPropertyHandler.hxx>
32 #include "PageMasterPropHdl.hxx"
33 #include <xmloff/PageMasterStyleMap.hxx>
34 #include <com/sun/star/text/TextGridMode.hpp>
35 
36 //UUUU
37 #include <xmloff/EnumPropertyHdl.hxx>
38 #include <com/sun/star/drawing/FillStyle.hpp>
39 #include "XMLFillBitmapSizePropertyHandler.hxx"
40 #include "XMLBitmapLogicalSizePropertyHandler.hxx"
41 #include <com/sun/star/drawing/RectanglePoint.hpp>
42 #include <com/sun/star/drawing/BitmapMode.hpp>
43 #include "XMLBitmapRepeatOffsetPropertyHandler.hxx"
44 
45 using ::rtl::OUString;
46 using ::rtl::OUStringBuffer;
47 
48 using namespace ::xmloff::token;
49 using namespace ::com::sun::star;
50 //UUUU
51 using namespace ::com::sun::star::drawing;
52 
53 //UUUU
54 extern SvXMLEnumMapEntry aXML_FillStyle_EnumMap[];
55 extern SvXMLEnumMapEntry aXML_RefPoint_EnumMap[];
56 extern SvXMLEnumMapEntry aXML_BitmapMode_EnumMap[];
57 
58 SvXMLEnumMapEntry aXML_TextGridMode_ConstantMap[] =
59 {
60 	{ XML_NONE,         text::TextGridMode::NONE },
61 	{ XML_LINE,	        text::TextGridMode::LINES },
62 	{ XML_BOTH,         text::TextGridMode::LINES_AND_CHARS },
63 	{ XML_TOKEN_INVALID, 0 }
64 };
65 
66 //______________________________________________________________________________
67 
XMLPageMasterPropHdlFactory()68 XMLPageMasterPropHdlFactory::XMLPageMasterPropHdlFactory() :
69 	XMLPropertyHandlerFactory()
70 {
71 }
72 
~XMLPageMasterPropHdlFactory()73 XMLPageMasterPropHdlFactory::~XMLPageMasterPropHdlFactory()
74 {
75 }
76 
GetPropertyHandler(sal_Int32 nType) const77 const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
78 {
79 	nType &= MID_FLAG_MASK;
80 
81 	XMLPropertyHandler* pHdl = (XMLPropertyHandler*) XMLPropertyHandlerFactory::GetPropertyHandler( nType );
82 	if( !pHdl )
83 	{
84 		switch( nType )
85 		{
86 			case XML_PM_TYPE_PAGESTYLELAYOUT:
87 				pHdl = new XMLPMPropHdl_PageStyleLayout();
88 			break;
89 			case XML_PM_TYPE_NUMFORMAT:
90 				pHdl = new XMLPMPropHdl_NumFormat();
91 			break;
92 			case XML_PM_TYPE_NUMLETTERSYNC:
93 				pHdl = new XMLPMPropHdl_NumLetterSync();
94 			break;
95 			case XML_PM_TYPE_PAPERTRAYNUMBER:
96 				pHdl = new XMLPMPropHdl_PaperTrayNumber();
97 			break;
98 			case XML_PM_TYPE_PRINTORIENTATION:
99 				pHdl = new XMLNamedBoolPropertyHdl(
100                     GetXMLToken( XML_LANDSCAPE ),
101 					GetXMLToken( XML_PORTRAIT ) );
102 			break;
103 			case XML_PM_TYPE_PRINTANNOTATIONS:
104 				pHdl = new XMLPMPropHdl_Print( XML_ANNOTATIONS );
105 			break;
106 			case XML_PM_TYPE_PRINTCHARTS:
107 				pHdl = new XMLPMPropHdl_Print( XML_CHARTS );
108 			break;
109 			case XML_PM_TYPE_PRINTDRAWING:
110 				pHdl = new XMLPMPropHdl_Print( XML_DRAWINGS );
111 			break;
112 			case XML_PM_TYPE_PRINTFORMULAS:
113 				pHdl = new XMLPMPropHdl_Print( XML_FORMULAS );
114 			break;
115 			case XML_PM_TYPE_PRINTGRID:
116 				pHdl = new XMLPMPropHdl_Print( XML_GRID );
117 			break;
118 			case XML_PM_TYPE_PRINTHEADERS:
119 				pHdl = new XMLPMPropHdl_Print( XML_HEADERS );
120 			break;
121 			case XML_PM_TYPE_PRINTOBJECTS:
122 				pHdl = new XMLPMPropHdl_Print( XML_OBJECTS );
123 			break;
124 			case XML_PM_TYPE_PRINTZEROVALUES:
125 				pHdl = new XMLPMPropHdl_Print( XML_ZERO_VALUES );
126 			break;
127 			case XML_PM_TYPE_PRINTPAGEORDER:
128 				pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB ),
129                                                     GetXMLToken( XML_LTR ) );
130 			break;
131 			case XML_PM_TYPE_FIRSTPAGENUMBER:
132 				pHdl = new XMLNumberNonePropHdl( XML_CONTINUE, 2 );
133 			break;
134 			case XML_PM_TYPE_CENTER_HORIZONTAL:
135 				pHdl = new XMLPMPropHdl_CenterHorizontal();
136 			break;
137 			case XML_PM_TYPE_CENTER_VERTICAL:
138 				pHdl = new XMLPMPropHdl_CenterVertical();
139 			break;
140 			case XML_TYPE_TEXT_COLUMNS:
141 				pHdl = new XMLTextColumnsPropertyHandler;
142 			break;
143             case XML_TYPE_LAYOUT_GRID_MODE:
144                 pHdl = new XMLConstantsPropertyHandler(
145                     aXML_TextGridMode_ConstantMap, XML_NONE );
146             break;
147 
148             //UUUU
149             case XML_SW_TYPE_FILLSTYLE:
150                 pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap, ::getCppuType((const FillStyle*)0) );
151                 break;
152             case XML_SW_TYPE_FILLBITMAPSIZE:
153                 pHdl = new XMLFillBitmapSizePropertyHandler();
154                 break;
155             case XML_SW_TYPE_LOGICAL_SIZE:
156                 pHdl = new XMLBitmapLogicalSizePropertyHandler();
157                 break;
158             case XML_SW_TYPE_BITMAP_REFPOINT:
159                 pHdl = new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap, getCppuType((const RectanglePoint*)0) );
160                 break;
161             case XML_SW_TYPE_BITMAP_MODE:
162                 pHdl = new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap, getCppuType((const BitmapMode*)0) );
163                 break;
164             case XML_SW_TYPE_BITMAPREPOFFSETX:
165             case XML_SW_TYPE_BITMAPREPOFFSETY:
166                 pHdl = new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX == nType);
167                 break;
168 
169             //UUUU
170             default:
171             {
172                 OSL_ENSURE(false, "XMLPropertyHandler missing (!)");
173                 break;
174             }
175 		}
176 
177 		if( pHdl )
178 			PutHdlCache( nType, pHdl );
179 	}
180 	return pHdl;
181 }
182 
183 
184