merge the formfield patch from ooo-build
[ooovba.git] / sw / source / filter / xml / xmlimpit.hxx
blob7bcd4df83c9040c9d680fd5eb3996c0f121107c9
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: xmlimpit.hxx,v $
10 * $Revision: 1.7 $
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 _XMLIMPIT_HXX
31 #define _XMLIMPIT_HXX
33 #include <limits.h>
34 #include <tools/solar.h>
35 #include <tools/ref.hxx>
38 #include <com/sun/star/xml/sax/XAttributeList.hpp>
39 #include "xmlitmap.hxx"
41 namespace rtl { class OUString; }
43 class SvXMLUnitConverter;
44 class SfxPoolItem;
45 class SfxItemSet;
46 class SvXMLNamespaceMap;
47 struct SvXMLItemMapEntry;
49 class SvXMLImportItemMapper
51 protected:
52 SvXMLItemMapEntriesRef mrMapEntries;
53 USHORT nUnknownWhich;
55 public:
56 SvXMLImportItemMapper( SvXMLItemMapEntriesRef rMapEntries ,
57 USHORT nUnknWhich=USHRT_MAX );
58 virtual ~SvXMLImportItemMapper();
60 /** fills the given itemset with the attributes in the given list */
61 void importXML( SfxItemSet& rSet,
62 ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttrList,
63 const SvXMLUnitConverter& rUnitConverter,
64 const SvXMLNamespaceMap& rNamespaceMap ) const;
66 /** this method is called for every item that has the
67 MID_SW_FLAG_SPECIAL_ITEM_IMPORT flag set */
68 virtual BOOL handleSpecialItem( const SvXMLItemMapEntry& rEntry,
69 SfxPoolItem& rItem,
70 SfxItemSet& rSet,
71 const ::rtl::OUString& rValue,
72 const SvXMLUnitConverter& rUnitConverter,
73 const SvXMLNamespaceMap& rNamespaceMap ) const;
75 /** this method is called for every item that has the
76 MID_SW_FLAG_NO_ITEM_IMPORT flag set */
77 virtual BOOL handleNoItem( const SvXMLItemMapEntry& rEntry,
78 SfxItemSet& rSet,
79 const ::rtl::OUString& rValue,
80 const SvXMLUnitConverter& rUnitConverter,
81 const SvXMLNamespaceMap& rNamespaceMap ) const;
83 /** This method is called when all attributes have benn processed. It
84 * may be used to remove items that are incomplete */
85 virtual void finished( SfxItemSet& rSet ) const;
87 inline void setMapEntries( SvXMLItemMapEntriesRef rMapEntries );
88 inline SvXMLItemMapEntriesRef getMapEntries() const;
91 /** This method is called for every item that should be set based
92 upon an XML attribute value. */
93 static sal_Bool PutXMLValue(
94 SfxPoolItem& rItem,
95 const ::rtl::OUString& rValue,
96 sal_uInt16 nMemberId,
97 const SvXMLUnitConverter& rUnitConverter );
100 inline void
101 SvXMLImportItemMapper::setMapEntries( SvXMLItemMapEntriesRef rMapEntries )
103 mrMapEntries = rMapEntries;
106 inline SvXMLItemMapEntriesRef
107 SvXMLImportItemMapper::getMapEntries() const
109 return mrMapEntries;
113 #endif // _XMLIMPIT_HXX