1ecfe53c5SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3ecfe53c5SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4ecfe53c5SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5ecfe53c5SAndrew Rist  * distributed with this work for additional information
6ecfe53c5SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7ecfe53c5SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8ecfe53c5SAndrew Rist  * "License"); you may not use this file except in compliance
9ecfe53c5SAndrew Rist  * with the License.  You may obtain a copy of the License at
10ecfe53c5SAndrew Rist  *
11ecfe53c5SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12ecfe53c5SAndrew Rist  *
13ecfe53c5SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14ecfe53c5SAndrew Rist  * software distributed under the License is distributed on an
15ecfe53c5SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ecfe53c5SAndrew Rist  * KIND, either express or implied.  See the License for the
17ecfe53c5SAndrew Rist  * specific language governing permissions and limitations
18ecfe53c5SAndrew Rist  * under the License.
19ecfe53c5SAndrew Rist  *
20ecfe53c5SAndrew Rist  *************************************************************/
21ecfe53c5SAndrew Rist 
22ecfe53c5SAndrew Rist 
23cdf0e10cSrcweir #ifndef _SCH_XMLCHARTCONTEXT_HXX_
24cdf0e10cSrcweir #define _SCH_XMLCHARTCONTEXT_HXX_
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <xmloff/xmlictxt.hxx>
27cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
28cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp>
29cdf0e10cSrcweir #include <com/sun/star/chart/ChartDataRowSource.hpp>
30cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp>
31cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include "transporttypes.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <list>
36cdf0e10cSrcweir #include <map>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir class SchXMLImport;
39cdf0e10cSrcweir class SchXMLImportHelper;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir namespace com { namespace sun { namespace star {
42cdf0e10cSrcweir 	namespace chart {
43cdf0e10cSrcweir 		class XChartDocument;
44cdf0e10cSrcweir 		class XDiagram;
45cdf0e10cSrcweir 		struct ChartSeriesAddress;
46cdf0e10cSrcweir 	}
47cdf0e10cSrcweir 	namespace util {
48cdf0e10cSrcweir 		class XStringMapping;
49cdf0e10cSrcweir 	}
50cdf0e10cSrcweir 	namespace xml { namespace sax {
51cdf0e10cSrcweir 		class XAttributeList;
52cdf0e10cSrcweir     }}
53cdf0e10cSrcweir     namespace drawing {
54cdf0e10cSrcweir         class XShapes;
55cdf0e10cSrcweir     }
56cdf0e10cSrcweir }}}
57cdf0e10cSrcweir 
58cdf0e10cSrcweir // ----------------------------------------
59cdf0e10cSrcweir 
60cdf0e10cSrcweir struct SeriesDefaultsAndStyles
61cdf0e10cSrcweir {
62cdf0e10cSrcweir     //default values for series:
63cdf0e10cSrcweir     ::com::sun::star::uno::Any    maSymbolTypeDefault;
64cdf0e10cSrcweir     ::com::sun::star::uno::Any    maDataCaptionDefault;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     ::com::sun::star::uno::Any    maErrorIndicatorDefault;
67cdf0e10cSrcweir     ::com::sun::star::uno::Any    maErrorCategoryDefault;
68cdf0e10cSrcweir     ::com::sun::star::uno::Any    maConstantErrorLowDefault;
69cdf0e10cSrcweir     ::com::sun::star::uno::Any    maConstantErrorHighDefault;
70cdf0e10cSrcweir     ::com::sun::star::uno::Any    maPercentageErrorDefault;
71cdf0e10cSrcweir     ::com::sun::star::uno::Any    maErrorMarginDefault;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     ::com::sun::star::uno::Any    maMeanValueDefault;
74cdf0e10cSrcweir     ::com::sun::star::uno::Any    maRegressionCurvesDefault;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     ::com::sun::star::uno::Any    maStackedDefault;
77cdf0e10cSrcweir     ::com::sun::star::uno::Any    maPercentDefault;
78cdf0e10cSrcweir     ::com::sun::star::uno::Any    maDeepDefault;
79cdf0e10cSrcweir     ::com::sun::star::uno::Any    maStackedBarsConnectedDefault;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     //additional information
82cdf0e10cSrcweir     ::com::sun::star::uno::Any    maLinesOnProperty;
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     //styles for series and datapoints
85cdf0e10cSrcweir     ::std::list< DataRowPointStyle > maSeriesStyleList;
86cdf0e10cSrcweir };
87cdf0e10cSrcweir 
88cdf0e10cSrcweir class SchXMLChartContext : public SvXMLImportContext
89cdf0e10cSrcweir {
90cdf0e10cSrcweir public:
91cdf0e10cSrcweir 	SchXMLChartContext( SchXMLImportHelper& rImpHelper,
92cdf0e10cSrcweir 						SvXMLImport& rImport, const rtl::OUString& rLocalName );
93cdf0e10cSrcweir 	virtual ~SchXMLChartContext();
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	virtual void StartElement( const com::sun::star::uno::Reference<
96cdf0e10cSrcweir 							   	  com::sun::star::xml::sax::XAttributeList >& xAttrList );
97cdf0e10cSrcweir 	virtual void EndElement();
98cdf0e10cSrcweir 	virtual SvXMLImportContext *CreateChildContext(
99cdf0e10cSrcweir 		sal_uInt16 nPrefix,
100cdf0e10cSrcweir 		const rtl::OUString& rLocalName,
101cdf0e10cSrcweir 		const com::sun::star::uno::Reference<
102cdf0e10cSrcweir 			com::sun::star::xml::sax::XAttributeList >& xAttrList );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir private:
105cdf0e10cSrcweir 	SchXMLTable maTable;
106cdf0e10cSrcweir 	SchXMLImportHelper& mrImportHelper;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	::rtl::OUString maMainTitle, maSubTitle;
109cdf0e10cSrcweir 	com::sun::star::awt::Point maMainTitlePos, maSubTitlePos, maLegendPos;
110cdf0e10cSrcweir     ::rtl::OUString m_aXLinkHRefAttributeToIndicateDataProvider;
111cdf0e10cSrcweir     bool m_bHasRangeAtPlotArea;
112cdf0e10cSrcweir     bool m_bHasTableElement;
113cdf0e10cSrcweir     sal_Bool mbAllRangeAddressesAvailable;
114cdf0e10cSrcweir     sal_Bool mbColHasLabels;
115cdf0e10cSrcweir     sal_Bool mbRowHasLabels;
116cdf0e10cSrcweir     ::com::sun::star::chart::ChartDataRowSource meDataRowSource;
117cdf0e10cSrcweir     bool mbIsStockChart;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	com::sun::star::uno::Sequence< com::sun::star::chart::ChartSeriesAddress > maSeriesAddresses;
120cdf0e10cSrcweir 	::rtl::OUString msCategoriesAddress;
121cdf0e10cSrcweir     ::rtl::OUString msChartAddress;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     SeriesDefaultsAndStyles maSeriesDefaultsAndStyles;
124cdf0e10cSrcweir     tSchXMLLSequencesPerIndex maLSequencesPerIndex;
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxDrawPage;
127cdf0e10cSrcweir     ::rtl::OUString msColTrans;
128cdf0e10cSrcweir     ::rtl::OUString msRowTrans;
129cdf0e10cSrcweir     ::rtl::OUString maChartTypeServiceName;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     ::com::sun::star::awt::Size maChartSize;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	/**	@descr	This method bundles some settings to the chart model and executes them with
134cdf0e10cSrcweir 			a locked controller.  This includes setting the chart type.
135cdf0e10cSrcweir 		@param	aServiceName The name of the service the diagram is initialized with.
136*940681c7SMatthias Seidel 		@param	bSetWitchData	Indicates whether the data set takes it's data series from
137cdf0e10cSrcweir 			rows or from columns.
138cdf0e10cSrcweir 	*/
139cdf0e10cSrcweir 	void	InitChart	(const ::rtl::OUString & rChartTypeServiceName,
140cdf0e10cSrcweir 						sal_Bool bSetSwitchData);
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     void MergeSeriesForStockChart();
143cdf0e10cSrcweir };
144cdf0e10cSrcweir 
145cdf0e10cSrcweir // ----------------------------------------
146cdf0e10cSrcweir 
147cdf0e10cSrcweir class SchXMLTitleContext : public SvXMLImportContext
148cdf0e10cSrcweir {
149cdf0e10cSrcweir private:
150cdf0e10cSrcweir 	SchXMLImportHelper& mrImportHelper;
151cdf0e10cSrcweir 	rtl::OUString& mrTitle;
152cdf0e10cSrcweir 	com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxTitleShape;
153cdf0e10cSrcweir 	rtl::OUString msAutoStyleName;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir public:
156cdf0e10cSrcweir 	SchXMLTitleContext( SchXMLImportHelper& rImpHelper,
157cdf0e10cSrcweir 						SvXMLImport& rImport, const rtl::OUString& rLocalName,
158cdf0e10cSrcweir 						rtl::OUString& rTitle,
159cdf0e10cSrcweir 						com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xTitleShape );
160cdf0e10cSrcweir 	virtual ~SchXMLTitleContext();
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	virtual void StartElement( const com::sun::star::uno::Reference<
163cdf0e10cSrcweir 							   com::sun::star::xml::sax::XAttributeList >& xAttrList );
164cdf0e10cSrcweir 	virtual SvXMLImportContext *CreateChildContext(
165cdf0e10cSrcweir 		sal_uInt16 nPrefix,
166cdf0e10cSrcweir 		const rtl::OUString& rLocalName,
167cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
168cdf0e10cSrcweir };
169cdf0e10cSrcweir 
170cdf0e10cSrcweir #endif	// _SCH_XMLCHARTCONTEXT_HXX_
171