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