xref: /trunk/main/xmloff/inc/XMLChartPropertySetMapper.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _XMLOFF_CHARTPROPERTYSETMAPPER_HXX_
28 #define _XMLOFF_CHARTPROPERTYSETMAPPER_HXX_
29 
30 #include <xmloff/uniref.hxx>
31 #include <xmloff/xmlprmap.hxx>
32 #include <xmloff/xmlexppr.hxx>
33 #include <xmloff/xmlimppr.hxx>
34 #include <xmloff/xmlimp.hxx>
35 
36 namespace rtl { class OUString; }
37 
38 extern const XMLPropertyMapEntry aXMLChartPropMap[];
39 
40 class SvXMLExport;
41 
42 // ----------------------------------------
43 
44 class XMLChartPropHdlFactory : public XMLPropertyHandlerFactory
45 {
46 private:
47     const XMLPropertyHandler* GetShapePropertyHandler( sal_Int32 nType ) const;
48 
49 public:
50     virtual ~XMLChartPropHdlFactory();
51     virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const;
52 };
53 
54 // ----------------------------------------
55 
56 class XMLChartPropertySetMapper : public XMLPropertySetMapper
57 {
58 public:
59     XMLChartPropertySetMapper();
60     ~XMLChartPropertySetMapper();
61 };
62 
63 // ----------------------------------------
64 
65 class XMLChartExportPropertyMapper : public SvXMLExportPropertyMapper
66 {
67 private:
68     const rtl::OUString msTrue;
69     const rtl::OUString msFalse;
70     bool mbAdaptPercentage;
71 
72     SvXMLExport& mrExport;
73 
74 protected:
75     virtual void ContextFilter(
76         ::std::vector< XMLPropertyState >& rProperties,
77         ::com::sun::star::uno::Reference<
78             ::com::sun::star::beans::XPropertySet > rPropSet ) const;
79 
80 private:
81     /// this method is called for every item that has the MID_FLAG_ELEMENT_EXPORT flag set
82     virtual void handleElementItem(
83         SvXMLExport& rExport,
84         const XMLPropertyState& rProperty, sal_uInt16 nFlags,
85         const ::std::vector< XMLPropertyState > *pProperties = 0,
86         sal_uInt32 nIdx = 0  ) const;
87 
88     /// this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set
89     virtual void handleSpecialItem(
90         SvXMLAttributeList& rAttrList, const XMLPropertyState& rProperty,
91         const SvXMLUnitConverter& rUnitConverter, const SvXMLNamespaceMap& rNamespaceMap,
92         const ::std::vector< XMLPropertyState > *pProperties = 0,
93         sal_uInt32 nIdx = 0  ) const;
94 
95 public:
96     XMLChartExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
97                                   SvXMLExport& rExport );
98     virtual ~XMLChartExportPropertyMapper();
99 
100     void setAdaptPercentage( bool bNewValue );
101 };
102 
103 // ----------------------------------------
104 
105 class XMLChartImportPropertyMapper : public SvXMLImportPropertyMapper
106 {
107 private:
108     SvXMLImport& mrImport;
109 
110 public:
111     XMLChartImportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
112                                   const SvXMLImport& rImport );
113     virtual ~XMLChartImportPropertyMapper();
114 
115     virtual sal_Bool handleSpecialItem(
116         XMLPropertyState& rProperty,
117         ::std::vector< XMLPropertyState >& rProperties,
118         const ::rtl::OUString& rValue,
119         const SvXMLUnitConverter& rUnitConverter,
120         const SvXMLNamespaceMap& rNamespaceMap ) const;
121 
122     virtual void finished(
123         ::std::vector< XMLPropertyState >& rProperties,
124         sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
125 };
126 
127 #endif  // _XMLOFF_CHARTPROPERTYSETMAPPER_HXX_
128