LibreOffice Module xmloff (master)  1
controlpropertymap.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 <rtl/ref.hxx>
21 #include <xmloff/xmlnamespace.hxx>
22 #include <xmloff/xmltoken.hxx>
23 #include <xmloff/maptype.hxx>
24 #include <xmloff/xmltypes.hxx>
25 #include <algorithm>
26 #include "strings.hxx"
27 #include <xmloff/contextid.hxx>
28 #include "controlpropertymap.hxx"
29 
30 #include <string.h>
31 
32 using namespace ::xmloff::token;
33 
34 namespace xmloff
35 {
36 
37 #define MAP_ASCII( name, prefix, token, type, context ) { name, sizeof(name)-1, prefix, token, type|XML_TYPE_PROP_TEXT, context, SvtSaveOptions::ODFSVER_010, false }
38 #define MAP_CONST( name, prefix, token, type, context ) { name, sizeof(name)-1, prefix, token, type|XML_TYPE_PROP_TEXT, context, SvtSaveOptions::ODFSVER_010, false }
39 #define MAP_CONST_P( name, prefix, token, type, context ){ name, sizeof(name)-1, prefix, token, type|XML_TYPE_PROP_PARAGRAPH, context, SvtSaveOptions::ODFSVER_010, false }
40 #define MAP_END() { nullptr, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFSVER_010, false }
41 
43  {
59 
64 
71  MAP_ASCII( "FontWordLineMode", XML_NAMESPACE_FO, XML_SCORE_SPACES, XML_TYPE_NBOOL, 0 ),
72 
74 
78  MAP_END()
79  };
80 
82  {
84  }
85 
87  {
88  static bool bSorted = false;
89  if (!bSorted)
90  {
91  XMLPropertyMapEntry const * pEnd;
92  // determine the last element
93  for ( pEnd = aControlStyleProperties; pEnd->msApiName; ++pEnd)
94  ;
95  assert( ::std::is_sorted(aControlStyleProperties, pEnd,
96  [&](const XMLPropertyMapEntry& _rLeft, const XMLPropertyMapEntry& _rRight)
97  { return strcmp(_rLeft.msApiName, _rRight.msApiName) < 0; }) );
98  bSorted = true;
99  }
100  }
101 
102  //= OFormComponentStyleExportMapper
104  :SvXMLExportPropertyMapper( _rMapper )
105  {
106  }
107 
109  const SvXMLNamespaceMap& _rNamespaceMap, const ::std::vector< XMLPropertyState >* _pProperties,
110  sal_uInt32 _nIdx ) const
111  {
112  // ignore the number style of grid columns - this is formatted elsewhere
113  if ( CTF_FORMS_DATA_STYLE != getPropertySetMapper()->GetEntryContextId( _rProperty.mnIndex ) )
114  SvXMLExportPropertyMapper::handleSpecialItem( _rAttrList, _rProperty, _rUnitConverter, _rNamespaceMap, _pProperties, _nIdx );
115  }
116 
117 } // namespace xmloff
118 
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define XML_TYPE_TEXT_UNDERLINE_STYLE
Definition: xmltypes.hxx:172
OFormComponentStyleExportMapper(const rtl::Reference< XMLPropertySetMapper > &_rMapper)
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:77
#define XML_TYPE_CONTROL_BORDER_COLOR
Definition: xmltypes.hxx:253
#define XML_TYPE_TEXT_UNDERLINE_COLOR
Definition: xmltypes.hxx:223
#define XML_TYPE_TEXT_UNDERLINE_TYPE
Definition: xmltypes.hxx:256
#define XML_TYPE_TEXT_POSTURE
Definition: xmltypes.hxx:170
#define CTF_FORMS_DATA_STYLE
Definition: contextid.hxx:39
sal_Int32 mnIndex
Definition: maptype.hxx:124
#define XML_TYPE_TEXT_UNDERLINE_WIDTH
Definition: xmltypes.hxx:257
#define XML_TYPE_TEXT_CROSSEDOUT_TYPE
Definition: xmltypes.hxx:258
virtual void handleSpecialItem(SvXMLAttributeList &rAttrList, const XMLPropertyState &rProperty, const SvXMLUnitConverter &rUnitConverter, const SvXMLNamespaceMap &rNamespaceMap, const ::std::vector< XMLPropertyState > *pProperties, sal_uInt32 nIdx) const
this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set ...
Definition: xmlexppr.cxx:854
#define MID_FLAG_MERGE_ATTRIBUTE
Definition: xmltypes.hxx:57
#define XML_TYPE_TEXT_ALIGN
Definition: xmltypes.hxx:229
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
#define MID_FLAG_MULTI_PROPERTY
Definition: xmltypes.hxx:64
#define XML_TYPE_CHAR_HEIGHT
Definition: xmltypes.hxx:183
constexpr sal_uInt16 XML_NAMESPACE_FO
#define MAP_CONST(name, prefix, token, type, context)
#define XML_TYPE_CONTROL_TEXT_EMPHASIZE
Definition: xmltypes.hxx:246
const char * msApiName
Definition: maptype.hxx:33
#define MID_FLAG_NO_PROPERTY_EXPORT
Definition: xmltypes.hxx:73
Represents a property with its API-name, its XML-name and the type of its value.
Definition: maptype.hxx:31
#define PROPERTY_ALIGN
Definition: strings.hxx:107
#define XML_TYPE_ROTATION_ANGLE
Definition: xmltypes.hxx:231
#define MAP_CONST_P(name, prefix, token, type, context)
#define MID_FLAG_SPECIAL_ITEM
Definition: xmltypes.hxx:87
#define XML_TYPE_TEXT_FONTFAMILY
Definition: xmltypes.hxx:166
#define XML_TYPE_NUMBER16
Definition: xmltypes.hxx:136
#define XML_TYPE_TEXT_FONTPITCH
Definition: xmltypes.hxx:168
#define MID_FLAG_MERGE_PROPERTY
Definition: xmltypes.hxx:61
const XMLPropertyMapEntry * getControlStylePropertyMap()
#define XML_TYPE_TEXT_FONT_RELIEF
Definition: xmltypes.hxx:241
#define XML_TYPE_CONTROL_BORDER
Definition: xmltypes.hxx:232
#define XML_TYPE_STRING
Definition: xmltypes.hxx:132
#define XML_TYPE_TEXT_FONTENCODING
Definition: xmltypes.hxx:167
#define XML_TYPE_NBOOL
Definition: xmltypes.hxx:139
#define MAP_END()
Handling of tokens in XML:
void handleSpecialItem(SvXMLAttributeList &_rAttrList, const XMLPropertyState &_rProperty, const SvXMLUnitConverter &_rUnitConverter, const SvXMLNamespaceMap &_rNamespaceMap, const ::std::vector< XMLPropertyState > *_pProperties, sal_uInt32 _nIdx) const override
this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set ...
#define MAP_ASCII(name, prefix, token, type, context)
Smart struct to transport an Any with an index to the appropriate property-name.
Definition: maptype.hxx:122
#define XML_TYPE_TEXT_CROSSEDOUT_TEXT
Definition: xmltypes.hxx:260
#define XML_TYPE_TEXT_CROSSEDOUT_STYLE
Definition: xmltypes.hxx:163
#define XML_TYPE_TEXT_WEIGHT
Definition: xmltypes.hxx:173
#define XML_TYPE_BOOL
Definition: xmltypes.hxx:125
#define XML_TYPE_TEXT_CROSSEDOUT_WIDTH
Definition: xmltypes.hxx:259
#define PROPERTY_FORMATKEY
Definition: strings.hxx:106
void initializePropertyMaps()
XMLPropertyMapEntry const aControlStyleProperties[]
#define PROPERTY_BORDER
Definition: strings.hxx:108
#define XML_TYPE_FONT_WIDTH
Definition: xmltypes.hxx:230
constexpr sal_uInt16 XML_NAMESPACE_STYLE
#define XML_TYPE_COLOR
Definition: xmltypes.hxx:133
const rtl::Reference< XMLPropertySetMapper > & getPropertySetMapper() const
Definition: xmlexppr.cxx:1119
#define PROPERTY_BACKGROUNDCOLOR
Definition: strings.hxx:102