1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlexpit.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <tools/solar.h>
35 #include <tools/ref.hxx>
36 #include "xmlitmap.hxx"
38 #define XML_EXPORT_FLAG_DEFAULTS 0x0001 // export also default items
39 #define XML_EXPORT_FLAG_DEEP 0x0002 // export also items from
41 #define XML_EXPORT_FLAG_EMPTY 0x0004 // export attribs element
43 #define XML_EXPORT_FLAG_IGN_WS 0x0008
45 namespace rtl
{ class OUString
; }
46 class SvXMLUnitConverter
;
49 class SvXMLAttributeList
;
50 class SvXMLNamespaceMap
;
55 class SvXMLExportItemMapper
58 SvXMLItemMapEntriesRef mrMapEntries
;
60 /** fills the given attribute list with the items in the given set */
61 void exportXML( const SvXMLExport
& rExport
,
62 SvXMLAttributeList
& rAttrList
,
63 const SfxItemSet
& rSet
,
64 const SvXMLUnitConverter
& rUnitConverter
,
65 const SvXMLNamespaceMap
& rNamespaceMap
,
67 SvUShorts
* pIndexArray
) const;
69 void exportXML( const SvXMLExport
& rExport
,
70 SvXMLAttributeList
& rAttrList
,
71 const SfxPoolItem
& rItem
,
72 const SvXMLItemMapEntry
&rEntry
,
73 const SvXMLUnitConverter
& rUnitConverter
,
74 const SvXMLNamespaceMap
& rNamespaceMap
,
76 const SfxItemSet
*pSet
) const;
79 void exportElementItems( SvXMLExport
& rExport
,
80 const SvXMLUnitConverter
& rUnitConverter
,
81 const SfxItemSet
&rSet
,
83 const SvUShorts
& rIndexArray
) const;
85 static const SfxPoolItem
* GetItem( const SfxItemSet
&rSet
,
90 SvXMLExportItemMapper( SvXMLItemMapEntriesRef rMapEntries
);
91 virtual ~SvXMLExportItemMapper();
93 void exportXML( SvXMLExport
& rExport
,
94 const SfxItemSet
& rSet
,
95 const SvXMLUnitConverter
& rUnitConverter
,
96 ::xmloff::token::XMLTokenEnum ePropToken
,
97 sal_uInt16 nFlags
= 0 ) const;
99 /** this method is called for every item that has the
100 MID_SW_FLAG_SPECIAL_ITEM_EXPORT flag set */
101 virtual void handleSpecialItem( SvXMLAttributeList
& rAttrList
,
102 const SvXMLItemMapEntry
& rEntry
,
103 const SfxPoolItem
& rItem
,
104 const SvXMLUnitConverter
& rUnitConverter
,
105 const SvXMLNamespaceMap
& rNamespaceMap
,
106 const SfxItemSet
*pSet
= NULL
) const;
109 /** this method is called for every item that has the
110 MID_SW_FLAG_NO_ITEM_EXPORT flag set */
111 virtual void handleNoItem( SvXMLAttributeList
& rAttrList
,
112 const SvXMLItemMapEntry
& rEntry
,
113 const SvXMLUnitConverter
& rUnitConverter
,
114 const SvXMLNamespaceMap
& rNamespaceMap
,
115 const SfxItemSet
& rSet
) const;
117 /** this method is called for every item that has the
118 MID_SW_FLAG_ELEMENT_EXPORT flag set */
119 virtual void handleElementItem( SvXMLExport
& rExport
,
120 const SvXMLItemMapEntry
& rEntry
,
121 const SfxPoolItem
& rItem
,
122 const SvXMLUnitConverter
& rUnitConverter
,
123 const SfxItemSet
& rSet
,
124 sal_uInt16 nFlags
) const;
126 inline void setMapEntries( SvXMLItemMapEntriesRef rMapEntries
);
128 static sal_Bool
QueryXMLValue( const SfxPoolItem
& rItem
,
129 ::rtl::OUString
& rValue
, sal_uInt16 nMemberId
,
130 const SvXMLUnitConverter
& rUnitConverter
);
134 SvXMLExportItemMapper::setMapEntries( SvXMLItemMapEntriesRef rMapEntries
)
136 mrMapEntries
= rMapEntries
;
139 #endif // _XMLITMPR_HXX