1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
30*cdf0e10cSrcweir #include "PageMasterPropHdlFactory.hxx"
31*cdf0e10cSrcweir #include <xmloff/xmltypes.hxx>
32*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
33*cdf0e10cSrcweir #include "xmlbahdl.hxx"
34*cdf0e10cSrcweir #include <xmloff/NamedBoolPropertyHdl.hxx>
35*cdf0e10cSrcweir #ifndef _XMLOFF_XMLTEXTCOLUMNSPPROPERTYHANDLER_HXX
36*cdf0e10cSrcweir #include "XMLTextColumnsPropertyHandler.hxx"
37*cdf0e10cSrcweir #endif
38*cdf0e10cSrcweir #include <xmloff/XMLConstantsPropertyHandler.hxx>
39*cdf0e10cSrcweir #include "PageMasterPropHdl.hxx"
40*cdf0e10cSrcweir #ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX
41*cdf0e10cSrcweir #include <xmloff/PageMasterStyleMap.hxx>
42*cdf0e10cSrcweir #endif
43*cdf0e10cSrcweir #include <com/sun/star/text/TextGridMode.hpp>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir using ::rtl::OUString;
47*cdf0e10cSrcweir using ::rtl::OUStringBuffer;
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir using namespace ::xmloff::token;
50*cdf0e10cSrcweir using namespace ::com::sun::star;
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir SvXMLEnumMapEntry aXML_TextGridMode_ConstantMap[] =
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir 	{ XML_NONE,         text::TextGridMode::NONE },
56*cdf0e10cSrcweir 	{ XML_LINE,	        text::TextGridMode::LINES },
57*cdf0e10cSrcweir 	{ XML_BOTH,         text::TextGridMode::LINES_AND_CHARS },
58*cdf0e10cSrcweir 	{ XML_TOKEN_INVALID, 0 }
59*cdf0e10cSrcweir };
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir //______________________________________________________________________________
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir XMLPageMasterPropHdlFactory::XMLPageMasterPropHdlFactory() :
64*cdf0e10cSrcweir 	XMLPropertyHandlerFactory()
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir }
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir XMLPageMasterPropHdlFactory::~XMLPageMasterPropHdlFactory()
69*cdf0e10cSrcweir {
70*cdf0e10cSrcweir }
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
73*cdf0e10cSrcweir {
74*cdf0e10cSrcweir 	nType &= MID_FLAG_MASK;
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir 	XMLPropertyHandler* pHdl = (XMLPropertyHandler*) XMLPropertyHandlerFactory::GetPropertyHandler( nType );
77*cdf0e10cSrcweir 	if( !pHdl )
78*cdf0e10cSrcweir 	{
79*cdf0e10cSrcweir 		switch( nType )
80*cdf0e10cSrcweir 		{
81*cdf0e10cSrcweir 			case XML_PM_TYPE_PAGESTYLELAYOUT:
82*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_PageStyleLayout();
83*cdf0e10cSrcweir 			break;
84*cdf0e10cSrcweir 			case XML_PM_TYPE_NUMFORMAT:
85*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_NumFormat();
86*cdf0e10cSrcweir 			break;
87*cdf0e10cSrcweir 			case XML_PM_TYPE_NUMLETTERSYNC:
88*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_NumLetterSync();
89*cdf0e10cSrcweir 			break;
90*cdf0e10cSrcweir 			case XML_PM_TYPE_PAPERTRAYNUMBER:
91*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_PaperTrayNumber();
92*cdf0e10cSrcweir 			break;
93*cdf0e10cSrcweir 			case XML_PM_TYPE_PRINTORIENTATION:
94*cdf0e10cSrcweir 				pHdl = new XMLNamedBoolPropertyHdl(
95*cdf0e10cSrcweir                     GetXMLToken( XML_LANDSCAPE ),
96*cdf0e10cSrcweir 					GetXMLToken( XML_PORTRAIT ) );
97*cdf0e10cSrcweir 			break;
98*cdf0e10cSrcweir 			case XML_PM_TYPE_PRINTANNOTATIONS:
99*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_Print( XML_ANNOTATIONS );
100*cdf0e10cSrcweir 			break;
101*cdf0e10cSrcweir 			case XML_PM_TYPE_PRINTCHARTS:
102*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_Print( XML_CHARTS );
103*cdf0e10cSrcweir 			break;
104*cdf0e10cSrcweir 			case XML_PM_TYPE_PRINTDRAWING:
105*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_Print( XML_DRAWINGS );
106*cdf0e10cSrcweir 			break;
107*cdf0e10cSrcweir 			case XML_PM_TYPE_PRINTFORMULAS:
108*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_Print( XML_FORMULAS );
109*cdf0e10cSrcweir 			break;
110*cdf0e10cSrcweir 			case XML_PM_TYPE_PRINTGRID:
111*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_Print( XML_GRID );
112*cdf0e10cSrcweir 			break;
113*cdf0e10cSrcweir 			case XML_PM_TYPE_PRINTHEADERS:
114*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_Print( XML_HEADERS );
115*cdf0e10cSrcweir 			break;
116*cdf0e10cSrcweir 			case XML_PM_TYPE_PRINTOBJECTS:
117*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_Print( XML_OBJECTS );
118*cdf0e10cSrcweir 			break;
119*cdf0e10cSrcweir 			case XML_PM_TYPE_PRINTZEROVALUES:
120*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_Print( XML_ZERO_VALUES );
121*cdf0e10cSrcweir 			break;
122*cdf0e10cSrcweir 			case XML_PM_TYPE_PRINTPAGEORDER:
123*cdf0e10cSrcweir 				pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB ),
124*cdf0e10cSrcweir                                                     GetXMLToken( XML_LTR ) );
125*cdf0e10cSrcweir 			break;
126*cdf0e10cSrcweir 			case XML_PM_TYPE_FIRSTPAGENUMBER:
127*cdf0e10cSrcweir 				pHdl = new XMLNumberNonePropHdl( XML_CONTINUE, 2 );
128*cdf0e10cSrcweir 			break;
129*cdf0e10cSrcweir 			case XML_PM_TYPE_CENTER_HORIZONTAL:
130*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_CenterHorizontal();
131*cdf0e10cSrcweir 			break;
132*cdf0e10cSrcweir 			case XML_PM_TYPE_CENTER_VERTICAL:
133*cdf0e10cSrcweir 				pHdl = new XMLPMPropHdl_CenterVertical();
134*cdf0e10cSrcweir 			break;
135*cdf0e10cSrcweir 			case XML_TYPE_TEXT_COLUMNS:
136*cdf0e10cSrcweir 				pHdl = new XMLTextColumnsPropertyHandler;
137*cdf0e10cSrcweir 			break;
138*cdf0e10cSrcweir             case XML_TYPE_LAYOUT_GRID_MODE:
139*cdf0e10cSrcweir                 pHdl = new XMLConstantsPropertyHandler(
140*cdf0e10cSrcweir                     aXML_TextGridMode_ConstantMap, XML_NONE );
141*cdf0e10cSrcweir             break;
142*cdf0e10cSrcweir 		}
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir 		if( pHdl )
145*cdf0e10cSrcweir 			PutHdlCache( nType, pHdl );
146*cdf0e10cSrcweir 	}
147*cdf0e10cSrcweir 	return pHdl;
148*cdf0e10cSrcweir }
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 
151