LibreOffice Module xmloff (master)  1
PageMasterStyleMap.cxx
Go to the documentation of this file.
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 <PageMasterStyleMap.hxx>
21 #include <xmloff/xmlnamespace.hxx>
22 #include <xmloff/xmltoken.hxx>
23 
24 using namespace ::xmloff::token;
25 
26 #define MAP(name,prefix,token,type,context,version) { name, sizeof(name)-1, prefix, token, type, context, version, false }
27 #define DPMAP(name,prefix,token,type,context) MAP(name, prefix, token, type|XML_TYPE_PROP_DRAWING_PAGE, context, SvtSaveOptions::ODFSVER_013)
28 #define PLMAP(name,prefix,token,type,context) \
29  MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_010)
30 #define PLMAP_12(name,prefix,token,type,context) \
31  MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_012)
32 #define PLMAP_ODF13(name,prefix,token,type,context) \
33  MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_013)
34 #define HFMAP(name,prefix,token,type,context) \
35  MAP(name, prefix, token, type|XML_TYPE_PROP_HEADER_FOOTER, context, SvtSaveOptions::ODFSVER_010)
36 
38 {
40  // Section for 'page-layout-properties'
41 
42  // page master
88  // ODF 1.3 OFFICE-3857
96  PLMAP( "RegisterModeActive", XML_NAMESPACE_STYLE, XML_REGISTER_TRUE, XML_TYPE_BOOL, 0 ),
99 
100  // Index 53: Grid definitions
109 
110  //text grid enhancement for better CJK support
113  //export as a default attribute
115 
117 
118  //Index 65: fill attributes; use PLMAP macro here instead of GMAP, this list is ordered and its order is used
119  // to decide in which section in ODF to export the contained stuff (the PageMasterStyle creates several XML
120  // sections, for Page, Header and Footer). The needed order seems to rely not on filtering, but using sections
121  // based on the order used in this list.
122  // Also need own defines for the used context flags (e.g. CTF_PM_FILLGRADIENTNAME instead of
123  // CTF_FILLGRADIENTNAME) since these are used to *filter* up to which entry the attributes belong to the
124  // 'page-layout-properties' section (!), see SvXMLAutoStylePoolP_Impl::exportXML, look for XmlStyleFamily::PAGE_MASTER
125  // note: these are duplicated below, in g_XMLPageMasterDrawingPageStyleMap
130  PLMAP( "FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, 0 ),
134  PLMAP( "FillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too
141  PLMAP( "FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ),
142  PLMAP( "FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ),
146 
147  // Index 85: footnote
156 
158  //Index 92: Section for 'header-style' own section, all members *have* to use CTF_PM_HEADERFLAG in the context entry (the 5th one)
188 
189  //Index 121: Header DrawingLayer FillAttributes
190  // Use HFMAP to get XML_TYPE_PROP_HEADER_FOOTER ORed to the 4th entry
191  // Names have to begin with 'Header', all 5th entries need to be ORed with the CTF_PM_HEADERFLAG
200  HFMAP( "HeaderFillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERFLAG ), // exists in SW, too
212 
214  //Index 141: Section for 'footer-style' own section, all members *have* to use CTF_PM_FOOTERFLAG in the context entry (the 5th one)
244 
245  //Index 170: Footer DrawingLayer FillAttributes
246  // Use HFMAP to get XML_TYPE_PROP_HEADER_FOOTER ORed to the 4th entry
247  // Names have to begin with 'Footer', all 5th entries need to be ORed with the CTF_PM_FOOTERFLAG
256  HFMAP( "FooterFillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERFLAG ), // exists in SW, too
268 
269  { nullptr, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFSVER_010, false } // index 190
270 };
271 
273 {
274  // ODF 1.3 OFFICE-3937 style of family "drawing-page" referenced from style:master-page
275  // duplication of relevant part of aXMLPageMasterStyleMap but as DP type
277  // this does not exist yet!
282  DPMAP("FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, 0),
286  DPMAP("FillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0), /* exists in SW, too */
293  DPMAP("FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0),
294  DPMAP("FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0),
298 
299  { nullptr, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFSVER_010, false }
300 };
301 
302 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define XML_PM_TYPE_PRINTFORMULAS
#define CTF_PM_HEADERBORDERRIGHT
#define CTF_PM_HEADERGRAPHICPOSITION
#define CTF_PM_HEADERHEIGHT
#define XML_TYPE_BORDER
Definition: xmltypes.hxx:190
#define XML_TYPE_PERCENT
Definition: xmltypes.hxx:129
#define HFMAP(name, prefix, token, type, context)
#define XML_SW_TYPE_FILLBITMAPSIZE
Definition: xmltypes.hxx:285
#define CTF_PM_HEADERPADDINGTOP
#define CTF_PM_HEADERFILLTRANSNAME
const XMLPropertyMapEntry aXMLPageMasterStyleMap[]
#define CTF_PM_FOOTERBORDERRIGHT
#define CTF_PM_FOOTERDYNAMIC
#define CTF_PM_FILLGRADIENTNAME
#define CTF_PM_HEADERPADDINGALL
#define XML_TYPE_TEXT_SHADOW
Definition: xmltypes.hxx:177
#define CTF_PM_HEADERFILLHATCHNAME
#define XML_PM_TYPE_CENTER_HORIZONTAL
#define XML_TYPE_BUILDIN_CMP_ONLY
Definition: xmltypes.hxx:142
#define XML_TYPE_NEG_PERCENT16
Definition: xmltypes.hxx:153
#define CTF_PM_PADDINGTOP
#define XML_TYPE_BORDER_WIDTH
Definition: xmltypes.hxx:191
#define XML_SW_TYPE_BITMAP_REFPOINT
Definition: xmltypes.hxx:287
#define CTF_PM_FOOTERREPEAT_OFFSET_Y
#define CTF_PM_HEADERFILLBITMAPNAME
#define CTF_PM_HEADERPADDINGLEFT
#define CTF_PM_HEADERBORDERWIDTHLEFT
#define CTF_PM_BACKGROUNDSIZE
#define CTF_PM_FTN_LINE_ADJUST
#define MID_FLAG_NO_PROPERTY_IMPORT
Definition: xmltypes.hxx:76
#define XML_TYPE_PERCENT16
Definition: xmltypes.hxx:131
#define CTF_PM_FTN_LINE_WEIGHT
#define CTF_PM_FTN_LINE_COLOR
#define CTF_PM_FOOTERMARGINLEFT
#define CTF_PM_PRINT_DRAWING
#define CTF_PM_HEADERGRAPHICURL
#define CTF_PM_FTN_LINE_WIDTH
#define CTF_PM_HEADERPADDINGBOTTOM
#define CTF_PM_PADDINGRIGHT
#define XML_SW_TYPE_BITMAPREPOFFSETX
Definition: xmltypes.hxx:289
#define CTF_PM_FILLBITMAPMODE
#define CTF_PM_FOOTERBORDERWIDTHLEFT
#define XML_SW_TYPE_LOGICAL_SIZE
Definition: xmltypes.hxx:286
#define XML_SW_TYPE_FILLSTYLE
Definition: xmltypes.hxx:284
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
#define CTF_PM_FOOTERMARGINALL
#define CTF_PM_HEADERMARGINLEFT
#define DPMAP(name, prefix, token, type, context)
#define CTF_PM_BORDERLEFT
#define CTF_PM_FOOTERGRAPHICURL
#define CTF_PM_MARGINRIGHT
#define CTF_PM_GRAPHICFILTER
#define CTF_PM_PADDINGBOTTOM
#define XML_PM_TYPE_PRINTORIENTATION
#define CTF_PM_FTN_HEIGHT
#define PLMAP_ODF13(name, prefix, token, type, context)
#define MID_FLAG_MERGE_ATTRIBUTE
Definition: xmltypes.hxx:57
#define XML_TYPE_STYLENAME
Definition: xmltypes.hxx:150
#define CTF_PM_HEADERMINHEIGHT
#define XML_TYPE_PERCENT8
Definition: xmltypes.hxx:130
#define CTF_PM_MARGINALL
#define PLMAP_12(name, prefix, token, type, context)
#define CTF_PM_GRAPHICURL
#define XML_TYPE_MEASURE16
Definition: xmltypes.hxx:128
#define CTF_PM_HEADERPADDINGRIGHT
#define CTF_PM_FOOTERPADDINGRIGHT
#define CTF_PM_FOOTERGRAPHICPOSITION
#define CTF_PM_SCALETO
#define CTF_PM_FOOTERPADDINGBOTTOM
#define XML_PM_TYPE_PRINTZEROVALUES
#define XML_SW_TYPE_BITMAPREPOFFSETY
Definition: xmltypes.hxx:290
#define CTF_PM_HEADERBORDERLEFT
#define CTF_PM_BORDERTOP
#define CTF_PM_HEADERBORDERALL
#define CTF_PM_FOOTERFILLBITMAPNAME
#define MID_FLAG_MULTI_PROPERTY
Definition: xmltypes.hxx:64
#define CTF_PM_HEADERBORDERBOTTOM
#define CTF_PM_BORDERWIDTHLEFT
#define CTF_PM_FOOTERFILLGRADIENTNAME
#define XML_PM_TYPE_PRINTOBJECTS
#define CTF_PM_FOOTERBORDERWIDTHTOP
constexpr sal_uInt16 XML_NAMESPACE_DRAW
#define MID_FLAG_ELEMENT_ITEM
Definition: xmltypes.hxx:70
#define CTF_PM_PRINT_GRID
#define CTF_PM_PRINT_HEADERS
#define CTF_PM_SCALETOX
#define CTF_PM_FILLBITMAPNAME
#define CTF_PM_HEADERREPEAT_OFFSET_Y
#define CTF_PM_MARGINTOP
#define XML_PM_TYPE_NUMLETTERSYNC
#define CTF_PM_BORDERWIDTHTOP
#define CTF_PM_HEADERBORDERWIDTHTOP
#define CTF_PM_PRINT_ZEROVALUES
#define CTF_PM_FOOTERREPEAT_OFFSET_X
constexpr sal_uInt16 XML_NAMESPACE_SVG
#define CTF_PM_HEADERBORDERWIDTHRIGHT
#define XML_PM_TYPE_PRINTCHARTS
#define XML_PM_TYPE_PAGESTYLELAYOUT
#define CTF_PM_PAGEUSAGE
constexpr sal_uInt16 XML_NAMESPACE_FO
constexpr sal_uInt16 XML_NAMESPACE_TEXT
#define CTF_PM_HEADERMARGINALL
#define CTF_PM_FOOTERMARGINTOP
#define CTF_PM_HEADERFILLGRADIENTNAME
#define XML_TYPE_ATTRIBUTE_CONTAINER
Definition: xmltypes.hxx:218
#define CTF_PM_BORDERWIDTHRIGHT
#define MID_FLAG_NO_PROPERTY
Definition: xmltypes.hxx:78
#define XML_PM_TYPE_PRINTANNOTATIONS
#define CTF_PM_FOOTERBORDERWIDTHALL
Represents a property with its API-name, its XML-name and the type of its value.
Definition: maptype.hxx:31
#define CTF_PM_FTN_LINE_STYLE
#define CTF_PM_FTN_DISTANCE
#define CTF_PM_HEADERBORDERWIDTHBOTTOM
#define CTF_PM_FOOTERBORDERTOP
#define XML_PM_TYPE_CENTER_VERTICAL
#define XML_PM_TYPE_FIRSTPAGENUMBER
#define MID_FLAG_SPECIAL_ITEM
Definition: xmltypes.hxx:87
#define CTF_PM_FOOTERBORDERLEFT
#define CTF_PM_BORDERWIDTHBOTTOM
#define XML_SW_TYPE_BITMAP_MODE
Definition: xmltypes.hxx:288
#define CTF_PM_FOOTERPADDINGALL
#define MID_FLAG_DEFAULT_ITEM_EXPORT
Definition: xmltypes.hxx:48
#define CTF_PM_FOOTERGRAPHICFILTER
#define CTF_PM_REPEAT_OFFSET_X
#define CTF_PM_PRINT_CHARTS
#define XML_TYPE_NUMBER16
Definition: xmltypes.hxx:136
XMLPropertyMapEntry const g_XMLPageMasterDrawingPageStyleMap[]
#define XML_TYPE_LAYOUT_GRID_MODE
Definition: xmltypes.hxx:251
#define CTF_PM_REGISTER_STYLE
#define XML_TYPE_TEXT_HORIZONTAL_ADJUST
Definition: xmltypes.hxx:239
#define CTF_PM_PRINT_OBJECTS
#define CTF_PM_HEADERBORDERTOP
#define CTF_PM_HEADERFLAG
#define XML_TYPE_TEXT_WRITING_MODE
Definition: xmltypes.hxx:249
#define MID_FLAG_MERGE_PROPERTY
Definition: xmltypes.hxx:61
#define CTF_PM_FILLHATCHNAME
#define CTF_PM_FOOTERFILLTRANSNAME
#define CTF_PM_MARGINBOTTOM
#define CTF_PM_FOOTERFILLHATCHNAME
#define XML_TYPE_ISTRANSPARENT
Definition: xmltypes.hxx:141
#define XML_TYPE_STRING
Definition: xmltypes.hxx:132
#define MID_FLAG_PROPERTY_MAY_THROW
Definition: xmltypes.hxx:44
#define CTF_PM_GRAPHICPOSITION
#define CTF_PM_HEADERMARGINBOTTOM
#define PLMAP(name, prefix, token, type, context)
#define CTF_PM_HEADERDYNAMIC
#define CTF_PM_BORDERWIDTHALL
#define CTF_PM_FOOTERMINHEIGHT
#define CTF_PM_FTN_LINE_DISTANCE
#define XML_SW_TYPE_PRESPAGE_BACKSIZE
Definition: xmltypes.hxx:294
Handling of tokens in XML:
#define CTF_PM_SCALETOPAGES
#define CTF_PM_FOOTERMARGINRIGHT
#define XML_TYPE_MEASURE
Definition: xmltypes.hxx:126
#define CTP_PM_GRID_BASE_WIDTH
#define XML_TYPE_TEXT_COLUMNS
Definition: xmltypes.hxx:203
#define XML_PM_TYPE_PRINTGRID
#define CTF_PM_PRINT_ANNOTATIONS
#define CTF_PM_FOOTERBORDERWIDTHRIGHT
#define CTF_PM_FOOTERBORDERWIDTHBOTTOM
#define XML_TYPE_COLORTRANSPARENT
Definition: xmltypes.hxx:140
#define XML_PM_TYPE_PRINTHEADERS
#define CTF_PM_FOOTERHEIGHT
#define CTF_PM_PADDINGALL
#define XML_PM_TYPE_NUMFORMAT
#define CTF_PM_STANDARD_MODE
#define CTF_PM_PADDINGLEFT
#define XML_TYPE_BOOL
Definition: xmltypes.hxx:125
#define CTF_PM_FOOTERPADDINGTOP
#define CTF_PM_HEADERMARGINRIGHT
#define XML_PM_TYPE_PRINTDRAWING
#define CTP_PM_GRID_SNAP_TO
#define CTF_PM_FOOTERFLAG
#define CTF_PM_HEADERGRAPHICFILTER
#define CTF_PM_FILLTRANSNAME
#define CTF_PM_FOOTERBORDERALL
#define CTF_PM_SCALETOY
#define CTF_PM_BORDERBOTTOM
#define CTF_PM_BORDERALL
#define CTF_PM_FOOTERBORDERBOTTOM
#define CTF_PM_HEADERBORDERWIDTHALL
#define CTF_PM_FOOTERPADDINGLEFT
#define CTF_PM_FILL
#define MID_FLAG_SPECIAL_ITEM_IMPORT
Definition: xmltypes.hxx:82
#define CTF_PM_MARGINLEFT
#define CTF_PM_TEXTCOLUMNS
#define XML_PM_TYPE_PRINTPAGEORDER
constexpr sal_uInt16 XML_NAMESPACE_STYLE
#define CTF_PM_REPEAT_OFFSET_Y
#define XML_TYPE_COLOR
Definition: xmltypes.hxx:133
#define CTF_PM_PRINT_FORMULAS
#define CTF_PM_HEADERREPEAT_OFFSET_X
#define CTF_PM_BORDERRIGHT