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