Branch data 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 : 255 : XMLPageMasterPropHdlFactory::XMLPageMasterPropHdlFactory() :
50 : 255 : XMLPropertyHandlerFactory()
51 : : {
52 : 255 : }
53 : :
54 : 255 : XMLPageMasterPropHdlFactory::~XMLPageMasterPropHdlFactory()
55 : : {
56 [ - + ]: 510 : }
57 : :
58 : 33660 : const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
59 : : {
60 : 33660 : nType &= MID_FLAG_MASK;
61 : :
62 : 33660 : XMLPropertyHandler* pHdl = (XMLPropertyHandler*) XMLPropertyHandlerFactory::GetPropertyHandler( nType );
63 [ + + ]: 33660 : if( !pHdl )
64 : : {
65 [ + + + - : 4590 : switch( nType )
+ + + + +
+ + + + +
+ + + + +
- ]
66 : : {
67 : : case XML_PM_TYPE_PAGESTYLELAYOUT:
68 [ + - ]: 255 : pHdl = new XMLPMPropHdl_PageStyleLayout();
69 : 255 : break;
70 : : case XML_PM_TYPE_NUMFORMAT:
71 [ + - ]: 255 : pHdl = new XMLPMPropHdl_NumFormat();
72 : 255 : break;
73 : : case XML_PM_TYPE_NUMLETTERSYNC:
74 [ + - ]: 255 : pHdl = new XMLPMPropHdl_NumLetterSync();
75 : 255 : 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 [ + - ]: 255 : GetXMLToken( XML_PORTRAIT ) );
83 : 255 : break;
84 : : case XML_PM_TYPE_PRINTANNOTATIONS:
85 [ + - ]: 255 : pHdl = new XMLPMPropHdl_Print( XML_ANNOTATIONS );
86 : 255 : break;
87 : : case XML_PM_TYPE_PRINTCHARTS:
88 [ + - ]: 255 : pHdl = new XMLPMPropHdl_Print( XML_CHARTS );
89 : 255 : break;
90 : : case XML_PM_TYPE_PRINTDRAWING:
91 [ + - ]: 255 : pHdl = new XMLPMPropHdl_Print( XML_DRAWINGS );
92 : 255 : break;
93 : : case XML_PM_TYPE_PRINTFORMULAS:
94 [ + - ]: 255 : pHdl = new XMLPMPropHdl_Print( XML_FORMULAS );
95 : 255 : break;
96 : : case XML_PM_TYPE_PRINTGRID:
97 [ + - ]: 255 : pHdl = new XMLPMPropHdl_Print( XML_GRID );
98 : 255 : break;
99 : : case XML_PM_TYPE_PRINTHEADERS:
100 [ + - ]: 255 : pHdl = new XMLPMPropHdl_Print( XML_HEADERS );
101 : 255 : break;
102 : : case XML_PM_TYPE_PRINTOBJECTS:
103 [ + - ]: 255 : pHdl = new XMLPMPropHdl_Print( XML_OBJECTS );
104 : 255 : break;
105 : : case XML_PM_TYPE_PRINTZEROVALUES:
106 [ + - ]: 255 : pHdl = new XMLPMPropHdl_Print( XML_ZERO_VALUES );
107 : 255 : break;
108 : : case XML_PM_TYPE_PRINTPAGEORDER:
109 : : pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB ),
110 [ + - ]: 255 : GetXMLToken( XML_LTR ) );
111 : 255 : break;
112 : : case XML_PM_TYPE_FIRSTPAGENUMBER:
113 [ + - ]: 255 : pHdl = new XMLNumberNonePropHdl( XML_CONTINUE, 2 );
114 : 255 : break;
115 : : case XML_PM_TYPE_CENTER_HORIZONTAL:
116 [ + - ]: 255 : pHdl = new XMLPMPropHdl_CenterHorizontal();
117 : 255 : break;
118 : : case XML_PM_TYPE_CENTER_VERTICAL:
119 [ + - ]: 255 : pHdl = new XMLPMPropHdl_CenterVertical();
120 : 255 : break;
121 : : case XML_TYPE_TEXT_COLUMNS:
122 [ + - ]: 255 : pHdl = new XMLTextColumnsPropertyHandler;
123 : 255 : break;
124 : : case XML_TYPE_LAYOUT_GRID_MODE:
125 : : pHdl = new XMLConstantsPropertyHandler(
126 [ + - ]: 255 : aXML_TextGridMode_ConstantMap, XML_NONE );
127 : 255 : break;
128 : : }
129 : :
130 [ + - ]: 4590 : if( pHdl )
131 : 4590 : PutHdlCache( nType, pHdl );
132 : : }
133 : 33660 : return pHdl;
134 : : }
135 : :
136 : :
137 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|