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