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 <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 <com/sun/star/drawing/BitmapMode.hpp>
37 #include <XMLBitmapRepeatOffsetPropertyHandler.hxx>
39 using namespace ::xmloff::token
;
40 using namespace ::com::sun::star
;
41 using namespace ::com::sun::star::drawing
;
43 SvXMLEnumMapEntry
<sal_uInt16
> const aXML_TextGridMode_ConstantMap
[] =
45 { XML_NONE
, text::TextGridMode::NONE
},
46 { XML_LINE
, text::TextGridMode::LINES
},
47 { XML_BOTH
, text::TextGridMode::LINES_AND_CHARS
},
48 { XML_TOKEN_INVALID
, 0 }
51 XMLPageMasterPropHdlFactory::XMLPageMasterPropHdlFactory() :
52 XMLPropertyHandlerFactory()
56 XMLPageMasterPropHdlFactory::~XMLPageMasterPropHdlFactory()
60 const XMLPropertyHandler
* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_Int32 nType
) const
62 nType
&= MID_FLAG_MASK
;
64 XMLPropertyHandler
* pHdl
= const_cast<XMLPropertyHandler
*>(XMLPropertyHandlerFactory::GetPropertyHandler( nType
));
69 case XML_PM_TYPE_PAGESTYLELAYOUT
:
70 pHdl
= new XMLPMPropHdl_PageStyleLayout
;
72 case XML_PM_TYPE_NUMFORMAT
:
73 pHdl
= new XMLPMPropHdl_NumFormat
;
75 case XML_PM_TYPE_NUMLETTERSYNC
:
76 pHdl
= new XMLPMPropHdl_NumLetterSync
;
78 case XML_PM_TYPE_PAPERTRAYNUMBER
:
79 pHdl
= new XMLPMPropHdl_PaperTrayNumber
;
81 case XML_PM_TYPE_PRINTORIENTATION
:
82 pHdl
= new XMLNamedBoolPropertyHdl(
83 GetXMLToken( XML_LANDSCAPE
),
84 GetXMLToken( XML_PORTRAIT
) );
86 case XML_PM_TYPE_PRINTANNOTATIONS
:
87 pHdl
= new XMLPMPropHdl_Print( XML_ANNOTATIONS
);
89 case XML_PM_TYPE_PRINTCHARTS
:
90 pHdl
= new XMLPMPropHdl_Print( XML_CHARTS
);
92 case XML_PM_TYPE_PRINTDRAWING
:
93 pHdl
= new XMLPMPropHdl_Print( XML_DRAWINGS
);
95 case XML_PM_TYPE_PRINTFORMULAS
:
96 pHdl
= new XMLPMPropHdl_Print( XML_FORMULAS
);
98 case XML_PM_TYPE_PRINTGRID
:
99 pHdl
= new XMLPMPropHdl_Print( XML_GRID
);
101 case XML_PM_TYPE_PRINTHEADERS
:
102 pHdl
= new XMLPMPropHdl_Print( XML_HEADERS
);
104 case XML_PM_TYPE_PRINTOBJECTS
:
105 pHdl
= new XMLPMPropHdl_Print( XML_OBJECTS
);
107 case XML_PM_TYPE_PRINTZEROVALUES
:
108 pHdl
= new XMLPMPropHdl_Print( XML_ZERO_VALUES
);
110 case XML_PM_TYPE_PRINTPAGEORDER
:
111 pHdl
= new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB
),
112 GetXMLToken( XML_LTR
) );
114 case XML_PM_TYPE_FIRSTPAGENUMBER
:
115 pHdl
= new XMLNumberNonePropHdl( XML_CONTINUE
, 2 );
117 case XML_PM_TYPE_CENTER_HORIZONTAL
:
118 pHdl
= new XMLPMPropHdl_CenterHorizontal
;
120 case XML_PM_TYPE_CENTER_VERTICAL
:
121 pHdl
= new XMLPMPropHdl_CenterVertical
;
123 case XML_TYPE_TEXT_COLUMNS
:
124 pHdl
= new XMLTextColumnsPropertyHandler
;
126 case XML_TYPE_LAYOUT_GRID_MODE
:
127 pHdl
= new XMLConstantsPropertyHandler(
128 aXML_TextGridMode_ConstantMap
, XML_NONE
);
131 case XML_SW_TYPE_FILLSTYLE
:
132 pHdl
= new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap
);
134 case XML_SW_TYPE_PRESPAGE_BACKSIZE
:
135 pHdl
= new XMLNamedBoolPropertyHdl(GetXMLToken(XML_FULL
), GetXMLToken(XML_BORDER
));
137 case XML_SW_TYPE_FILLBITMAPSIZE
:
138 pHdl
= new XMLFillBitmapSizePropertyHandler();
140 case XML_SW_TYPE_LOGICAL_SIZE
:
141 pHdl
= new XMLBitmapLogicalSizePropertyHandler();
143 case XML_SW_TYPE_BITMAP_REFPOINT
:
144 pHdl
= new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap
);
146 case XML_SW_TYPE_BITMAP_MODE
:
147 pHdl
= new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap
);
149 case XML_SW_TYPE_BITMAPREPOFFSETX
:
150 case XML_SW_TYPE_BITMAPREPOFFSETY
:
151 pHdl
= new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX
== nType
);
156 OSL_ENSURE(false, "XMLPropertyHandler missing (!)");
162 PutHdlCache( nType
, pHdl
);
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */