Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _XMLITMPR_HXX
30 : : #define _XMLITMPR_HXX
31 : :
32 : : #include <tools/solar.h>
33 : : #include "xmlitmap.hxx"
34 : : #include <vector>
35 : :
36 : : #define XML_EXPORT_FLAG_DEFAULTS 0x0001 // export also default items
37 : : #define XML_EXPORT_FLAG_DEEP 0x0002 // export also items from
38 : : // parent item sets
39 : : #define XML_EXPORT_FLAG_EMPTY 0x0004 // export attribs element
40 : : // even if its empty
41 : : #define XML_EXPORT_FLAG_IGN_WS 0x0008
42 : :
43 : : namespace rtl { class OUString; }
44 : : class SvXMLUnitConverter;
45 : : class SfxPoolItem;
46 : : class SfxItemSet;
47 : : class SvXMLAttributeList;
48 : : class SvXMLNamespaceMap;
49 : : class SvXMLExport;
50 : :
51 : :
52 : : class SvXMLExportItemMapper
53 : : {
54 : : protected:
55 : : SvXMLItemMapEntriesRef mrMapEntries;
56 : :
57 : : /** fills the given attribute list with the items in the given set */
58 : : void exportXML( const SvXMLExport& rExport,
59 : : SvXMLAttributeList& rAttrList,
60 : : const SfxItemSet& rSet,
61 : : const SvXMLUnitConverter& rUnitConverter,
62 : : const SvXMLNamespaceMap& rNamespaceMap,
63 : : sal_uInt16 nFlags,
64 : : std::vector<sal_uInt16> *pIndexArray ) const;
65 : :
66 : : void exportXML( const SvXMLExport& rExport,
67 : : SvXMLAttributeList& rAttrList,
68 : : const SfxPoolItem& rItem,
69 : : const SvXMLItemMapEntry &rEntry,
70 : : const SvXMLUnitConverter& rUnitConverter,
71 : : const SvXMLNamespaceMap& rNamespaceMap,
72 : : sal_uInt16 nFlags,
73 : : const SfxItemSet *pSet ) const;
74 : :
75 : :
76 : : void exportElementItems( SvXMLExport& rExport,
77 : : const SvXMLUnitConverter& rUnitConverter,
78 : : const SfxItemSet &rSet,
79 : : sal_uInt16 nFlags,
80 : : const std::vector<sal_uInt16> &rIndexArray ) const;
81 : :
82 : : static const SfxPoolItem* GetItem( const SfxItemSet &rSet,
83 : : sal_uInt16 nWhichId,
84 : : sal_uInt16 nFlags );
85 : :
86 : : public:
87 : : SvXMLExportItemMapper( SvXMLItemMapEntriesRef rMapEntries );
88 : : virtual ~SvXMLExportItemMapper();
89 : :
90 : : void exportXML( SvXMLExport& rExport,
91 : : const SfxItemSet& rSet,
92 : : const SvXMLUnitConverter& rUnitConverter,
93 : : ::xmloff::token::XMLTokenEnum ePropToken,
94 : : sal_uInt16 nFlags = 0 ) const;
95 : :
96 : : /** this method is called for every item that has the
97 : : MID_SW_FLAG_SPECIAL_ITEM_EXPORT flag set */
98 : : virtual void handleSpecialItem( SvXMLAttributeList& rAttrList,
99 : : const SvXMLItemMapEntry& rEntry,
100 : : const SfxPoolItem& rItem,
101 : : const SvXMLUnitConverter& rUnitConverter,
102 : : const SvXMLNamespaceMap& rNamespaceMap,
103 : : const SfxItemSet *pSet = NULL ) const;
104 : :
105 : :
106 : : /** this method is called for every item that has the
107 : : MID_SW_FLAG_NO_ITEM_EXPORT flag set */
108 : : virtual void handleNoItem( SvXMLAttributeList& rAttrList,
109 : : const SvXMLItemMapEntry& rEntry,
110 : : const SvXMLUnitConverter& rUnitConverter,
111 : : const SvXMLNamespaceMap& rNamespaceMap,
112 : : const SfxItemSet& rSet ) const;
113 : :
114 : : /** this method is called for every item that has the
115 : : MID_SW_FLAG_ELEMENT_EXPORT flag set */
116 : : virtual void handleElementItem( SvXMLExport& rExport,
117 : : const SvXMLItemMapEntry& rEntry,
118 : : const SfxPoolItem& rItem,
119 : : const SvXMLUnitConverter& rUnitConverter,
120 : : const SfxItemSet& rSet,
121 : : sal_uInt16 nFlags ) const;
122 : :
123 : : inline void setMapEntries( SvXMLItemMapEntriesRef rMapEntries );
124 : :
125 : : static sal_Bool QueryXMLValue( const SfxPoolItem& rItem,
126 : : ::rtl::OUString& rValue, sal_uInt16 nMemberId,
127 : : const SvXMLUnitConverter& rUnitConverter );
128 : : };
129 : :
130 : : inline void
131 : 0 : SvXMLExportItemMapper::setMapEntries( SvXMLItemMapEntriesRef rMapEntries )
132 : : {
133 : 0 : mrMapEntries = rMapEntries;
134 : 0 : }
135 : :
136 : : #endif // _XMLITMPR_HXX
137 : :
138 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|