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