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 : using ::rtl::OUString;
33 : using ::rtl::OUStringBuffer;
34 :
35 : using namespace ::xmloff::token;
36 : using namespace ::com::sun::star;
37 :
38 :
39 : SvXMLEnumMapEntry aXML_TextGridMode_ConstantMap[] =
40 : {
41 : { XML_NONE, text::TextGridMode::NONE },
42 : { XML_LINE, text::TextGridMode::LINES },
43 : { XML_BOTH, text::TextGridMode::LINES_AND_CHARS },
44 : { XML_TOKEN_INVALID, 0 }
45 : };
46 :
47 : //______________________________________________________________________________
48 :
49 43 : XMLPageMasterPropHdlFactory::XMLPageMasterPropHdlFactory() :
50 43 : XMLPropertyHandlerFactory()
51 : {
52 43 : }
53 :
54 86 : XMLPageMasterPropHdlFactory::~XMLPageMasterPropHdlFactory()
55 : {
56 86 : }
57 :
58 5676 : const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
59 : {
60 5676 : nType &= MID_FLAG_MASK;
61 :
62 5676 : XMLPropertyHandler* pHdl = (XMLPropertyHandler*) XMLPropertyHandlerFactory::GetPropertyHandler( nType );
63 5676 : if( !pHdl )
64 : {
65 774 : switch( nType )
66 : {
67 : case XML_PM_TYPE_PAGESTYLELAYOUT:
68 43 : pHdl = new XMLPMPropHdl_PageStyleLayout();
69 43 : break;
70 : case XML_PM_TYPE_NUMFORMAT:
71 43 : pHdl = new XMLPMPropHdl_NumFormat();
72 43 : break;
73 : case XML_PM_TYPE_NUMLETTERSYNC:
74 43 : pHdl = new XMLPMPropHdl_NumLetterSync();
75 43 : break;
76 : case XML_PM_TYPE_PAPERTRAYNUMBER:
77 0 : pHdl = new XMLPMPropHdl_PaperTrayNumber();
78 0 : break;
79 : case XML_PM_TYPE_PRINTORIENTATION:
80 : pHdl = new XMLNamedBoolPropertyHdl(
81 : GetXMLToken( XML_LANDSCAPE ),
82 43 : GetXMLToken( XML_PORTRAIT ) );
83 43 : break;
84 : case XML_PM_TYPE_PRINTANNOTATIONS:
85 43 : pHdl = new XMLPMPropHdl_Print( XML_ANNOTATIONS );
86 43 : break;
87 : case XML_PM_TYPE_PRINTCHARTS:
88 43 : pHdl = new XMLPMPropHdl_Print( XML_CHARTS );
89 43 : break;
90 : case XML_PM_TYPE_PRINTDRAWING:
91 43 : pHdl = new XMLPMPropHdl_Print( XML_DRAWINGS );
92 43 : break;
93 : case XML_PM_TYPE_PRINTFORMULAS:
94 43 : pHdl = new XMLPMPropHdl_Print( XML_FORMULAS );
95 43 : break;
96 : case XML_PM_TYPE_PRINTGRID:
97 43 : pHdl = new XMLPMPropHdl_Print( XML_GRID );
98 43 : break;
99 : case XML_PM_TYPE_PRINTHEADERS:
100 43 : pHdl = new XMLPMPropHdl_Print( XML_HEADERS );
101 43 : break;
102 : case XML_PM_TYPE_PRINTOBJECTS:
103 43 : pHdl = new XMLPMPropHdl_Print( XML_OBJECTS );
104 43 : break;
105 : case XML_PM_TYPE_PRINTZEROVALUES:
106 43 : pHdl = new XMLPMPropHdl_Print( XML_ZERO_VALUES );
107 43 : break;
108 : case XML_PM_TYPE_PRINTPAGEORDER:
109 : pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB ),
110 43 : GetXMLToken( XML_LTR ) );
111 43 : break;
112 : case XML_PM_TYPE_FIRSTPAGENUMBER:
113 43 : pHdl = new XMLNumberNonePropHdl( XML_CONTINUE, 2 );
114 43 : break;
115 : case XML_PM_TYPE_CENTER_HORIZONTAL:
116 43 : pHdl = new XMLPMPropHdl_CenterHorizontal();
117 43 : break;
118 : case XML_PM_TYPE_CENTER_VERTICAL:
119 43 : pHdl = new XMLPMPropHdl_CenterVertical();
120 43 : break;
121 : case XML_TYPE_TEXT_COLUMNS:
122 43 : pHdl = new XMLTextColumnsPropertyHandler;
123 43 : break;
124 : case XML_TYPE_LAYOUT_GRID_MODE:
125 : pHdl = new XMLConstantsPropertyHandler(
126 43 : aXML_TextGridMode_ConstantMap, XML_NONE );
127 43 : break;
128 : }
129 :
130 774 : if( pHdl )
131 774 : PutHdlCache( nType, pHdl );
132 : }
133 5676 : return pHdl;
134 : }
135 :
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|