Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "PageMasterPropHdlFactory.hxx"
21 : #include <xmloff/xmltypes.hxx>
22 : #include <xmloff/xmltoken.hxx>
23 : #include "xmlbahdl.hxx"
24 : #include <xmloff/NamedBoolPropertyHdl.hxx>
25 : #include "XMLTextColumnsPropertyHandler.hxx"
26 : #include <xmloff/XMLConstantsPropertyHandler.hxx>
27 : #include "PageMasterPropHdl.hxx"
28 : #include <xmloff/PageMasterStyleMap.hxx>
29 : #include <com/sun/star/text/TextGridMode.hpp>
30 :
31 :
32 :
33 : using namespace ::xmloff::token;
34 : using namespace ::com::sun::star;
35 :
36 :
37 : SvXMLEnumMapEntry aXML_TextGridMode_ConstantMap[] =
38 : {
39 : { XML_NONE, text::TextGridMode::NONE },
40 : { XML_LINE, text::TextGridMode::LINES },
41 : { XML_BOTH, text::TextGridMode::LINES_AND_CHARS },
42 : { XML_TOKEN_INVALID, 0 }
43 : };
44 :
45 : //______________________________________________________________________________
46 :
47 154 : XMLPageMasterPropHdlFactory::XMLPageMasterPropHdlFactory() :
48 154 : XMLPropertyHandlerFactory()
49 : {
50 154 : }
51 :
52 308 : XMLPageMasterPropHdlFactory::~XMLPageMasterPropHdlFactory()
53 : {
54 308 : }
55 :
56 20328 : const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
57 : {
58 20328 : nType &= MID_FLAG_MASK;
59 :
60 20328 : XMLPropertyHandler* pHdl = (XMLPropertyHandler*) XMLPropertyHandlerFactory::GetPropertyHandler( nType );
61 20328 : if( !pHdl )
62 : {
63 2772 : switch( nType )
64 : {
65 : case XML_PM_TYPE_PAGESTYLELAYOUT:
66 154 : pHdl = new XMLPMPropHdl_PageStyleLayout();
67 154 : break;
68 : case XML_PM_TYPE_NUMFORMAT:
69 154 : pHdl = new XMLPMPropHdl_NumFormat();
70 154 : break;
71 : case XML_PM_TYPE_NUMLETTERSYNC:
72 154 : pHdl = new XMLPMPropHdl_NumLetterSync();
73 154 : break;
74 : case XML_PM_TYPE_PAPERTRAYNUMBER:
75 0 : pHdl = new XMLPMPropHdl_PaperTrayNumber();
76 0 : break;
77 : case XML_PM_TYPE_PRINTORIENTATION:
78 : pHdl = new XMLNamedBoolPropertyHdl(
79 : GetXMLToken( XML_LANDSCAPE ),
80 154 : GetXMLToken( XML_PORTRAIT ) );
81 154 : break;
82 : case XML_PM_TYPE_PRINTANNOTATIONS:
83 154 : pHdl = new XMLPMPropHdl_Print( XML_ANNOTATIONS );
84 154 : break;
85 : case XML_PM_TYPE_PRINTCHARTS:
86 154 : pHdl = new XMLPMPropHdl_Print( XML_CHARTS );
87 154 : break;
88 : case XML_PM_TYPE_PRINTDRAWING:
89 154 : pHdl = new XMLPMPropHdl_Print( XML_DRAWINGS );
90 154 : break;
91 : case XML_PM_TYPE_PRINTFORMULAS:
92 154 : pHdl = new XMLPMPropHdl_Print( XML_FORMULAS );
93 154 : break;
94 : case XML_PM_TYPE_PRINTGRID:
95 154 : pHdl = new XMLPMPropHdl_Print( XML_GRID );
96 154 : break;
97 : case XML_PM_TYPE_PRINTHEADERS:
98 154 : pHdl = new XMLPMPropHdl_Print( XML_HEADERS );
99 154 : break;
100 : case XML_PM_TYPE_PRINTOBJECTS:
101 154 : pHdl = new XMLPMPropHdl_Print( XML_OBJECTS );
102 154 : break;
103 : case XML_PM_TYPE_PRINTZEROVALUES:
104 154 : pHdl = new XMLPMPropHdl_Print( XML_ZERO_VALUES );
105 154 : break;
106 : case XML_PM_TYPE_PRINTPAGEORDER:
107 : pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB ),
108 154 : GetXMLToken( XML_LTR ) );
109 154 : break;
110 : case XML_PM_TYPE_FIRSTPAGENUMBER:
111 154 : pHdl = new XMLNumberNonePropHdl( XML_CONTINUE, 2 );
112 154 : break;
113 : case XML_PM_TYPE_CENTER_HORIZONTAL:
114 154 : pHdl = new XMLPMPropHdl_CenterHorizontal();
115 154 : break;
116 : case XML_PM_TYPE_CENTER_VERTICAL:
117 154 : pHdl = new XMLPMPropHdl_CenterVertical();
118 154 : break;
119 : case XML_TYPE_TEXT_COLUMNS:
120 154 : pHdl = new XMLTextColumnsPropertyHandler;
121 154 : break;
122 : case XML_TYPE_LAYOUT_GRID_MODE:
123 : pHdl = new XMLConstantsPropertyHandler(
124 154 : aXML_TextGridMode_ConstantMap, XML_NONE );
125 154 : break;
126 : }
127 :
128 2772 : if( pHdl )
129 2772 : PutHdlCache( nType, pHdl );
130 : }
131 20328 : return pHdl;
132 : }
133 :
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|