1*ecfe53c5SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ecfe53c5SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ecfe53c5SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ecfe53c5SAndrew Rist  * distributed with this work for additional information
6*ecfe53c5SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ecfe53c5SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ecfe53c5SAndrew Rist  * "License"); you may not use this file except in compliance
9*ecfe53c5SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ecfe53c5SAndrew Rist  *
11*ecfe53c5SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ecfe53c5SAndrew Rist  *
13*ecfe53c5SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ecfe53c5SAndrew Rist  * software distributed under the License is distributed on an
15*ecfe53c5SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ecfe53c5SAndrew Rist  * KIND, either express or implied.  See the License for the
17*ecfe53c5SAndrew Rist  * specific language governing permissions and limitations
18*ecfe53c5SAndrew Rist  * under the License.
19*ecfe53c5SAndrew Rist  *
20*ecfe53c5SAndrew Rist  *************************************************************/
21*ecfe53c5SAndrew Rist 
22*ecfe53c5SAndrew Rist 
23cdf0e10cSrcweir #ifndef _XMLOFF_SCH_XMLIMPORTHELPER_HXX_
24cdf0e10cSrcweir #define _XMLOFF_SCH_XMLIMPORTHELPER_HXX_
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <xmloff/uniref.hxx>
27cdf0e10cSrcweir #include <xmloff/families.hxx>
28cdf0e10cSrcweir #include <com/sun/star/util/XStringMapping.hpp>
29cdf0e10cSrcweir #include <com/sun/star/chart/XChartDocument.hpp>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir namespace com { namespace sun { namespace star {
32cdf0e10cSrcweir 	namespace frame {
33cdf0e10cSrcweir 		class XModel;
34cdf0e10cSrcweir 	}
35cdf0e10cSrcweir 	namespace task {
36cdf0e10cSrcweir 		class XStatusIndicator;
37cdf0e10cSrcweir 	}
38cdf0e10cSrcweir 	namespace xml {
39cdf0e10cSrcweir 		namespace sax {
40cdf0e10cSrcweir             class XAttributeList;
41cdf0e10cSrcweir         }
42cdf0e10cSrcweir     }
43cdf0e10cSrcweir     namespace chart2 {
44cdf0e10cSrcweir         namespace data {
45cdf0e10cSrcweir             class XDataProvider;
46cdf0e10cSrcweir             class XLabeledDataSequence;
47cdf0e10cSrcweir         }
48cdf0e10cSrcweir         class XChartDocument;
49cdf0e10cSrcweir         class XDataSeries;
50cdf0e10cSrcweir     }
51cdf0e10cSrcweir }}}
52cdf0e10cSrcweir 
53cdf0e10cSrcweir class SvXMLUnitConverter;
54cdf0e10cSrcweir class SvXMLStylesContext;
55cdf0e10cSrcweir class XMLChartImportPropertyMapper;
56cdf0e10cSrcweir class SvXMLTokenMap;
57cdf0e10cSrcweir class SvXMLImportContext;
58cdf0e10cSrcweir class SvXMLImport;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir // ========================================
61cdf0e10cSrcweir 
62cdf0e10cSrcweir /** With this class you can import a <chart:chart> element containing
63cdf0e10cSrcweir 	its data as <table:table> element or without internal table. In
64cdf0e10cSrcweir 	the latter case you have to provide a table address mapper that
65cdf0e10cSrcweir 	converts table addresses in XML format to the appropriate application
66cdf0e10cSrcweir 	format.
67cdf0e10cSrcweir  */
68cdf0e10cSrcweir class SchXMLImportHelper : public UniRefBase
69cdf0e10cSrcweir {
70cdf0e10cSrcweir private:
71cdf0e10cSrcweir 	com::sun::star::uno::Reference< com::sun::star::chart::XChartDocument > mxChartDoc;
72cdf0e10cSrcweir 	SvXMLStylesContext* mpAutoStyles;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	SvXMLTokenMap* mpChartDocElemTokenMap;
75cdf0e10cSrcweir 	SvXMLTokenMap* mpTableElemTokenMap;
76cdf0e10cSrcweir 	SvXMLTokenMap* mpChartElemTokenMap;
77cdf0e10cSrcweir 	SvXMLTokenMap* mpPlotAreaElemTokenMap;
78cdf0e10cSrcweir 	SvXMLTokenMap* mpSeriesElemTokenMap;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     SvXMLTokenMap* mpChartAttrTokenMap;
81cdf0e10cSrcweir 	SvXMLTokenMap* mpPlotAreaAttrTokenMap;
82cdf0e10cSrcweir 	SvXMLTokenMap* mpAutoStyleAttrTokenMap;
83cdf0e10cSrcweir 	SvXMLTokenMap* mpCellAttrTokenMap;
84cdf0e10cSrcweir 	SvXMLTokenMap* mpSeriesAttrTokenMap;
85cdf0e10cSrcweir 	SvXMLTokenMap* mpRegEquationAttrTokenMap;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir public:
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	SchXMLImportHelper();
90cdf0e10cSrcweir 	~SchXMLImportHelper();
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	/** get the context for reading the <chart:chart> element with subelements.
93cdf0e10cSrcweir 		The result is stored in the XModel given if it also implements
94cdf0e10cSrcweir 		XChartDocument
95cdf0e10cSrcweir 	 */
96cdf0e10cSrcweir 	SvXMLImportContext* CreateChartContext(
97cdf0e10cSrcweir 		SvXMLImport& rImport,
98cdf0e10cSrcweir 		sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
99cdf0e10cSrcweir 		const com::sun::star::uno::Reference<
100cdf0e10cSrcweir 			com::sun::star::frame::XModel > xChartModel,
101cdf0e10cSrcweir 		const com::sun::star::uno::Reference<
102cdf0e10cSrcweir 			com::sun::star::xml::sax::XAttributeList >& xAttrList );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	/** set the auto-style context that will be used to retrieve auto-styles
105cdf0e10cSrcweir 		used inside the following <chart:chart> element to parse
106cdf0e10cSrcweir 	 */
SetAutoStylesContext(SvXMLStylesContext * pAutoStyles)107cdf0e10cSrcweir 	void SetAutoStylesContext( SvXMLStylesContext* pAutoStyles ) { mpAutoStyles = pAutoStyles; }
GetAutoStylesContext() const108cdf0e10cSrcweir 	SvXMLStylesContext* GetAutoStylesContext() const { return mpAutoStyles; }
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	const com::sun::star::uno::Reference<
GetChartDocument()111cdf0e10cSrcweir 		com::sun::star::chart::XChartDocument >& GetChartDocument()
112cdf0e10cSrcweir 		{ return mxChartDoc; }
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 	const SvXMLTokenMap& GetDocElemTokenMap();
115cdf0e10cSrcweir 	const SvXMLTokenMap& GetTableElemTokenMap();
116cdf0e10cSrcweir 	const SvXMLTokenMap& GetChartElemTokenMap();
117cdf0e10cSrcweir 	const SvXMLTokenMap& GetPlotAreaElemTokenMap();
118cdf0e10cSrcweir 	const SvXMLTokenMap& GetSeriesElemTokenMap();
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	const SvXMLTokenMap& GetChartAttrTokenMap();
121cdf0e10cSrcweir 	const SvXMLTokenMap& GetPlotAreaAttrTokenMap();
122cdf0e10cSrcweir 	const SvXMLTokenMap& GetAutoStyleAttrTokenMap();
123cdf0e10cSrcweir 	const SvXMLTokenMap& GetCellAttrTokenMap();
124cdf0e10cSrcweir 	const SvXMLTokenMap& GetSeriesAttrTokenMap();
125cdf0e10cSrcweir 	const SvXMLTokenMap& GetRegEquationAttrTokenMap();
126cdf0e10cSrcweir 
GetChartFamilyID()127cdf0e10cSrcweir 	static sal_uInt16 GetChartFamilyID() { return XML_STYLE_FAMILY_SCH_CHART_ID; }
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     /** @param bPushLastChartType If </sal_False>, in case a new chart type has to
130cdf0e10cSrcweir                be added (because it does not exist yet), it is appended at the
131cdf0e10cSrcweir                end of the chart-type container.  When </sal_True>, a new chart type
132cdf0e10cSrcweir                is added at one position before the last one, i.e. the formerly
133cdf0e10cSrcweir                last chart type is pushed back, so that it remains the last one.
134cdf0e10cSrcweir 
135cdf0e10cSrcweir                This is needed when the global chart type is set to type A, but
136cdf0e10cSrcweir                the first series has type B. Then B should appear before A (done
137cdf0e10cSrcweir                by passing true).  Once a series of type A has been read,
138cdf0e10cSrcweir                following new chart types are again be added at the end (by
139cdf0e10cSrcweir                passing false).
140cdf0e10cSrcweir      */
141cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
142cdf0e10cSrcweir                 ::com::sun::star::chart2::XDataSeries > GetNewDataSeries(
143cdf0e10cSrcweir                     const ::com::sun::star::uno::Reference<
144cdf0e10cSrcweir                         ::com::sun::star::chart2::XChartDocument > & xDoc,
145cdf0e10cSrcweir                     sal_Int32 nCoordinateSystemIndex,
146cdf0e10cSrcweir                     const ::rtl::OUString & rChartTypeName,
147cdf0e10cSrcweir                     bool bPushLastChartType = false );
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     static void DeleteDataSeries(
150cdf0e10cSrcweir                     const ::com::sun::star::uno::Reference<
151cdf0e10cSrcweir                         ::com::sun::star::chart2::XDataSeries >& xSeries,
152cdf0e10cSrcweir                     const ::com::sun::star::uno::Reference<
153cdf0e10cSrcweir                         ::com::sun::star::chart2::XChartDocument > & xDoc );
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
156cdf0e10cSrcweir             ::com::sun::star::chart2::data::XLabeledDataSequence > GetNewLabeledDataSequence();
157cdf0e10cSrcweir };
158cdf0e10cSrcweir 
159cdf0e10cSrcweir #endif	// _XMLOFF_SCH_XMLIMPORTHELPER_HXX_
160