bump product version to 5.0.4.1
[LibreOffice.git] / xmloff / source / style / PageMasterPropHdlFactory.cxx
blob44165455add01aa69f0baf1d298ca8567d1655a1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
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"
41 using namespace ::xmloff::token;
42 using namespace ::com::sun::star;
43 //UUUU
44 using namespace ::com::sun::star::drawing;
46 //UUUU
47 extern SvXMLEnumMapEntry aXML_FillStyle_EnumMap[];
48 extern SvXMLEnumMapEntry aXML_RefPoint_EnumMap[];
49 extern SvXMLEnumMapEntry aXML_BitmapMode_EnumMap[];
51 static SvXMLEnumMapEntry const aXML_TextGridMode_ConstantMap[] =
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 }
59 XMLPageMasterPropHdlFactory::XMLPageMasterPropHdlFactory() :
60 XMLPropertyHandlerFactory()
64 XMLPageMasterPropHdlFactory::~XMLPageMasterPropHdlFactory()
68 const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
70 nType &= MID_FLAG_MASK;
72 XMLPropertyHandler* pHdl = const_cast<XMLPropertyHandler*>(XMLPropertyHandlerFactory::GetPropertyHandler( nType ));
73 if( !pHdl )
75 switch( nType )
77 case XML_PM_TYPE_PAGESTYLELAYOUT:
78 pHdl = new XMLPMPropHdl_PageStyleLayout();
79 break;
80 case XML_PM_TYPE_NUMFORMAT:
81 pHdl = new XMLPMPropHdl_NumFormat();
82 break;
83 case XML_PM_TYPE_NUMLETTERSYNC:
84 pHdl = new XMLPMPropHdl_NumLetterSync();
85 break;
86 case XML_PM_TYPE_PAPERTRAYNUMBER:
87 pHdl = new XMLPMPropHdl_PaperTrayNumber();
88 break;
89 case XML_PM_TYPE_PRINTORIENTATION:
90 pHdl = new XMLNamedBoolPropertyHdl(
91 GetXMLToken( XML_LANDSCAPE ),
92 GetXMLToken( XML_PORTRAIT ) );
93 break;
94 case XML_PM_TYPE_PRINTANNOTATIONS:
95 pHdl = new XMLPMPropHdl_Print( XML_ANNOTATIONS );
96 break;
97 case XML_PM_TYPE_PRINTCHARTS:
98 pHdl = new XMLPMPropHdl_Print( XML_CHARTS );
99 break;
100 case XML_PM_TYPE_PRINTDRAWING:
101 pHdl = new XMLPMPropHdl_Print( XML_DRAWINGS );
102 break;
103 case XML_PM_TYPE_PRINTFORMULAS:
104 pHdl = new XMLPMPropHdl_Print( XML_FORMULAS );
105 break;
106 case XML_PM_TYPE_PRINTGRID:
107 pHdl = new XMLPMPropHdl_Print( XML_GRID );
108 break;
109 case XML_PM_TYPE_PRINTHEADERS:
110 pHdl = new XMLPMPropHdl_Print( XML_HEADERS );
111 break;
112 case XML_PM_TYPE_PRINTOBJECTS:
113 pHdl = new XMLPMPropHdl_Print( XML_OBJECTS );
114 break;
115 case XML_PM_TYPE_PRINTZEROVALUES:
116 pHdl = new XMLPMPropHdl_Print( XML_ZERO_VALUES );
117 break;
118 case XML_PM_TYPE_PRINTPAGEORDER:
119 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB ),
120 GetXMLToken( XML_LTR ) );
121 break;
122 case XML_PM_TYPE_FIRSTPAGENUMBER:
123 pHdl = new XMLNumberNonePropHdl( XML_CONTINUE, 2 );
124 break;
125 case XML_PM_TYPE_CENTER_HORIZONTAL:
126 pHdl = new XMLPMPropHdl_CenterHorizontal();
127 break;
128 case XML_PM_TYPE_CENTER_VERTICAL:
129 pHdl = new XMLPMPropHdl_CenterVertical();
130 break;
131 case XML_TYPE_TEXT_COLUMNS:
132 pHdl = new XMLTextColumnsPropertyHandler;
133 break;
134 case XML_TYPE_LAYOUT_GRID_MODE:
135 pHdl = new XMLConstantsPropertyHandler(
136 aXML_TextGridMode_ConstantMap, XML_NONE );
137 break;
139 //UUUU
140 case XML_SW_TYPE_FILLSTYLE:
141 pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap, cppu::UnoType<FillStyle>::get() );
142 break;
143 case XML_SW_TYPE_FILLBITMAPSIZE:
144 pHdl = new XMLFillBitmapSizePropertyHandler();
145 break;
146 case XML_SW_TYPE_LOGICAL_SIZE:
147 pHdl = new XMLBitmapLogicalSizePropertyHandler();
148 break;
149 case XML_SW_TYPE_BITMAP_REFPOINT:
150 pHdl = new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap, cppu::UnoType<RectanglePoint>::get() );
151 break;
152 case XML_SW_TYPE_BITMAP_MODE:
153 pHdl = new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap, cppu::UnoType<BitmapMode>::get() );
154 break;
155 case XML_SW_TYPE_BITMAPREPOFFSETX:
156 case XML_SW_TYPE_BITMAPREPOFFSETY:
157 pHdl = new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX == nType);
158 break;
160 //UUUU
161 default:
163 OSL_ENSURE(false, "XMLPropertyHandler missing (!)");
164 break;
168 if( pHdl )
169 PutHdlCache( nType, pHdl );
171 return pHdl;
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */