xref: /AOO41X/main/xmloff/source/chart/SchXMLChartContext.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef _SCH_XMLCHARTCONTEXT_HXX_
28*cdf0e10cSrcweir #define _SCH_XMLCHARTCONTEXT_HXX_
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <xmloff/xmlictxt.hxx>
31*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
32*cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/chart/ChartDataRowSource.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp>
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir #include "transporttypes.hxx"
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <list>
40*cdf0e10cSrcweir #include <map>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir class SchXMLImport;
43*cdf0e10cSrcweir class SchXMLImportHelper;
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir namespace com { namespace sun { namespace star {
46*cdf0e10cSrcweir 	namespace chart {
47*cdf0e10cSrcweir 		class XChartDocument;
48*cdf0e10cSrcweir 		class XDiagram;
49*cdf0e10cSrcweir 		struct ChartSeriesAddress;
50*cdf0e10cSrcweir 	}
51*cdf0e10cSrcweir 	namespace util {
52*cdf0e10cSrcweir 		class XStringMapping;
53*cdf0e10cSrcweir 	}
54*cdf0e10cSrcweir 	namespace xml { namespace sax {
55*cdf0e10cSrcweir 		class XAttributeList;
56*cdf0e10cSrcweir     }}
57*cdf0e10cSrcweir     namespace drawing {
58*cdf0e10cSrcweir         class XShapes;
59*cdf0e10cSrcweir     }
60*cdf0e10cSrcweir }}}
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir // ----------------------------------------
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir struct SeriesDefaultsAndStyles
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir     //default values for series:
67*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maSymbolTypeDefault;
68*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maDataCaptionDefault;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maErrorIndicatorDefault;
71*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maErrorCategoryDefault;
72*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maConstantErrorLowDefault;
73*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maConstantErrorHighDefault;
74*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maPercentageErrorDefault;
75*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maErrorMarginDefault;
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maMeanValueDefault;
78*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maRegressionCurvesDefault;
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maStackedDefault;
81*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maPercentDefault;
82*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maDeepDefault;
83*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maStackedBarsConnectedDefault;
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir     //additional information
86*cdf0e10cSrcweir     ::com::sun::star::uno::Any    maLinesOnProperty;
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir     //styles for series and datapoints
89*cdf0e10cSrcweir     ::std::list< DataRowPointStyle > maSeriesStyleList;
90*cdf0e10cSrcweir };
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir class SchXMLChartContext : public SvXMLImportContext
93*cdf0e10cSrcweir {
94*cdf0e10cSrcweir public:
95*cdf0e10cSrcweir 	SchXMLChartContext( SchXMLImportHelper& rImpHelper,
96*cdf0e10cSrcweir 						SvXMLImport& rImport, const rtl::OUString& rLocalName );
97*cdf0e10cSrcweir 	virtual ~SchXMLChartContext();
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 	virtual void StartElement( const com::sun::star::uno::Reference<
100*cdf0e10cSrcweir 							   	  com::sun::star::xml::sax::XAttributeList >& xAttrList );
101*cdf0e10cSrcweir 	virtual void EndElement();
102*cdf0e10cSrcweir 	virtual SvXMLImportContext *CreateChildContext(
103*cdf0e10cSrcweir 		sal_uInt16 nPrefix,
104*cdf0e10cSrcweir 		const rtl::OUString& rLocalName,
105*cdf0e10cSrcweir 		const com::sun::star::uno::Reference<
106*cdf0e10cSrcweir 			com::sun::star::xml::sax::XAttributeList >& xAttrList );
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir private:
109*cdf0e10cSrcweir 	SchXMLTable maTable;
110*cdf0e10cSrcweir 	SchXMLImportHelper& mrImportHelper;
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	::rtl::OUString maMainTitle, maSubTitle;
113*cdf0e10cSrcweir 	com::sun::star::awt::Point maMainTitlePos, maSubTitlePos, maLegendPos;
114*cdf0e10cSrcweir     ::rtl::OUString m_aXLinkHRefAttributeToIndicateDataProvider;
115*cdf0e10cSrcweir     bool m_bHasRangeAtPlotArea;
116*cdf0e10cSrcweir     bool m_bHasTableElement;
117*cdf0e10cSrcweir     sal_Bool mbAllRangeAddressesAvailable;
118*cdf0e10cSrcweir     sal_Bool mbColHasLabels;
119*cdf0e10cSrcweir     sal_Bool mbRowHasLabels;
120*cdf0e10cSrcweir     ::com::sun::star::chart::ChartDataRowSource meDataRowSource;
121*cdf0e10cSrcweir     bool mbIsStockChart;
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir 	com::sun::star::uno::Sequence< com::sun::star::chart::ChartSeriesAddress > maSeriesAddresses;
124*cdf0e10cSrcweir 	::rtl::OUString msCategoriesAddress;
125*cdf0e10cSrcweir     ::rtl::OUString msChartAddress;
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir     SeriesDefaultsAndStyles maSeriesDefaultsAndStyles;
128*cdf0e10cSrcweir     tSchXMLLSequencesPerIndex maLSequencesPerIndex;
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxDrawPage;
131*cdf0e10cSrcweir     ::rtl::OUString msColTrans;
132*cdf0e10cSrcweir     ::rtl::OUString msRowTrans;
133*cdf0e10cSrcweir     ::rtl::OUString maChartTypeServiceName;
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir     ::com::sun::star::awt::Size maChartSize;
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir 	/**	@descr	This method bundles some settings to the chart model and executes them with
138*cdf0e10cSrcweir 			a locked controller.  This includes setting the chart type.
139*cdf0e10cSrcweir 		@param	aServiceName The name of the service the diagram is initialized with.
140*cdf0e10cSrcweir 		@param	bSetWitchData	Indicates wether the data set takes it's data series from
141*cdf0e10cSrcweir 			rows or from columns.
142*cdf0e10cSrcweir 	*/
143*cdf0e10cSrcweir 	void	InitChart	(const ::rtl::OUString & rChartTypeServiceName,
144*cdf0e10cSrcweir 						sal_Bool bSetSwitchData);
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir     void MergeSeriesForStockChart();
147*cdf0e10cSrcweir };
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir // ----------------------------------------
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir class SchXMLTitleContext : public SvXMLImportContext
152*cdf0e10cSrcweir {
153*cdf0e10cSrcweir private:
154*cdf0e10cSrcweir 	SchXMLImportHelper& mrImportHelper;
155*cdf0e10cSrcweir 	rtl::OUString& mrTitle;
156*cdf0e10cSrcweir 	com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxTitleShape;
157*cdf0e10cSrcweir 	rtl::OUString msAutoStyleName;
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir public:
160*cdf0e10cSrcweir 	SchXMLTitleContext( SchXMLImportHelper& rImpHelper,
161*cdf0e10cSrcweir 						SvXMLImport& rImport, const rtl::OUString& rLocalName,
162*cdf0e10cSrcweir 						rtl::OUString& rTitle,
163*cdf0e10cSrcweir 						com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xTitleShape );
164*cdf0e10cSrcweir 	virtual ~SchXMLTitleContext();
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 	virtual void StartElement( const com::sun::star::uno::Reference<
167*cdf0e10cSrcweir 							   com::sun::star::xml::sax::XAttributeList >& xAttrList );
168*cdf0e10cSrcweir 	virtual SvXMLImportContext *CreateChildContext(
169*cdf0e10cSrcweir 		sal_uInt16 nPrefix,
170*cdf0e10cSrcweir 		const rtl::OUString& rLocalName,
171*cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
172*cdf0e10cSrcweir };
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir #endif	// _SCH_XMLCHARTCONTEXT_HXX_
175