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