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 :
20 : #ifndef INCLUDED_SW_SOURCE_FILTER_XML_XMLEXPIT_HXX
21 : #define INCLUDED_SW_SOURCE_FILTER_XML_XMLEXPIT_HXX
22 :
23 : #include <tools/solar.h>
24 : #include "xmlitmap.hxx"
25 : #include <vector>
26 :
27 : #define XML_EXPORT_FLAG_DEFAULTS 0x0001 // export also default items
28 : #define XML_EXPORT_FLAG_DEEP 0x0002 // export also items from
29 : // parent item sets
30 : #define XML_EXPORT_FLAG_EMPTY 0x0004 // export attribs element
31 : // even if its empty
32 : #define XML_EXPORT_FLAG_IGN_WS 0x0008
33 :
34 : class SvXMLUnitConverter;
35 : class SfxPoolItem;
36 : class SfxItemSet;
37 : class SvXMLAttributeList;
38 : class SvXMLNamespaceMap;
39 : class SvXMLExport;
40 :
41 : class SvXMLExportItemMapper
42 : {
43 : protected:
44 : SvXMLItemMapEntriesRef mrMapEntries;
45 :
46 : /** fills the given attribute list with the items in the given set */
47 : void exportXML( const SvXMLExport& rExport,
48 : SvXMLAttributeList& rAttrList,
49 : const SfxItemSet& rSet,
50 : const SvXMLUnitConverter& rUnitConverter,
51 : const SvXMLNamespaceMap& rNamespaceMap,
52 : sal_uInt16 nFlags,
53 : std::vector<sal_uInt16> *pIndexArray ) const;
54 :
55 : void exportXML( const SvXMLExport& rExport,
56 : SvXMLAttributeList& rAttrList,
57 : const SfxPoolItem& rItem,
58 : const SvXMLItemMapEntry &rEntry,
59 : const SvXMLUnitConverter& rUnitConverter,
60 : const SvXMLNamespaceMap& rNamespaceMap,
61 : sal_uInt16 nFlags,
62 : const SfxItemSet *pSet ) const;
63 :
64 : void exportElementItems( SvXMLExport& rExport,
65 : const SvXMLUnitConverter& rUnitConverter,
66 : const SfxItemSet &rSet,
67 : sal_uInt16 nFlags,
68 : const std::vector<sal_uInt16> &rIndexArray ) const;
69 :
70 : static const SfxPoolItem* GetItem( const SfxItemSet &rSet,
71 : sal_uInt16 nWhichId,
72 : sal_uInt16 nFlags );
73 :
74 : public:
75 : SvXMLExportItemMapper( SvXMLItemMapEntriesRef rMapEntries );
76 : virtual ~SvXMLExportItemMapper();
77 :
78 : void exportXML( SvXMLExport& rExport,
79 : const SfxItemSet& rSet,
80 : const SvXMLUnitConverter& rUnitConverter,
81 : ::xmloff::token::XMLTokenEnum ePropToken,
82 : sal_uInt16 nFlags = 0 ) const;
83 :
84 : /** this method is called for every item that has the
85 : MID_SW_FLAG_SPECIAL_ITEM_EXPORT flag set */
86 : virtual void handleSpecialItem( SvXMLAttributeList& rAttrList,
87 : const SvXMLItemMapEntry& rEntry,
88 : const SfxPoolItem& rItem,
89 : const SvXMLUnitConverter& rUnitConverter,
90 : const SvXMLNamespaceMap& rNamespaceMap,
91 : const SfxItemSet *pSet = NULL ) const;
92 :
93 : /** this method is called for every item that has the
94 : MID_SW_FLAG_NO_ITEM_EXPORT flag set */
95 : virtual void handleNoItem( SvXMLAttributeList& rAttrList,
96 : const SvXMLItemMapEntry& rEntry,
97 : const SvXMLUnitConverter& rUnitConverter,
98 : const SvXMLNamespaceMap& rNamespaceMap,
99 : const SfxItemSet& rSet ) const;
100 :
101 : /** this method is called for every item that has the
102 : MID_SW_FLAG_ELEMENT_EXPORT flag set */
103 : virtual void handleElementItem( SvXMLExport& rExport,
104 : const SvXMLItemMapEntry& rEntry,
105 : const SfxPoolItem& rItem,
106 : const SvXMLUnitConverter& rUnitConverter,
107 : const SfxItemSet& rSet,
108 : sal_uInt16 nFlags ) const;
109 :
110 : inline void setMapEntries( SvXMLItemMapEntriesRef rMapEntries );
111 :
112 : static bool QueryXMLValue( const SfxPoolItem& rItem,
113 : OUString& rValue, sal_uInt16 nMemberId,
114 : const SvXMLUnitConverter& rUnitConverter );
115 : };
116 :
117 : inline void
118 0 : SvXMLExportItemMapper::setMapEntries( SvXMLItemMapEntriesRef rMapEntries )
119 : {
120 0 : mrMapEntries = rMapEntries;
121 0 : }
122 :
123 : #endif // INCLUDED_SW_SOURCE_FILTER_XML_XMLEXPIT_HXX
124 :
125 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|