bump product version to 4.1.6.2
[LibreOffice.git] / include / xmloff / xmlexppr.hxx
blob66e83d3df28bc6e19b26550b5da7a3ea4adcbfd8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #ifndef _XMLOFF_XMLEXPPR_HXX
21 #define _XMLOFF_XMLEXPPR_HXX
23 #include "sal/config.h"
24 #include "xmloff/dllapi.h"
25 #include <xmloff/xmlprmap.hxx>
26 #include <xmloff/uniref.hxx>
29 class SvXMLUnitConverter;
30 class SvXMLAttributeList;
31 class SvXMLNamespaceMap;
32 class FilterPropertiesInfos_Impl;
33 class SvXMLExport;
35 #define XML_EXPORT_FLAG_DEFAULTS 0x0001 // export also default items
36 #define XML_EXPORT_FLAG_DEEP 0x0002 // export also items from
37 // parent item sets
38 #define XML_EXPORT_FLAG_EMPTY 0x0004 // export attribs element
39 // even if its empty
40 #define XML_EXPORT_FLAG_IGN_WS 0x0008
42 class XMLOFF_DLLPUBLIC SvXMLExportPropertyMapper : public UniRefBase
44 UniReference< SvXMLExportPropertyMapper> mxNextMapper;
46 FilterPropertiesInfos_Impl *pCache;
48 protected:
49 UniReference< XMLPropertySetMapper > maPropMapper;
51 OUString maStyleName;
53 /** Filter all properties we don't want to export:
54 Take all properties of the XPropertySet which are also found in the
55 XMLPropertyMapEntry-array and which are not set directly (so, the value isn't
56 default and isn't inherited, apart from bDefault is true)
57 After this process It'll called 'Contextfilter' for application-specific
58 filter-processes. */
59 ::std::vector< XMLPropertyState > _Filter(
60 const ::com::sun::star::uno::Reference<
61 ::com::sun::star::beans::XPropertySet > rPropSet,
62 bool bDefault, bool bDisableFoFontFamily) const;
64 /** Application-specific filter. By default do nothing. */
65 virtual void ContextFilter(
66 bool bEnableFoFontFamily,
67 ::std::vector< XMLPropertyState >& rProperties,
68 ::com::sun::star::uno::Reference<
69 ::com::sun::star::beans::XPropertySet > rPropSet ) const;
71 /** fills the given attribute list with the items in the given set */
72 void _exportXML( sal_uInt16 nPropType, sal_uInt16& rPropTypeFlags,
73 SvXMLAttributeList& rAttrList,
74 const ::std::vector< XMLPropertyState >& rProperties,
75 const SvXMLUnitConverter& rUnitConverter,
76 const SvXMLNamespaceMap& rNamespaceMap,
77 sal_uInt16 nFlags,
78 std::vector<sal_uInt16>* pIndexArray,
79 sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx ) const;
81 void _exportXML( SvXMLAttributeList& rAttrList,
82 const XMLPropertyState& rProperty,
83 const SvXMLUnitConverter& rUnitConverter,
84 const SvXMLNamespaceMap& rNamespaceMap,
85 sal_uInt16 nFlags,
86 const ::std::vector< XMLPropertyState > *pProperties = 0,
87 sal_uInt32 nIdx = 0 ) const;
89 void exportElementItems(
90 SvXMLExport& rExport,
91 const ::std::vector< XMLPropertyState >& rProperties,
92 sal_uInt16 nFlags,
93 const std::vector<sal_uInt16>& rIndexArray ) const;
95 public:
97 SvXMLExportPropertyMapper(
98 const UniReference< XMLPropertySetMapper >& rMapper );
99 virtual ~SvXMLExportPropertyMapper();
101 // Add a ExportPropertyMapper at the end of the import mapper chain.
102 // The added mapper MUST not be used outside the Mapper chain any longer,
103 // because its PropertyMapper will be replaced.
104 void ChainExportMapper(
105 const UniReference< SvXMLExportPropertyMapper>& rMapper );
107 /** Filter all properties we don't want to export:
108 Take all properties of the XPropertySet which are also found in the
109 XMLPropertyMapEntry-array and which are not set directly (so, the value isn't
110 default and isn't inherited)
111 After this process It'll called 'Contextfilter' for application-specific
112 filter-processes. */
113 ::std::vector< XMLPropertyState > Filter(
114 const ::com::sun::star::uno::Reference<
115 ::com::sun::star::beans::XPropertySet > rPropSet, bool bEnableFoFontFamily = false) const
116 { return _Filter(rPropSet, false, bEnableFoFontFamily); }
118 /** Like Filter(), except that:
119 * - only properties that have the map flag MID_FLAG_DEFAULT_ITEM_EXPORT
120 * set are exported,
121 * - instead of the property's value, its default value is exported.
123 ::std::vector< XMLPropertyState > FilterDefaults(
124 const ::com::sun::star::uno::Reference<
125 ::com::sun::star::beans::XPropertySet > rPropSet, bool bEnableFoFontFamily = false) const
126 { return _Filter(rPropSet, true, bEnableFoFontFamily); }
128 /** Compare to arrays of XMLPropertyState */
129 sal_Bool Equals( const ::std::vector< XMLPropertyState >& aProperties1,
130 const ::std::vector< XMLPropertyState >& aProperties2 ) const;
132 /** fills the given attribute list with the items in the given set */
133 void exportXML(
134 SvXMLAttributeList& rAttrList,
135 const ::std::vector< XMLPropertyState >& rProperties,
136 const SvXMLUnitConverter& rUnitConverter,
137 const SvXMLNamespaceMap& rNamespaceMap,
138 sal_uInt16 nFlags = 0 ) const;
139 /** like above but only properties whose property map index is within the
140 specified range are exported */
141 void exportXML(
142 SvXMLAttributeList& rAttrList,
143 const ::std::vector< XMLPropertyState >& rProperties,
144 const SvXMLUnitConverter& rUnitConverter,
145 const SvXMLNamespaceMap& rNamespaceMap,
146 sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
147 sal_uInt16 nFlags = 0 ) const;
149 void exportXML(
150 SvXMLExport& rExport,
151 const ::std::vector< XMLPropertyState >& rProperties,
152 sal_uInt16 nFlags = 0 ) const;
154 /** like above but only properties whose property map index is within the
155 specified range are exported */
156 void exportXML(
157 SvXMLExport& rExport,
158 const ::std::vector< XMLPropertyState >& rProperties,
159 sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
160 sal_uInt16 nFlags = 0 ) const;
162 /** this method is called for every item that has the
163 MID_FLAG_ELEMENT_EXPORT flag set */
164 virtual void handleElementItem(
165 SvXMLExport& rExport,
166 const XMLPropertyState& rProperty,
167 sal_uInt16 nFlags,
168 const ::std::vector< XMLPropertyState > *pProperties = 0,
169 sal_uInt32 nIdx = 0 ) const;
171 /** this method is called for every item that has the
172 MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
173 virtual void handleSpecialItem(
174 SvXMLAttributeList& rAttrList,
175 const XMLPropertyState& rProperty,
176 const SvXMLUnitConverter& rUnitConverter,
177 const SvXMLNamespaceMap& rNamespaceMap,
178 const ::std::vector< XMLPropertyState > *pProperties = 0,
179 sal_uInt32 nIdx = 0 ) const;
181 inline const UniReference< XMLPropertySetMapper >&
182 getPropertySetMapper() const { return maPropMapper; }
184 void SetStyleName( const OUString& rStyleName ) { maStyleName = rStyleName; }
187 #endif // _XMLOFF_XMLEXPPR_HXX
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */