163bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
363bba73cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
463bba73cSAndrew Rist * or more contributor license agreements. See the NOTICE file
563bba73cSAndrew Rist * distributed with this work for additional information
663bba73cSAndrew Rist * regarding copyright ownership. The ASF licenses this file
763bba73cSAndrew Rist * to you under the Apache License, Version 2.0 (the
863bba73cSAndrew Rist * "License"); you may not use this file except in compliance
963bba73cSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
1163bba73cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
1363bba73cSAndrew Rist * Unless required by applicable law or agreed to in writing,
1463bba73cSAndrew Rist * software distributed under the License is distributed on an
1563bba73cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1663bba73cSAndrew Rist * KIND, either express or implied. See the License for the
1763bba73cSAndrew Rist * specific language governing permissions and limitations
1863bba73cSAndrew Rist * under the License.
19cdf0e10cSrcweir *
2063bba73cSAndrew Rist *************************************************************/
2163bba73cSAndrew Rist
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
24*56b35d86SArmin Le Grand
25cdf0e10cSrcweir #include "PageMasterPropHdlFactory.hxx"
26cdf0e10cSrcweir #include <xmloff/xmltypes.hxx>
27cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
28cdf0e10cSrcweir #include "xmlbahdl.hxx"
29cdf0e10cSrcweir #include <xmloff/NamedBoolPropertyHdl.hxx>
30cdf0e10cSrcweir #include "XMLTextColumnsPropertyHandler.hxx"
31cdf0e10cSrcweir #include <xmloff/XMLConstantsPropertyHandler.hxx>
32cdf0e10cSrcweir #include "PageMasterPropHdl.hxx"
33cdf0e10cSrcweir #include <xmloff/PageMasterStyleMap.hxx>
34cdf0e10cSrcweir #include <com/sun/star/text/TextGridMode.hpp>
35cdf0e10cSrcweir
36*56b35d86SArmin Le Grand //UUUU
37*56b35d86SArmin Le Grand #include <xmloff/EnumPropertyHdl.hxx>
38*56b35d86SArmin Le Grand #include <com/sun/star/drawing/FillStyle.hpp>
39*56b35d86SArmin Le Grand #include "XMLFillBitmapSizePropertyHandler.hxx"
40*56b35d86SArmin Le Grand #include "XMLBitmapLogicalSizePropertyHandler.hxx"
41*56b35d86SArmin Le Grand #include <com/sun/star/drawing/RectanglePoint.hpp>
42*56b35d86SArmin Le Grand #include <com/sun/star/drawing/BitmapMode.hpp>
43*56b35d86SArmin Le Grand #include "XMLBitmapRepeatOffsetPropertyHandler.hxx"
44cdf0e10cSrcweir
45cdf0e10cSrcweir using ::rtl::OUString;
46cdf0e10cSrcweir using ::rtl::OUStringBuffer;
47cdf0e10cSrcweir
48cdf0e10cSrcweir using namespace ::xmloff::token;
49cdf0e10cSrcweir using namespace ::com::sun::star;
50*56b35d86SArmin Le Grand //UUUU
51*56b35d86SArmin Le Grand using namespace ::com::sun::star::drawing;
52cdf0e10cSrcweir
53*56b35d86SArmin Le Grand //UUUU
54*56b35d86SArmin Le Grand extern SvXMLEnumMapEntry aXML_FillStyle_EnumMap[];
55*56b35d86SArmin Le Grand extern SvXMLEnumMapEntry aXML_RefPoint_EnumMap[];
56*56b35d86SArmin Le Grand extern SvXMLEnumMapEntry aXML_BitmapMode_EnumMap[];
57cdf0e10cSrcweir
58cdf0e10cSrcweir SvXMLEnumMapEntry aXML_TextGridMode_ConstantMap[] =
59cdf0e10cSrcweir {
60cdf0e10cSrcweir { XML_NONE, text::TextGridMode::NONE },
61cdf0e10cSrcweir { XML_LINE, text::TextGridMode::LINES },
62cdf0e10cSrcweir { XML_BOTH, text::TextGridMode::LINES_AND_CHARS },
63cdf0e10cSrcweir { XML_TOKEN_INVALID, 0 }
64cdf0e10cSrcweir };
65cdf0e10cSrcweir
66cdf0e10cSrcweir //______________________________________________________________________________
67cdf0e10cSrcweir
XMLPageMasterPropHdlFactory()68cdf0e10cSrcweir XMLPageMasterPropHdlFactory::XMLPageMasterPropHdlFactory() :
69cdf0e10cSrcweir XMLPropertyHandlerFactory()
70cdf0e10cSrcweir {
71cdf0e10cSrcweir }
72cdf0e10cSrcweir
~XMLPageMasterPropHdlFactory()73cdf0e10cSrcweir XMLPageMasterPropHdlFactory::~XMLPageMasterPropHdlFactory()
74cdf0e10cSrcweir {
75cdf0e10cSrcweir }
76cdf0e10cSrcweir
GetPropertyHandler(sal_Int32 nType) const77cdf0e10cSrcweir const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
78cdf0e10cSrcweir {
79cdf0e10cSrcweir nType &= MID_FLAG_MASK;
80cdf0e10cSrcweir
81cdf0e10cSrcweir XMLPropertyHandler* pHdl = (XMLPropertyHandler*) XMLPropertyHandlerFactory::GetPropertyHandler( nType );
82cdf0e10cSrcweir if( !pHdl )
83cdf0e10cSrcweir {
84cdf0e10cSrcweir switch( nType )
85cdf0e10cSrcweir {
86cdf0e10cSrcweir case XML_PM_TYPE_PAGESTYLELAYOUT:
87cdf0e10cSrcweir pHdl = new XMLPMPropHdl_PageStyleLayout();
88cdf0e10cSrcweir break;
89cdf0e10cSrcweir case XML_PM_TYPE_NUMFORMAT:
90cdf0e10cSrcweir pHdl = new XMLPMPropHdl_NumFormat();
91cdf0e10cSrcweir break;
92cdf0e10cSrcweir case XML_PM_TYPE_NUMLETTERSYNC:
93cdf0e10cSrcweir pHdl = new XMLPMPropHdl_NumLetterSync();
94cdf0e10cSrcweir break;
95cdf0e10cSrcweir case XML_PM_TYPE_PAPERTRAYNUMBER:
96cdf0e10cSrcweir pHdl = new XMLPMPropHdl_PaperTrayNumber();
97cdf0e10cSrcweir break;
98cdf0e10cSrcweir case XML_PM_TYPE_PRINTORIENTATION:
99cdf0e10cSrcweir pHdl = new XMLNamedBoolPropertyHdl(
100cdf0e10cSrcweir GetXMLToken( XML_LANDSCAPE ),
101cdf0e10cSrcweir GetXMLToken( XML_PORTRAIT ) );
102cdf0e10cSrcweir break;
103cdf0e10cSrcweir case XML_PM_TYPE_PRINTANNOTATIONS:
104cdf0e10cSrcweir pHdl = new XMLPMPropHdl_Print( XML_ANNOTATIONS );
105cdf0e10cSrcweir break;
106cdf0e10cSrcweir case XML_PM_TYPE_PRINTCHARTS:
107cdf0e10cSrcweir pHdl = new XMLPMPropHdl_Print( XML_CHARTS );
108cdf0e10cSrcweir break;
109cdf0e10cSrcweir case XML_PM_TYPE_PRINTDRAWING:
110cdf0e10cSrcweir pHdl = new XMLPMPropHdl_Print( XML_DRAWINGS );
111cdf0e10cSrcweir break;
112cdf0e10cSrcweir case XML_PM_TYPE_PRINTFORMULAS:
113cdf0e10cSrcweir pHdl = new XMLPMPropHdl_Print( XML_FORMULAS );
114cdf0e10cSrcweir break;
115cdf0e10cSrcweir case XML_PM_TYPE_PRINTGRID:
116cdf0e10cSrcweir pHdl = new XMLPMPropHdl_Print( XML_GRID );
117cdf0e10cSrcweir break;
118cdf0e10cSrcweir case XML_PM_TYPE_PRINTHEADERS:
119cdf0e10cSrcweir pHdl = new XMLPMPropHdl_Print( XML_HEADERS );
120cdf0e10cSrcweir break;
121cdf0e10cSrcweir case XML_PM_TYPE_PRINTOBJECTS:
122cdf0e10cSrcweir pHdl = new XMLPMPropHdl_Print( XML_OBJECTS );
123cdf0e10cSrcweir break;
124cdf0e10cSrcweir case XML_PM_TYPE_PRINTZEROVALUES:
125cdf0e10cSrcweir pHdl = new XMLPMPropHdl_Print( XML_ZERO_VALUES );
126cdf0e10cSrcweir break;
127cdf0e10cSrcweir case XML_PM_TYPE_PRINTPAGEORDER:
128cdf0e10cSrcweir pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB ),
129cdf0e10cSrcweir GetXMLToken( XML_LTR ) );
130cdf0e10cSrcweir break;
131cdf0e10cSrcweir case XML_PM_TYPE_FIRSTPAGENUMBER:
132cdf0e10cSrcweir pHdl = new XMLNumberNonePropHdl( XML_CONTINUE, 2 );
133cdf0e10cSrcweir break;
134cdf0e10cSrcweir case XML_PM_TYPE_CENTER_HORIZONTAL:
135cdf0e10cSrcweir pHdl = new XMLPMPropHdl_CenterHorizontal();
136cdf0e10cSrcweir break;
137cdf0e10cSrcweir case XML_PM_TYPE_CENTER_VERTICAL:
138cdf0e10cSrcweir pHdl = new XMLPMPropHdl_CenterVertical();
139cdf0e10cSrcweir break;
140cdf0e10cSrcweir case XML_TYPE_TEXT_COLUMNS:
141cdf0e10cSrcweir pHdl = new XMLTextColumnsPropertyHandler;
142cdf0e10cSrcweir break;
143cdf0e10cSrcweir case XML_TYPE_LAYOUT_GRID_MODE:
144cdf0e10cSrcweir pHdl = new XMLConstantsPropertyHandler(
145cdf0e10cSrcweir aXML_TextGridMode_ConstantMap, XML_NONE );
146cdf0e10cSrcweir break;
147*56b35d86SArmin Le Grand
148*56b35d86SArmin Le Grand //UUUU
149*56b35d86SArmin Le Grand case XML_SW_TYPE_FILLSTYLE:
150*56b35d86SArmin Le Grand pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap, ::getCppuType((const FillStyle*)0) );
151*56b35d86SArmin Le Grand break;
152*56b35d86SArmin Le Grand case XML_SW_TYPE_FILLBITMAPSIZE:
153*56b35d86SArmin Le Grand pHdl = new XMLFillBitmapSizePropertyHandler();
154*56b35d86SArmin Le Grand break;
155*56b35d86SArmin Le Grand case XML_SW_TYPE_LOGICAL_SIZE:
156*56b35d86SArmin Le Grand pHdl = new XMLBitmapLogicalSizePropertyHandler();
157*56b35d86SArmin Le Grand break;
158*56b35d86SArmin Le Grand case XML_SW_TYPE_BITMAP_REFPOINT:
159*56b35d86SArmin Le Grand pHdl = new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap, getCppuType((const RectanglePoint*)0) );
160*56b35d86SArmin Le Grand break;
161*56b35d86SArmin Le Grand case XML_SW_TYPE_BITMAP_MODE:
162*56b35d86SArmin Le Grand pHdl = new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap, getCppuType((const BitmapMode*)0) );
163*56b35d86SArmin Le Grand break;
164*56b35d86SArmin Le Grand case XML_SW_TYPE_BITMAPREPOFFSETX:
165*56b35d86SArmin Le Grand case XML_SW_TYPE_BITMAPREPOFFSETY:
166*56b35d86SArmin Le Grand pHdl = new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX == nType);
167*56b35d86SArmin Le Grand break;
168*56b35d86SArmin Le Grand
169*56b35d86SArmin Le Grand //UUUU
170*56b35d86SArmin Le Grand default:
171*56b35d86SArmin Le Grand {
172*56b35d86SArmin Le Grand OSL_ENSURE(false, "XMLPropertyHandler missing (!)");
173*56b35d86SArmin Le Grand break;
174*56b35d86SArmin Le Grand }
175cdf0e10cSrcweir }
176cdf0e10cSrcweir
177cdf0e10cSrcweir if( pHdl )
178cdf0e10cSrcweir PutHdlCache( nType, pHdl );
179cdf0e10cSrcweir }
180cdf0e10cSrcweir return pHdl;
181cdf0e10cSrcweir }
182