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