Line data Source code
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_SW_SOURCE_FILTER_XML_XMLIMPIT_HXX
20 : #define INCLUDED_SW_SOURCE_FILTER_XML_XMLIMPIT_HXX
21 :
22 : #include <limits.h>
23 : #include <tools/solar.h>
24 :
25 : #include <com/sun/star/xml/sax/XAttributeList.hpp>
26 : #include "xmlitmap.hxx"
27 :
28 : class SvXMLUnitConverter;
29 : class SfxPoolItem;
30 : class SfxItemSet;
31 : class SvXMLNamespaceMap;
32 : struct SvXMLItemMapEntry;
33 :
34 : class SvXMLImportItemMapper
35 : {
36 : protected:
37 : SvXMLItemMapEntriesRef mrMapEntries;
38 : sal_uInt16 nUnknownWhich;
39 :
40 : public:
41 : SvXMLImportItemMapper( SvXMLItemMapEntriesRef rMapEntries ,
42 : sal_uInt16 nUnknWhich=USHRT_MAX );
43 : virtual ~SvXMLImportItemMapper();
44 :
45 : /** fills the given itemset with the attributes in the given list */
46 : void importXML( SfxItemSet& rSet,
47 : ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttrList,
48 : const SvXMLUnitConverter& rUnitConverter,
49 : const SvXMLNamespaceMap& rNamespaceMap );
50 :
51 : /** this method is called for every item that has the
52 : MID_SW_FLAG_SPECIAL_ITEM_IMPORT flag set */
53 : virtual bool handleSpecialItem( const SvXMLItemMapEntry& rEntry,
54 : SfxPoolItem& rItem,
55 : SfxItemSet& rSet,
56 : const OUString& rValue,
57 : const SvXMLUnitConverter& rUnitConverter,
58 : const SvXMLNamespaceMap& rNamespaceMap );
59 :
60 : /** this method is called for every item that has the
61 : MID_SW_FLAG_NO_ITEM_IMPORT flag set */
62 : virtual bool handleNoItem( const SvXMLItemMapEntry& rEntry,
63 : SfxItemSet& rSet,
64 : const OUString& rValue,
65 : const SvXMLUnitConverter& rUnitConverter,
66 : const SvXMLNamespaceMap& rNamespaceMap );
67 :
68 : /** This method is called when all attributes have benn processed. It
69 : * may be used to remove items that are incomplete */
70 : virtual void finished(SfxItemSet & rSet,
71 : SvXMLUnitConverter const& rUnitConverter) const;
72 :
73 : virtual void setMapEntries( SvXMLItemMapEntriesRef rMapEntries );
74 : inline SvXMLItemMapEntriesRef getMapEntries() const;
75 :
76 : /** This method is called for every item that should be set based
77 : upon an XML attribute value. */
78 : static bool PutXMLValue(
79 : SfxPoolItem& rItem,
80 : const OUString& rValue,
81 : sal_uInt16 nMemberId,
82 : const SvXMLUnitConverter& rUnitConverter );
83 : };
84 :
85 : inline SvXMLItemMapEntriesRef
86 184 : SvXMLImportItemMapper::getMapEntries() const
87 : {
88 184 : return mrMapEntries;
89 : }
90 :
91 : #endif // INCLUDED_SW_SOURCE_FILTER_XML_XMLIMPIT_HXX
92 :
93 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|