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 <XMLBitmapRepeatOffsetPropertyHandler.hxx>
37 #include <XMLRtlGutterPropertyHandler.hxx>
39 using namespace ::xmloff::token
;
40 using namespace ::com::sun::star
;
42 SvXMLEnumMapEntry
<sal_uInt16
> const aXML_TextGridMode_ConstantMap
[] =
44 { XML_NONE
, text::TextGridMode::NONE
},
45 { XML_LINE
, text::TextGridMode::LINES
},
46 { XML_BOTH
, text::TextGridMode::LINES_AND_CHARS
},
47 { XML_TOKEN_INVALID
, 0 }
50 XMLPageMasterPropHdlFactory::XMLPageMasterPropHdlFactory()
54 XMLPageMasterPropHdlFactory::~XMLPageMasterPropHdlFactory()
58 const XMLPropertyHandler
* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_Int32 nType
) const
60 nType
&= MID_FLAG_MASK
;
62 XMLPropertyHandler
* pHdl
= const_cast<XMLPropertyHandler
*>(XMLPropertyHandlerFactory::GetPropertyHandler( nType
));
67 case XML_PM_TYPE_PAGESTYLELAYOUT
:
68 pHdl
= new XMLPMPropHdl_PageStyleLayout
;
70 case XML_PM_TYPE_NUMFORMAT
:
71 pHdl
= new XMLPMPropHdl_NumFormat
;
73 case XML_PM_TYPE_NUMLETTERSYNC
:
74 pHdl
= new XMLPMPropHdl_NumLetterSync
;
76 case XML_PM_TYPE_PAPERTRAYNUMBER
:
77 pHdl
= new XMLPMPropHdl_PaperTrayNumber
;
79 case XML_PM_TYPE_PRINTORIENTATION
:
80 pHdl
= new XMLNamedBoolPropertyHdl(
81 GetXMLToken( XML_LANDSCAPE
),
82 GetXMLToken( XML_PORTRAIT
) );
84 case XML_PM_TYPE_PRINTANNOTATIONS
:
85 pHdl
= new XMLPMPropHdl_Print( XML_ANNOTATIONS
);
87 case XML_PM_TYPE_PRINTCHARTS
:
88 pHdl
= new XMLPMPropHdl_Print( XML_CHARTS
);
90 case XML_PM_TYPE_PRINTDRAWING
:
91 pHdl
= new XMLPMPropHdl_Print( XML_DRAWINGS
);
93 case XML_PM_TYPE_PRINTFORMULAS
:
94 pHdl
= new XMLPMPropHdl_Print( XML_FORMULAS
);
96 case XML_PM_TYPE_PRINTGRID
:
97 pHdl
= new XMLPMPropHdl_Print( XML_GRID
);
99 case XML_PM_TYPE_PRINTHEADERS
:
100 pHdl
= new XMLPMPropHdl_Print( XML_HEADERS
);
102 case XML_PM_TYPE_PRINTOBJECTS
:
103 pHdl
= new XMLPMPropHdl_Print( XML_OBJECTS
);
105 case XML_PM_TYPE_PRINTZEROVALUES
:
106 pHdl
= new XMLPMPropHdl_Print( XML_ZERO_VALUES
);
108 case XML_PM_TYPE_PRINTPAGEORDER
:
109 pHdl
= new XMLNamedBoolPropertyHdl( GetXMLToken( XML_TTB
),
110 GetXMLToken( XML_LTR
) );
112 case XML_PM_TYPE_FIRSTPAGENUMBER
:
113 pHdl
= new XMLNumberNonePropHdl( XML_CONTINUE
, 2 );
115 case XML_PM_TYPE_CENTER_HORIZONTAL
:
116 pHdl
= new XMLPMPropHdl_CenterHorizontal
;
118 case XML_PM_TYPE_CENTER_VERTICAL
:
119 pHdl
= new XMLPMPropHdl_CenterVertical
;
121 case XML_TYPE_TEXT_COLUMNS
:
122 pHdl
= new XMLTextColumnsPropertyHandler
;
124 case XML_TYPE_LAYOUT_GRID_MODE
:
125 pHdl
= new XMLConstantsPropertyHandler(
126 aXML_TextGridMode_ConstantMap
, XML_NONE
);
129 case XML_SW_TYPE_FILLSTYLE
:
130 pHdl
= new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap
);
132 case XML_SW_TYPE_PRESPAGE_BACKSIZE
:
133 pHdl
= new XMLNamedBoolPropertyHdl(GetXMLToken(XML_FULL
), GetXMLToken(XML_BORDER
));
135 case XML_SW_TYPE_FILLBITMAPSIZE
:
136 pHdl
= new XMLFillBitmapSizePropertyHandler();
138 case XML_SW_TYPE_LOGICAL_SIZE
:
139 pHdl
= new XMLBitmapLogicalSizePropertyHandler();
141 case XML_SW_TYPE_BITMAP_REFPOINT
:
142 pHdl
= new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap
);
144 case XML_SW_TYPE_BITMAP_MODE
:
145 pHdl
= new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap
);
147 case XML_SW_TYPE_BITMAPREPOFFSETX
:
148 case XML_SW_TYPE_BITMAPREPOFFSETY
:
149 pHdl
= new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX
== nType
);
151 case XML_SW_TYPE_RTLGUTTER
:
152 pHdl
= new XMLRtlGutterPropertyHandler();
157 OSL_ENSURE(false, "XMLPropertyHandler missing (!)");
163 PutHdlCache( nType
, pHdl
);
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */