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 _XMLITMPR_HXX
21 : #define _XMLITMPR_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 : namespace rtl { class OUString; }
35 : class SvXMLUnitConverter;
36 : class SfxPoolItem;
37 : class SfxItemSet;
38 : class SvXMLAttributeList;
39 : class SvXMLNamespaceMap;
40 : class SvXMLExport;
41 :
42 :
43 : class SvXMLExportItemMapper
44 : {
45 : protected:
46 : SvXMLItemMapEntriesRef mrMapEntries;
47 :
48 : /** fills the given attribute list with the items in the given set */
49 : void exportXML( const SvXMLExport& rExport,
50 : SvXMLAttributeList& rAttrList,
51 : const SfxItemSet& rSet,
52 : const SvXMLUnitConverter& rUnitConverter,
53 : const SvXMLNamespaceMap& rNamespaceMap,
54 : sal_uInt16 nFlags,
55 : std::vector<sal_uInt16> *pIndexArray ) const;
56 :
57 : void exportXML( const SvXMLExport& rExport,
58 : SvXMLAttributeList& rAttrList,
59 : const SfxPoolItem& rItem,
60 : const SvXMLItemMapEntry &rEntry,
61 : const SvXMLUnitConverter& rUnitConverter,
62 : const SvXMLNamespaceMap& rNamespaceMap,
63 : sal_uInt16 nFlags,
64 : const SfxItemSet *pSet ) const;
65 :
66 :
67 : void exportElementItems( SvXMLExport& rExport,
68 : const SvXMLUnitConverter& rUnitConverter,
69 : const SfxItemSet &rSet,
70 : sal_uInt16 nFlags,
71 : const std::vector<sal_uInt16> &rIndexArray ) const;
72 :
73 : static const SfxPoolItem* GetItem( const SfxItemSet &rSet,
74 : sal_uInt16 nWhichId,
75 : sal_uInt16 nFlags );
76 :
77 : public:
78 : SvXMLExportItemMapper( SvXMLItemMapEntriesRef rMapEntries );
79 : virtual ~SvXMLExportItemMapper();
80 :
81 : void exportXML( SvXMLExport& rExport,
82 : const SfxItemSet& rSet,
83 : const SvXMLUnitConverter& rUnitConverter,
84 : ::xmloff::token::XMLTokenEnum ePropToken,
85 : sal_uInt16 nFlags = 0 ) const;
86 :
87 : /** this method is called for every item that has the
88 : MID_SW_FLAG_SPECIAL_ITEM_EXPORT flag set */
89 : virtual void handleSpecialItem( SvXMLAttributeList& rAttrList,
90 : const SvXMLItemMapEntry& rEntry,
91 : const SfxPoolItem& rItem,
92 : const SvXMLUnitConverter& rUnitConverter,
93 : const SvXMLNamespaceMap& rNamespaceMap,
94 : const SfxItemSet *pSet = NULL ) const;
95 :
96 :
97 : /** this method is called for every item that has the
98 : MID_SW_FLAG_NO_ITEM_EXPORT flag set */
99 : virtual void handleNoItem( SvXMLAttributeList& rAttrList,
100 : const SvXMLItemMapEntry& rEntry,
101 : const SvXMLUnitConverter& rUnitConverter,
102 : const SvXMLNamespaceMap& rNamespaceMap,
103 : const SfxItemSet& rSet ) const;
104 :
105 : /** this method is called for every item that has the
106 : MID_SW_FLAG_ELEMENT_EXPORT flag set */
107 : virtual void handleElementItem( SvXMLExport& rExport,
108 : const SvXMLItemMapEntry& rEntry,
109 : const SfxPoolItem& rItem,
110 : const SvXMLUnitConverter& rUnitConverter,
111 : const SfxItemSet& rSet,
112 : sal_uInt16 nFlags ) const;
113 :
114 : inline void setMapEntries( SvXMLItemMapEntriesRef rMapEntries );
115 :
116 : static sal_Bool QueryXMLValue( const SfxPoolItem& rItem,
117 : ::rtl::OUString& rValue, sal_uInt16 nMemberId,
118 : const SvXMLUnitConverter& rUnitConverter );
119 : };
120 :
121 : inline void
122 0 : SvXMLExportItemMapper::setMapEntries( SvXMLItemMapEntriesRef rMapEntries )
123 : {
124 0 : mrMapEntries = rMapEntries;
125 0 : }
126 :
127 : #endif // _XMLITMPR_HXX
128 :
129 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|