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