1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _XMLOFF_CHARTPROPERTYSETMAPPER_HXX_
24 #define _XMLOFF_CHARTPROPERTYSETMAPPER_HXX_
25 
26 #include <xmloff/uniref.hxx>
27 #include <xmloff/xmlprmap.hxx>
28 #include <xmloff/xmlexppr.hxx>
29 #include <xmloff/xmlimppr.hxx>
30 #include <xmloff/xmlimp.hxx>
31 
32 namespace rtl { class OUString; }
33 
34 extern const XMLPropertyMapEntry aXMLChartPropMap[];
35 
36 class SvXMLExport;
37 
38 // ----------------------------------------
39 
40 class XMLChartPropHdlFactory : public XMLPropertyHandlerFactory
41 {
42 private:
43 	const XMLPropertyHandler* GetShapePropertyHandler( sal_Int32 nType ) const;
44 
45 public:
46 	virtual ~XMLChartPropHdlFactory();
47 	virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const;
48 };
49 
50 // ----------------------------------------
51 
52 class XMLChartPropertySetMapper : public XMLPropertySetMapper
53 {
54 public:
55 	XMLChartPropertySetMapper();
56 	~XMLChartPropertySetMapper();
57 };
58 
59 // ----------------------------------------
60 
61 class XMLChartExportPropertyMapper : public SvXMLExportPropertyMapper
62 {
63 private:
64 	const rtl::OUString msTrue;
65 	const rtl::OUString msFalse;
66     bool mbAdaptPercentage;
67 
68     SvXMLExport& mrExport;
69 
70 protected:
71 	virtual void ContextFilter(
72 		::std::vector< XMLPropertyState >& rProperties,
73 		::com::sun::star::uno::Reference<
74 			::com::sun::star::beans::XPropertySet > rPropSet ) const;
75 
76 private:
77 	/// this method is called for every item that has the MID_FLAG_ELEMENT_EXPORT flag set
78 	virtual void handleElementItem(
79         SvXMLExport& rExport,
80 		const XMLPropertyState& rProperty, sal_uInt16 nFlags,
81 		const ::std::vector< XMLPropertyState > *pProperties = 0,
82 		sal_uInt32 nIdx = 0  ) const;
83 
84 	/// this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set
85 	virtual void handleSpecialItem(
86 		SvXMLAttributeList& rAttrList, const XMLPropertyState& rProperty,
87 		const SvXMLUnitConverter& rUnitConverter, const SvXMLNamespaceMap& rNamespaceMap,
88 		const ::std::vector< XMLPropertyState > *pProperties = 0,
89 		sal_uInt32 nIdx = 0  ) const;
90 
91 public:
92 	XMLChartExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
93                                   SvXMLExport& rExport );
94 	virtual ~XMLChartExportPropertyMapper();
95 
96     void setAdaptPercentage( bool bNewValue );
97 };
98 
99 // ----------------------------------------
100 
101 class XMLChartImportPropertyMapper : public SvXMLImportPropertyMapper
102 {
103 private:
104     SvXMLImport& mrImport;
105 
106 public:
107 	XMLChartImportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
108                                   const SvXMLImport& rImport );
109 	virtual ~XMLChartImportPropertyMapper();
110 
111 	virtual sal_Bool handleSpecialItem(
112 		XMLPropertyState& rProperty,
113 		::std::vector< XMLPropertyState >& rProperties,
114 		const ::rtl::OUString& rValue,
115 		const SvXMLUnitConverter& rUnitConverter,
116 		const SvXMLNamespaceMap& rNamespaceMap ) const;
117 
118 	virtual void finished(
119 		::std::vector< XMLPropertyState >& rProperties,
120 		sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
121 };
122 
123 #endif	// _XMLOFF_CHARTPROPERTYSETMAPPER_HXX_
124