1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_SOURCE_FILTER_XML_XMLIMPIT_HXX
20 #define INCLUDED_SW_SOURCE_FILTER_XML_XMLIMPIT_HXX
22 #include <com/sun/star/xml/sax/XFastAttributeList.hpp>
23 #include "xmlitmap.hxx"
25 class SvXMLUnitConverter
;
28 class SvXMLNamespaceMap
;
29 struct SvXMLItemMapEntry
;
30 class SvXMLAttrContainerItem
;
32 class SvXMLImportItemMapper
34 SvXMLItemMapEntriesRef mrMapEntries
;
37 explicit SvXMLImportItemMapper( SvXMLItemMapEntriesRef aMapEntries
);
38 virtual ~SvXMLImportItemMapper();
40 /** fills the given itemset with the attributes in the given list */
41 void importXML( SfxItemSet
& rSet
,
42 css::uno::Reference
< css::xml::sax::XFastAttributeList
> const & xAttrList
,
43 const SvXMLUnitConverter
& rUnitConverter
,
44 const SvXMLNamespaceMap
& rNamespaceMap
);
46 /** this method is called for every item that has the
47 MID_SW_FLAG_SPECIAL_ITEM_IMPORT flag set */
48 virtual bool handleSpecialItem( const SvXMLItemMapEntry
& rEntry
,
51 const OUString
& rValue
,
52 const SvXMLUnitConverter
& rUnitConverter
);
54 /** this method is called for every item that has the
55 MID_SW_FLAG_NO_ITEM_IMPORT flag set */
56 virtual bool handleNoItem( const SvXMLItemMapEntry
& rEntry
,
58 const OUString
& rValue
,
59 const SvXMLUnitConverter
& rUnitConverter
,
60 const SvXMLNamespaceMap
& rNamespaceMap
);
62 /** This method is called when all attributes have benn processed. It
63 * may be used to remove items that are incomplete */
64 virtual void finished(SfxItemSet
& rSet
,
65 SvXMLUnitConverter
const& rUnitConverter
) const;
67 virtual void setMapEntries( SvXMLItemMapEntriesRef rMapEntries
);
68 inline const SvXMLItemMapEntriesRef
& getMapEntries() const;
70 /** This method is called for every item that should be set based
71 upon an XML attribute value. */
72 static bool PutXMLValue(
74 const OUString
& rValue
,
76 const SvXMLUnitConverter
& rUnitConverter
);
78 void importXMLUnknownAttributes( SfxItemSet
& rSet
,
79 css::uno::Reference
< css::xml::sax::XFastAttributeList
> const & xAttrList
,
80 const SvXMLUnitConverter
& rUnitConverter
,
81 std::unique_ptr
<SvXMLAttrContainerItem
>& pUnknownItem
);
85 inline const SvXMLItemMapEntriesRef
&
86 SvXMLImportItemMapper::getMapEntries() const
91 #endif // INCLUDED_SW_SOURCE_FILTER_XML_XMLIMPIT_HXX
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */