1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlimpit.hxx,v $
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 ************************************************************************/
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
;
46 class SvXMLNamespaceMap
;
47 struct SvXMLItemMapEntry
;
49 class SvXMLImportItemMapper
52 SvXMLItemMapEntriesRef mrMapEntries
;
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
,
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
,
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(
95 const ::rtl::OUString
& rValue
,
97 const SvXMLUnitConverter
& rUnitConverter
);
101 SvXMLImportItemMapper::setMapEntries( SvXMLItemMapEntriesRef rMapEntries
)
103 mrMapEntries
= rMapEntries
;
106 inline SvXMLItemMapEntriesRef
107 SvXMLImportItemMapper::getMapEntries() const
113 #endif // _XMLIMPIT_HXX