LibreOffice Module xmloff (master) 1
xmlimppr.hxx
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#ifndef INCLUDED_XMLOFF_XMLIMPPR_HXX
20#define INCLUDED_XMLOFF_XMLIMPPR_HXX
21
22#include <rtl/ref.hxx>
23#include <sal/config.h>
24#include <xmloff/dllapi.h>
25#include <sal/types.h>
26#include <rtl/ustring.hxx>
27
28#include <vector>
30
31namespace com::sun::star::beans { class XMultiPropertySet; }
32namespace com::sun::star::beans { class XPropertySet; }
33namespace com::sun::star::beans { class XPropertySetInfo; }
34namespace com::sun::star::beans { class XTolerantMultiPropertySet; }
35namespace com::sun::star::beans { struct PropertyValue; }
36namespace com::sun::star::container { class XNameContainer; }
37namespace com::sun::star::uno { class Any; }
38namespace com::sun::star::uno { template <typename > class Reference; }
39namespace com::sun::star::uno { template <typename > class Sequence; }
40namespace com::sun::star::xml::sax { class XAttributeList; }
41namespace com::sun::star::xml::sax { class XFastAttributeList; }
42namespace com::sun::star::drawing { enum class SAL_DLLPUBLIC_RTTI FillStyle; }
43
44struct XMLPropertyState;
46
47
50class SvXMLImport;
51
58{
59 sal_Int16 /*const*/ nContextID;
60 sal_Int32 nIndex;
62};
63
65{
67
68 SvXMLImport& rImport; // access to error handling
69
72
73protected:
74
76 SvXMLImport& GetImport() const { return rImport;}
77
78public:
79
82 SvXMLImport& rImport);
83 virtual ~SvXMLImportPropertyMapper() override;
84
85 // Add an ImportPropertyMapper at the end of the import mapper chain.
86 // The added mapper MUST not be used outside the Mapper chain any longer,
87 // because its PropertyMapper will be replaced.
88 void ChainImportMapper(
90
95 void importXML(
96 ::std::vector< XMLPropertyState >& rProperties,
97 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
98 const SvXMLUnitConverter& rUnitConverter,
99 const SvXMLNamespaceMap& rNamespaceMap,
100 sal_uInt32 nPropType,
101 sal_Int32 nStartIdx, sal_Int32 nEndIdx ) const;
102
104 virtual bool handleSpecialItem(
105 XMLPropertyState& rProperty,
106 ::std::vector< XMLPropertyState >& rProperties,
107 const OUString& rValue,
108 const SvXMLUnitConverter& rUnitConverter,
109 const SvXMLNamespaceMap& rNamespaceMap ) const;
110
112 virtual void finished(
113 ::std::vector< XMLPropertyState >& rProperties,
114 sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
115
116 void CheckSpecialContext(
117 const ::std::vector< XMLPropertyState >& rProperties,
118 const css::uno::Reference< css::beans::XPropertySet >& rPropSet,
119 ContextID_Index_Pair* pSpecialContextIds ) const;
120
121 bool FillPropertySet(
122 const ::std::vector< XMLPropertyState >& rProperties,
123 const css::uno::Reference< css::beans::XPropertySet >& rPropSet,
124 ContextID_Index_Pair* pSpecialContextIds = nullptr ) const;
125
126 void FillPropertySequence(
127 const ::std::vector< XMLPropertyState >& aProperties,
128 css::uno::Sequence< css::beans::PropertyValue >& rValues )
129 const;
130
132 getPropertySetMapper() const;
133
134
137 static bool FillPropertySet_(
138 const ::std::vector<XMLPropertyState> & rProperties,
139 const css::uno::Reference< css::beans::XPropertySet> & rPropSet,
140 const css::uno::Reference< css::beans::XPropertySetInfo> & rPropSetInfo,
141 const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
142 SvXMLImport& rImport,
143
144 // parameter for use by txtstyli.cxx; allows efficient
145 // catching the combined characters property
146 ContextID_Index_Pair* pSpecialContextIds );
147
150 static bool FillMultiPropertySet_(
151 const ::std::vector<XMLPropertyState> & rProperties,
152 const css::uno::Reference< css::beans::XMultiPropertySet> & rMultiPropSet,
153 const css::uno::Reference< css::beans::XPropertySetInfo> & rPropSetInfo,
154 const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
155
156 // parameters for use by txtstyli.cxx; allows efficient
157 // catching the combined characters property
158 ContextID_Index_Pair* pSpecialContextIds );
159
162 static bool FillTolerantMultiPropertySet_(
163 const ::std::vector<XMLPropertyState> & rProperties,
164 const css::uno::Reference< css::beans::XTolerantMultiPropertySet> & rTolPropSet,
165 const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
166 SvXMLImport& rImport,
167
168 // parameters for use by txtstyli.cxx; allows efficient
169 // catching the combined characters property
170 ContextID_Index_Pair* pSpecialContextIds );
171
172
173 static void PrepareForMultiPropertySet_(
174 const ::std::vector<XMLPropertyState> & rProperties,
175 const css::uno::Reference< css::beans::XPropertySetInfo> & rPropSetInfo,
176 const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
177 ContextID_Index_Pair* pSpecialContextIds,
178 css::uno::Sequence< OUString >& rNames,
179 css::uno::Sequence< css::uno::Any >& rValues);
180
181private:
182 void importXMLAttribute(
183 std::vector< XMLPropertyState >& rProperties,
184 const SvXMLUnitConverter& rUnitConverter,
185 const SvXMLNamespaceMap& rNamespaceMap,
186 sal_uInt32 nPropType,
187 sal_Int32 nStartIdx,
188 sal_Int32 nEndIdx,
189 css::uno::Reference< css::container::XNameContainer >& xAttrContainer,
190 const OUString& sAttrName,
191 const OUString& aNamespaceURI,
192 const OUString& sValue) const;
193};
194
195
198{
199 return maPropMapper;
200}
201
202namespace xmloff {
203
205 css::uno::Reference<css::beans::XPropertySet> const& xProps,
206 css::drawing::FillStyle nExpectedFillStyle);
207
208}
209
210#endif // INCLUDED_XMLOFF_XMLIMPPR_HXX
211
212/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvXMLImport & rImport
Definition: xmlimppr.hxx:68
rtl::Reference< SvXMLImportPropertyMapper > mxNextMapper
Definition: xmlimppr.hxx:66
const rtl::Reference< XMLPropertySetMapper > & getPropertySetMapper() const
Definition: xmlimppr.hxx:197
SvXMLImport & GetImport() const
Definition: xmlimppr.hxx:76
rtl::Reference< XMLPropertySetMapper > maPropMapper
Definition: xmlimppr.hxx:75
SvXMLImportPropertyMapper(SvXMLImportPropertyMapper const &)=delete
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:83
void operator=(SimpleReferenceObject) SAL_DELETED_FUNCTION
#define XMLOFF_DLLPUBLIC
Definition: dllapi.h:29
XMLOFF_DLLPUBLIC bool importXML(css::uno::Reference< css::xml::sax::XFastAttributeList > const &xAttrList, css::uno::Any &rValue, OUString &rStrName, SvXMLImport &rImport)
class SAL_NO_VTABLE XPropertySet
enum SAL_DLLPUBLIC_RTTI FillStyle
Definition: xmlimppr.hxx:42
Reference
bool IsIgnoreFillStyleNamedItem(css::uno::Reference< css::beans::XPropertySet > const &xProps, drawing::FillStyle const nExpectedFillStyle)
Definition: ximpstyl.cxx:1583
This struct is used as an optional parameter to the static _FillPropertySet() methods.
Definition: xmlimppr.hxx:58
css::drawing::FillStyle nExpectedFillStyle
Definition: xmlimppr.hxx:61
sal_Int16 nContextID
Definition: xmlimppr.hxx:59
Smart struct to transport an Any with an index to the appropriate property-name.
Definition: maptype.hxx:140