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 
31 namespace com::sun::star::beans { class XMultiPropertySet; }
32 namespace com::sun::star::beans { class XPropertySet; }
33 namespace com::sun::star::beans { class XPropertySetInfo; }
34 namespace com::sun::star::beans { class XTolerantMultiPropertySet; }
35 namespace com::sun::star::beans { struct PropertyValue; }
36 namespace com::sun::star::container { class XNameContainer; }
37 namespace com::sun::star::uno { class Any; }
38 namespace com::sun::star::uno { template <typename > class Reference; }
39 namespace com::sun::star::uno { template <typename > class Sequence; }
40 namespace com::sun::star::xml::sax { class XAttributeList; }
41 namespace com::sun::star::xml::sax { class XFastAttributeList; }
42 
43 struct XMLPropertyState;
45 
46 
47 class SvXMLUnitConverter;
48 class SvXMLNamespaceMap;
49 class SvXMLImport;
50 
57 {
58  sal_Int16 nContextID;
59  sal_Int32 nIndex;
60 };
61 
63 {
65 
66  SvXMLImport& rImport; // access to error handling
67 
70 
71 protected:
72 
74  SvXMLImport& GetImport() const { return rImport;}
75 
76 public:
77 
80  SvXMLImport& rImport);
81  virtual ~SvXMLImportPropertyMapper() override;
82 
83  // Add an ImportPropertyMapper at the end of the import mapper chain.
84  // The added mapper MUST not be used outside the Mapper chain any longer,
85  // because its PropertyMapper will be replaced.
86  void ChainImportMapper(
88 
93  void importXML(
94  ::std::vector< XMLPropertyState >& rProperties,
95  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
96  const SvXMLUnitConverter& rUnitConverter,
97  const SvXMLNamespaceMap& rNamespaceMap,
98  sal_uInt32 nPropType,
99  sal_Int32 nStartIdx, sal_Int32 nEndIdx ) const;
100 
102  virtual bool handleSpecialItem(
103  XMLPropertyState& rProperty,
104  ::std::vector< XMLPropertyState >& rProperties,
105  const OUString& rValue,
106  const SvXMLUnitConverter& rUnitConverter,
107  const SvXMLNamespaceMap& rNamespaceMap ) const;
108 
110  virtual void finished(
111  ::std::vector< XMLPropertyState >& rProperties,
112  sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
113 
114  void CheckSpecialContext(
115  const ::std::vector< XMLPropertyState >& rProperties,
116  const css::uno::Reference< css::beans::XPropertySet >& rPropSet,
117  ContextID_Index_Pair* pSpecialContextIds ) const;
118 
119  bool FillPropertySet(
120  const ::std::vector< XMLPropertyState >& rProperties,
121  const css::uno::Reference< css::beans::XPropertySet >& rPropSet,
122  ContextID_Index_Pair* pSpecialContextIds = nullptr ) const;
123 
124  void FillPropertySequence(
125  const ::std::vector< XMLPropertyState >& aProperties,
126  css::uno::Sequence< css::beans::PropertyValue >& rValues )
127  const;
128 
130  getPropertySetMapper() const;
131 
132 
135  static bool FillPropertySet_(
136  const ::std::vector<XMLPropertyState> & rProperties,
137  const css::uno::Reference< css::beans::XPropertySet> & rPropSet,
138  const css::uno::Reference< css::beans::XPropertySetInfo> & rPropSetInfo,
139  const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
140  SvXMLImport& rImport,
141 
142  // parameter for use by txtstyli.cxx; allows efficient
143  // catching the combined characters property
144  ContextID_Index_Pair* pSpecialContextIds );
145 
148  static bool FillMultiPropertySet_(
149  const ::std::vector<XMLPropertyState> & rProperties,
150  const css::uno::Reference< css::beans::XMultiPropertySet> & rMultiPropSet,
151  const css::uno::Reference< css::beans::XPropertySetInfo> & rPropSetInfo,
152  const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
153 
154  // parameters for use by txtstyli.cxx; allows efficient
155  // catching the combined characters property
156  ContextID_Index_Pair* pSpecialContextIds );
157 
160  static bool FillTolerantMultiPropertySet_(
161  const ::std::vector<XMLPropertyState> & rProperties,
162  const css::uno::Reference< css::beans::XTolerantMultiPropertySet> & rTolPropSet,
163  const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
164  SvXMLImport& rImport,
165 
166  // parameters for use by txtstyli.cxx; allows efficient
167  // catching the combined characters property
168  ContextID_Index_Pair* pSpecialContextIds );
169 
170 
171  static void PrepareForMultiPropertySet_(
172  const ::std::vector<XMLPropertyState> & rProperties,
173  const css::uno::Reference< css::beans::XPropertySetInfo> & rPropSetInfo,
174  const rtl::Reference<XMLPropertySetMapper> & rPropMapper,
175  ContextID_Index_Pair* pSpecialContextIds,
176  css::uno::Sequence< OUString >& rNames,
177  css::uno::Sequence< css::uno::Any >& rValues);
178 
179 private:
180  void importXMLAttribute(
181  std::vector< XMLPropertyState >& rProperties,
182  const SvXMLUnitConverter& rUnitConverter,
183  const SvXMLNamespaceMap& rNamespaceMap,
184  sal_uInt32 nPropType,
185  sal_Int32 nStartIdx,
186  sal_Int32 nEndIdx,
187  css::uno::Reference< css::container::XNameContainer >& xAttrContainer,
188  const OUString& sAttrName,
189  const OUString& aNamespaceURI,
190  const OUString& sValue) const;
191 };
192 
193 
196 {
197  return maPropMapper;
198 }
199 
200 #endif // INCLUDED_XMLOFF_XMLIMPPR_HXX
201 
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int16 nContextID
Definition: xmlimppr.hxx:58
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:77
Reference
const rtl::Reference< XMLPropertySetMapper > & getPropertySetMapper() const
Definition: xmlimppr.hxx:195
css::uno::Any const & rValue
Definition: ImageStyle.hxx:38
SvXMLImport & GetImport() const
Definition: xmlimppr.hxx:74
SvXMLImport & rImport
Definition: xmlimppr.hxx:66
class SAL_NO_VTABLE XPropertySet
rtl::Reference< XMLPropertySetMapper > maPropMapper
Definition: xmlimppr.hxx:73
void operator=(SimpleReferenceObject) SAL_DELETED_FUNCTION
Smart struct to transport an Any with an index to the appropriate property-name.
Definition: maptype.hxx:122
This struct is used as an optional parameter to the static _FillPropertySet() methods.
Definition: xmlimppr.hxx:56
rtl::Reference< SvXMLImportPropertyMapper > mxNextMapper
Definition: xmlimppr.hxx:64
#define XMLOFF_DLLPUBLIC
Definition: dllapi.h:29