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