/src/libreoffice/xmloff/source/style/PageMasterPropHdlFactory.cxx
Line | Count | Source |
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 <enummaps.hxx> |
22 | | #include <xmloff/xmlement.hxx> |
23 | | #include <xmloff/xmltypes.hxx> |
24 | | #include <xmloff/xmltoken.hxx> |
25 | | #include <xmlbahdl.hxx> |
26 | | #include <xmloff/NamedBoolPropertyHdl.hxx> |
27 | | #include <XMLTextColumnsPropertyHandler.hxx> |
28 | | #include <xmloff/XMLConstantsPropertyHandler.hxx> |
29 | | #include "PageMasterPropHdl.hxx" |
30 | | #include <PageMasterStyleMap.hxx> |
31 | | #include <com/sun/star/text/TextGridMode.hpp> |
32 | | #include <xmloff/EnumPropertyHdl.hxx> |
33 | | #include <osl/diagnose.h> |
34 | | #include <XMLFillBitmapSizePropertyHandler.hxx> |
35 | | #include <XMLBitmapLogicalSizePropertyHandler.hxx> |
36 | | #include <XMLBitmapRepeatOffsetPropertyHandler.hxx> |
37 | | #include <XMLRtlGutterPropertyHandler.hxx> |
38 | | |
39 | | using namespace ::xmloff::token; |
40 | | using namespace ::com::sun::star; |
41 | | |
42 | | SvXMLEnumMapEntry<sal_uInt16> const aXML_TextGridMode_ConstantMap[] = |
43 | | { |
44 | | { XML_NONE, text::TextGridMode::NONE }, |
45 | | { XML_LINE, text::TextGridMode::LINES }, |
46 | | { XML_BOTH, text::TextGridMode::LINES_AND_CHARS }, |
47 | | { XML_TOKEN_INVALID, 0 } |
48 | | }; |
49 | | |
50 | | XMLPageMasterPropHdlFactory::XMLPageMasterPropHdlFactory() |
51 | 2.89k | { |
52 | 2.89k | } |
53 | | |
54 | | XMLPageMasterPropHdlFactory::~XMLPageMasterPropHdlFactory() |
55 | 2.89k | { |
56 | 2.89k | } |
57 | | |
58 | | const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const |
59 | 518k | { |
60 | 518k | nType &= MID_FLAG_MASK; |
61 | | |
62 | 518k | XMLPropertyHandler* pHdl = const_cast<XMLPropertyHandler*>(XMLPropertyHandlerFactory::GetPropertyHandler( nType )); |
63 | 518k | if( !pHdl ) |
64 | 70.0k | { |
65 | 70.0k | switch( nType ) |
66 | 70.0k | { |
67 | 2.60k | case XML_PM_TYPE_PAGESTYLELAYOUT: |
68 | 2.60k | pHdl = new XMLPMPropHdl_PageStyleLayout; |
69 | 2.60k | break; |
70 | 2.60k | case XML_PM_TYPE_NUMFORMAT: |
71 | 2.60k | pHdl = new XMLPMPropHdl_NumFormat; |
72 | 2.60k | break; |
73 | 2.60k | case XML_PM_TYPE_NUMLETTERSYNC: |
74 | 2.60k | pHdl = new XMLPMPropHdl_NumLetterSync; |
75 | 2.60k | break; |
76 | 0 | case XML_PM_TYPE_PAPERTRAYNUMBER: |
77 | 0 | pHdl = new XMLPMPropHdl_PaperTrayNumber; |
78 | 0 | break; |
79 | 2.60k | case XML_PM_TYPE_PRINTORIENTATION: |
80 | 2.60k | pHdl = new XMLNamedBoolPropertyHdl( |
81 | 2.60k | GetXMLToken( XML_LANDSCAPE ), |
82 | 2.60k | GetXMLToken( XML_PORTRAIT ) ); |
83 | 2.60k | break; |
84 | 2.60k | case XML_PM_TYPE_PRINTANNOTATIONS: |
85 | 2.60k | pHdl = new XMLPMPropHdl_Print( XML_ANNOTATIONS ); |
86 | 2.60k | break; |
87 | 2.60k | case XML_PM_TYPE_PRINTCHARTS: |
88 | 2.60k | pHdl = new XMLPMPropHdl_Print( XML_CHARTS ); |
89 | 2.60k | break; |
90 | 2.60k | case XML_PM_TYPE_PRINTDRAWING: |
91 | 2.60k | pHdl = new XMLPMPropHdl_Print( XML_DRAWINGS ); |
92 | 2.60k | break; |
93 | 2.60k | case XML_PM_TYPE_PRINTFORMULAS: |
94 | 2.60k | pHdl = new XMLPMPropHdl_Print( XML_FORMULAS ); |
95 | 2.60k | break; |
96 | 2.60k | case XML_PM_TYPE_PRINTGRID: |
97 | 2.60k | pHdl = new XMLPMPropHdl_Print( XML_GRID ); |
98 | 2.60k | break; |
99 | 2.60k | case XML_PM_TYPE_PRINTHEADERS: |
100 | 2.60k | pHdl = new XMLPMPropHdl_Print( XML_HEADERS ); |
101 | 2.60k | break; |
102 | 2.60k | case XML_PM_TYPE_PRINTOBJECTS: |
103 | 2.60k | pHdl = new XMLPMPropHdl_Print( XML_OBJECTS ); |
104 | 2.60k | break; |
105 | 2.60k | case XML_PM_TYPE_PRINTZEROVALUES: |
106 | 2.60k | pHdl = new XMLPMPropHdl_Print( XML_ZERO_VALUES ); |
107 | 2.60k | break; |
108 | 2.60k | case XML_PM_TYPE_PRINTPAGEORDER: |
109 | 2.60k | pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB ), |
110 | 2.60k | GetXMLToken( XML_LTR ) ); |
111 | 2.60k | break; |
112 | 2.60k | case XML_PM_TYPE_FIRSTPAGENUMBER: |
113 | 2.60k | pHdl = new XMLNumberNonePropHdl( XML_CONTINUE, 2 ); |
114 | 2.60k | break; |
115 | 2.60k | case XML_PM_TYPE_CENTER_HORIZONTAL: |
116 | 2.60k | pHdl = new XMLPMPropHdl_CenterHorizontal; |
117 | 2.60k | break; |
118 | 2.60k | case XML_PM_TYPE_CENTER_VERTICAL: |
119 | 2.60k | pHdl = new XMLPMPropHdl_CenterVertical; |
120 | 2.60k | break; |
121 | 2.60k | case XML_TYPE_TEXT_COLUMNS: |
122 | 2.60k | pHdl = new XMLTextColumnsPropertyHandler; |
123 | 2.60k | break; |
124 | 2.60k | case XML_TYPE_LAYOUT_GRID_MODE: |
125 | 2.60k | pHdl = new XMLConstantsPropertyHandler( |
126 | 2.60k | aXML_TextGridMode_ConstantMap, XML_NONE ); |
127 | 2.60k | break; |
128 | | |
129 | 2.89k | case XML_SW_TYPE_FILLSTYLE: |
130 | 2.89k | pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap ); |
131 | 2.89k | break; |
132 | 294 | case XML_SW_TYPE_PRESPAGE_BACKSIZE: |
133 | 294 | pHdl = new XMLNamedBoolPropertyHdl(GetXMLToken(XML_FULL), GetXMLToken(XML_BORDER)); |
134 | 294 | break; |
135 | 2.89k | case XML_SW_TYPE_FILLBITMAPSIZE: |
136 | 2.89k | pHdl = new XMLFillBitmapSizePropertyHandler(); |
137 | 2.89k | break; |
138 | 2.89k | case XML_SW_TYPE_LOGICAL_SIZE: |
139 | 2.89k | pHdl = new XMLBitmapLogicalSizePropertyHandler(); |
140 | 2.89k | break; |
141 | 2.89k | case XML_SW_TYPE_BITMAP_REFPOINT: |
142 | 2.89k | pHdl = new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap ); |
143 | 2.89k | break; |
144 | 2.89k | case XML_SW_TYPE_BITMAP_MODE: |
145 | 2.89k | pHdl = new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap ); |
146 | 2.89k | break; |
147 | 2.89k | case XML_SW_TYPE_BITMAPREPOFFSETX: |
148 | 5.79k | case XML_SW_TYPE_BITMAPREPOFFSETY: |
149 | 5.79k | pHdl = new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX == nType); |
150 | 5.79k | break; |
151 | 2.60k | case XML_SW_TYPE_RTLGUTTER: |
152 | 2.60k | pHdl = new XMLRtlGutterPropertyHandler(); |
153 | 2.60k | break; |
154 | | |
155 | 0 | default: |
156 | 0 | { |
157 | 0 | OSL_ENSURE(false, "XMLPropertyHandler missing (!)"); |
158 | 0 | break; |
159 | 2.89k | } |
160 | 70.0k | } |
161 | | |
162 | 70.0k | if( pHdl ) |
163 | 70.0k | PutHdlCache( nType, pHdl ); |
164 | 70.0k | } |
165 | 518k | return pHdl; |
166 | 518k | } |
167 | | |
168 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |