merge the formfield patch from ooo-build
[ooovba.git] / binfilter / inc / bf_xmloff / xmlimppr.hxx
blob604544b6a59bcd526689195ad0cdec7988c16b67
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlimppr.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _XMLOFF_XMLIMPPR_HXX
31 #define _XMLOFF_XMLIMPPR_HXX
33 #ifndef _SOLAR_H
34 #include <tools/solar.h>
35 #endif
37 #ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_
38 #include <com/sun/star/xml/sax/XAttributeList.hpp>
39 #endif
40 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
41 #include <com/sun/star/beans/XPropertySet.hpp>
42 #endif
43 #ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
44 #include <com/sun/star/beans/XMultiPropertySet.hpp>
45 #endif
47 #ifndef __SGI_STL_VECTOR
48 #include <vector>
49 #endif
51 #ifndef _UNIVERSALL_REFERENCE_HXX
52 #include <bf_xmloff/uniref.hxx>
53 #endif
54 namespace rtl { class OUString; }
55 namespace binfilter {
57 struct XMLPropertyState;
58 class XMLPropertySetMapper;
61 class SvXMLUnitConverter;
62 class SvXMLNamespaceMap;
63 class SvXMLImport;
65 /** This struct is used as an optional parameter to the static
66 * _FillPropertySet() methods.
68 * It should not be used in any other context.
70 struct _ContextID_Index_Pair
72 sal_Int16 nContextID;
73 sal_Int32 nIndex;
76 class SvXMLImportPropertyMapper : public UniRefBase
78 UniReference< SvXMLImportPropertyMapper> mxNextMapper;
80 SvXMLImport& rImport; // access to error handling
82 protected:
84 UniReference< XMLPropertySetMapper > maPropMapper;
86 public:
88 SvXMLImportPropertyMapper(
89 const UniReference< XMLPropertySetMapper >& rMapper,
90 SvXMLImport& rImport);
91 virtual ~SvXMLImportPropertyMapper();
93 // Add a ImportPropertyMapper at the end of the import mapper chain.
94 // The added mapper MUST not be used outside the Mapper chain any longer,
95 // because its PropertyMapper will be replaced.
96 void ChainImportMapper(
97 const UniReference< SvXMLImportPropertyMapper>& rMapper );
99 /** like above, except that the mart is only serached within the range
100 * [nStartIdx, nEndIdx[
102 void importXML(
103 ::std::vector< XMLPropertyState >& rProperties,
104 ::com::sun::star::uno::Reference<
105 ::com::sun::star::xml::sax::XAttributeList > xAttrList,
106 const SvXMLUnitConverter& rUnitConverter,
107 const SvXMLNamespaceMap& rNamespaceMap,
108 sal_Int32 nStartIdx, sal_Int32 nEndIdx ) const;
110 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set */
111 virtual sal_Bool handleSpecialItem(
112 XMLPropertyState& rProperty,
113 ::std::vector< XMLPropertyState >& rProperties,
114 const ::rtl::OUString& rValue,
115 const SvXMLUnitConverter& rUnitConverter,
116 const SvXMLNamespaceMap& rNamespaceMap ) const;
118 /** This method is called when all attributes have benn processed. It may be used to remove items that are incomplete */
119 virtual void finished(
120 ::std::vector< XMLPropertyState >& rProperties,
121 sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
123 sal_Bool FillPropertySet(
124 const ::std::vector< XMLPropertyState >& aProperties,
125 const ::com::sun::star::uno::Reference<
126 ::com::sun::star::beans::XPropertySet > rPropSet ) const;
128 inline const UniReference< XMLPropertySetMapper >&
129 getPropertySetMapper() const;
131 /** implementation helper for FillPropertySet: fill an XPropertySet.
132 * Exceptions will be asserted. */
133 static sal_Bool _FillPropertySet(
134 const ::std::vector<XMLPropertyState> & rProperties,
135 const ::com::sun::star::uno::Reference<
136 ::com::sun::star::beans::XPropertySet> & rPropSet,
137 const ::com::sun::star::uno::Reference<
138 ::com::sun::star::beans::XPropertySetInfo> & rPropSetInfo,
139 const UniReference<XMLPropertySetMapper> & rPropMapper,
140 SvXMLImport& rImport,
142 // parameter for use by txtstyli.cxx; allows efficient
143 // catching the combined characters property
144 struct _ContextID_Index_Pair* pSpecialContextIds = NULL );
146 /** implementation helper for FillPropertySet: fill an XMultiPropertySet.
147 * If unsuccessul, set return value. */
148 static sal_Bool _FillMultiPropertySet(
149 const ::std::vector<XMLPropertyState> & rProperties,
150 const ::com::sun::star::uno::Reference<
151 ::com::sun::star::beans::XMultiPropertySet> & rMultiPropSet,
152 const ::com::sun::star::uno::Reference<
153 ::com::sun::star::beans::XPropertySetInfo> & rPropSetInfo,
154 const UniReference<XMLPropertySetMapper> & rPropMapper,
156 // parameters for use by txtstyli.cxx; allows efficient
157 // catching the combined characters property
158 struct _ContextID_Index_Pair* pSpecialContextIds = NULL );
162 inline const UniReference< XMLPropertySetMapper >&
163 SvXMLImportPropertyMapper::getPropertySetMapper() const
165 return maPropMapper;
168 }//end of namespace binfilter
169 #endif // _XMLOFF_XMLIMPPR_HXX