1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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
;
44 using namespace ::com::sun::star::drawing
;
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
));
77 case XML_PM_TYPE_PAGESTYLELAYOUT
:
78 pHdl
= new XMLPMPropHdl_PageStyleLayout();
80 case XML_PM_TYPE_NUMFORMAT
:
81 pHdl
= new XMLPMPropHdl_NumFormat();
83 case XML_PM_TYPE_NUMLETTERSYNC
:
84 pHdl
= new XMLPMPropHdl_NumLetterSync();
86 case XML_PM_TYPE_PAPERTRAYNUMBER
:
87 pHdl
= new XMLPMPropHdl_PaperTrayNumber();
89 case XML_PM_TYPE_PRINTORIENTATION
:
90 pHdl
= new XMLNamedBoolPropertyHdl(
91 GetXMLToken( XML_LANDSCAPE
),
92 GetXMLToken( XML_PORTRAIT
) );
94 case XML_PM_TYPE_PRINTANNOTATIONS
:
95 pHdl
= new XMLPMPropHdl_Print( XML_ANNOTATIONS
);
97 case XML_PM_TYPE_PRINTCHARTS
:
98 pHdl
= new XMLPMPropHdl_Print( XML_CHARTS
);
100 case XML_PM_TYPE_PRINTDRAWING
:
101 pHdl
= new XMLPMPropHdl_Print( XML_DRAWINGS
);
103 case XML_PM_TYPE_PRINTFORMULAS
:
104 pHdl
= new XMLPMPropHdl_Print( XML_FORMULAS
);
106 case XML_PM_TYPE_PRINTGRID
:
107 pHdl
= new XMLPMPropHdl_Print( XML_GRID
);
109 case XML_PM_TYPE_PRINTHEADERS
:
110 pHdl
= new XMLPMPropHdl_Print( XML_HEADERS
);
112 case XML_PM_TYPE_PRINTOBJECTS
:
113 pHdl
= new XMLPMPropHdl_Print( XML_OBJECTS
);
115 case XML_PM_TYPE_PRINTZEROVALUES
:
116 pHdl
= new XMLPMPropHdl_Print( XML_ZERO_VALUES
);
118 case XML_PM_TYPE_PRINTPAGEORDER
:
119 pHdl
= new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB
),
120 GetXMLToken( XML_LTR
) );
122 case XML_PM_TYPE_FIRSTPAGENUMBER
:
123 pHdl
= new XMLNumberNonePropHdl( XML_CONTINUE
, 2 );
125 case XML_PM_TYPE_CENTER_HORIZONTAL
:
126 pHdl
= new XMLPMPropHdl_CenterHorizontal();
128 case XML_PM_TYPE_CENTER_VERTICAL
:
129 pHdl
= new XMLPMPropHdl_CenterVertical();
131 case XML_TYPE_TEXT_COLUMNS
:
132 pHdl
= new XMLTextColumnsPropertyHandler
;
134 case XML_TYPE_LAYOUT_GRID_MODE
:
135 pHdl
= new XMLConstantsPropertyHandler(
136 aXML_TextGridMode_ConstantMap
, XML_NONE
);
140 case XML_SW_TYPE_FILLSTYLE
:
141 pHdl
= new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap
, cppu::UnoType
<FillStyle
>::get() );
143 case XML_SW_TYPE_FILLBITMAPSIZE
:
144 pHdl
= new XMLFillBitmapSizePropertyHandler();
146 case XML_SW_TYPE_LOGICAL_SIZE
:
147 pHdl
= new XMLBitmapLogicalSizePropertyHandler();
149 case XML_SW_TYPE_BITMAP_REFPOINT
:
150 pHdl
= new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap
, cppu::UnoType
<RectanglePoint
>::get() );
152 case XML_SW_TYPE_BITMAP_MODE
:
153 pHdl
= new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap
, cppu::UnoType
<BitmapMode
>::get() );
155 case XML_SW_TYPE_BITMAPREPOFFSETX
:
156 case XML_SW_TYPE_BITMAPREPOFFSETY
:
157 pHdl
= new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX
== nType
);
163 OSL_ENSURE(false, "XMLPropertyHandler missing (!)");
169 PutHdlCache( nType
, pHdl
);
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */