1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SchXMLPlotAreaContext.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SCH_XMLPLOTAREACONTEXT_HXX_
31 #define _SCH_XMLPLOTAREACONTEXT_HXX_
33 #include "SchXMLImport.hxx"
34 #include "SchXMLChartContext.hxx"
35 #include <xmloff/xmlictxt.hxx>
36 #include <xmloff/shapeimport.hxx>
37 #include <com/sun/star/uno/Sequence.hxx>
38 #include <com/sun/star/chart/ChartSeriesAddress.hpp>
39 #include <com/sun/star/chart/ChartDataRowSource.hpp>
41 #include "transporttypes.hxx"
45 namespace com
{ namespace sun
{ namespace star
{
49 class XStatisticDisplay
;
54 namespace xml
{ namespace sax
{
58 // ----------------------------------------
60 class SchXML3DSceneAttributesHelper
: public SdXML3DSceneAttributesHelper
63 SchXML3DSceneAttributesHelper( SvXMLImport
& rImporter
);
64 virtual ~SchXML3DSceneAttributesHelper();
66 void getCameraDefaultFromDiagram( const ::com::sun::star::uno::Reference
< com::sun::star::chart::XDiagram
>& xDiagram
);
69 SchXML3DSceneAttributesHelper();
72 class SchXMLPlotAreaContext
: public SvXMLImportContext
75 SchXMLPlotAreaContext( SchXMLImportHelper
& rImpHelper
,
76 SvXMLImport
& rImport
, const rtl::OUString
& rLocalName
,
77 const rtl::OUString
& rXLinkHRefAttributeToIndicateDataProvider
,
78 ::com::sun::star::uno::Sequence
<
79 ::com::sun::star::chart::ChartSeriesAddress
>& rSeriesAddresses
,
80 ::rtl::OUString
& rCategoriesAddress
,
81 ::rtl::OUString
& rChartAddress
,
82 bool& bHasRangeAtPlotArea
,
83 sal_Bool
& rAllRangeAddressesAvailable
,
84 sal_Bool
& rColHasLabels
,
85 sal_Bool
& rRowHasLabels
,
86 ::com::sun::star::chart::ChartDataRowSource
& rDataRowSource
,
87 SeriesDefaultsAndStyles
& rSeriesDefaultsAndStyles
,
88 const ::rtl::OUString
& aChartTypeServiceName
,
89 tSchXMLLSequencesPerIndex
& rLSequencesPerIndex
,
90 const ::com::sun::star::awt::Size
& rChartSize
);
91 virtual ~SchXMLPlotAreaContext();
93 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
94 virtual SvXMLImportContext
* CreateChildContext(
96 const rtl::OUString
& rLocalName
,
97 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
98 virtual void EndElement();
100 void CorrectAxisPositions();
103 SchXMLImportHelper
& mrImportHelper
;
104 ::com::sun::star::uno::Reference
< com::sun::star::chart::XDiagram
> mxDiagram
;
105 ::com::sun::star::uno::Reference
< com::sun::star::chart2::XChartDocument
> mxNewDoc
;
106 ::std::vector
< SchXMLAxis
> maAxes
;
107 ::com::sun::star::uno::Sequence
< ::com::sun::star::chart::ChartSeriesAddress
>& mrSeriesAddresses
;
108 rtl::OUString
& mrCategoriesAddress
;
109 SeriesDefaultsAndStyles
& mrSeriesDefaultsAndStyles
;
110 sal_Int32 mnNumOfLinesProp
;
111 sal_Bool mbStockHasVolume
;
113 GlobalSeriesImportInfo m_aGlobalSeriesImportInfo
;
115 SchXML3DSceneAttributesHelper maSceneImportHelper
;
116 ::com::sun::star::awt::Size maSize
;
117 ::com::sun::star::awt::Point maPosition
;
120 bool mbPercentStacked
;
121 bool m_bAxisPositionAttributeImported
;
122 ::rtl::OUString msAutoStyleName
;
123 const ::rtl::OUString
& m_rXLinkHRefAttributeToIndicateDataProvider
;
124 ::rtl::OUString
& mrChartAddress
;
125 bool& m_rbHasRangeAtPlotArea
;
126 sal_Bool
& mrColHasLabels
;
127 sal_Bool
& mrRowHasLabels
;
128 ::com::sun::star::chart::ChartDataRowSource
& mrDataRowSource
;
129 ::rtl::OUString maChartTypeServiceName
;
131 tSchXMLLSequencesPerIndex
& mrLSequencesPerIndex
;
133 bool mbGlobalChartTypeUsedBySeries
;
134 ::com::sun::star::awt::Size maChartSize
;
137 // ----------------------------------------
139 class SchXMLAxisContext
: public SvXMLImportContext
142 SchXMLImportHelper
& mrImportHelper
;
143 ::com::sun::star::uno::Reference
< ::com::sun::star::chart::XDiagram
> mxDiagram
;
144 SchXMLAxis maCurrentAxis
;
145 std::vector
< SchXMLAxis
>& maAxes
;
146 rtl::OUString msAutoStyleName
;
147 rtl::OUString
& mrCategoriesAddress
;
148 bool mbAddMissingXAxisForNetCharts
; //to correct errors from older versions
149 bool mbAdaptWrongPercentScaleValues
; //to correct errors from older versions
150 bool mbAdaptXAxisOrientationForOld2DBarCharts
; //to correct different behaviour from older versions
151 bool& m_rbAxisPositionAttributeImported
;
153 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> getTitleShape();
154 void CreateGrid( ::rtl::OUString sAutoStyleName
, sal_Bool bIsMajor
);
159 SchXMLAxisContext( SchXMLImportHelper
& rImpHelper
,
160 SvXMLImport
& rImport
, const rtl::OUString
& rLocalName
,
161 ::com::sun::star::uno::Reference
< ::com::sun::star::chart::XDiagram
> xDiagram
,
162 std::vector
< SchXMLAxis
>& aAxes
,
163 ::rtl::OUString
& rCategoriesAddress
,
164 bool bAddMissingXAxisForNetCharts
,
165 bool bAdaptWrongPercentScaleValues
,
166 bool bAdaptXAxisOrientationForOld2DBarCharts
,
167 bool& rbAxisPositionAttributeImported
);
168 virtual ~SchXMLAxisContext();
170 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
171 virtual void EndElement();
172 virtual SvXMLImportContext
* CreateChildContext(
174 const rtl::OUString
& rLocalName
,
175 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
178 //----------------------------------------
180 class SchXMLDataPointContext
: public SvXMLImportContext
183 SchXMLImportHelper
& mrImportHelper
;
184 ::std::list
< DataRowPointStyle
>& mrStyleList
;
185 ::com::sun::star::uno::Reference
<
186 ::com::sun::star::chart2::XDataSeries
> m_xSeries
;
188 bool mbSymbolSizeForSeriesIsMissingInFile
;
191 SchXMLDataPointContext( SchXMLImportHelper
& rImpHelper
,
192 SvXMLImport
& rImport
, const rtl::OUString
& rLocalName
,
193 ::std::list
< DataRowPointStyle
>& rStyleList
,
194 const ::com::sun::star::uno::Reference
<
195 ::com::sun::star::chart2::XDataSeries
>& xSeries
, sal_Int32
& rIndex
,
196 bool bSymbolSizeForSeriesIsMissingInFile
);
197 virtual ~SchXMLDataPointContext();
199 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
202 // ----------------------------------------
204 class SchXMLCategoriesContext
: public SvXMLImportContext
207 SchXMLImportHelper
& mrImportHelper
;
208 rtl::OUString
& mrAddress
;
211 SchXMLCategoriesContext( SchXMLImportHelper
& rImpHelper
,
212 SvXMLImport
& rImport
,
214 const rtl::OUString
& rLocalName
,
215 rtl::OUString
& rAddress
);
216 virtual ~SchXMLCategoriesContext();
217 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
220 // ----------------------------------------
222 class SchXMLWallFloorContext
: public SvXMLImportContext
232 SchXMLImportHelper
& mrImportHelper
;
233 ::com::sun::star::uno::Reference
< ::com::sun::star::chart::X3DDisplay
> mxWallFloorSupplier
;
234 ContextType meContextType
;
237 SchXMLWallFloorContext( SchXMLImportHelper
& rImportHelper
,
238 SvXMLImport
& rImport
,
240 const rtl::OUString
& rLocalName
,
241 ::com::sun::star::uno::Reference
< ::com::sun::star::chart::XDiagram
>& xDiagram
,
242 ContextType eContextType
);
243 virtual ~SchXMLWallFloorContext();
244 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
247 // ----------------------------------------
249 class SchXMLStockContext
: public SvXMLImportContext
260 SchXMLImportHelper
& mrImportHelper
;
261 ::com::sun::star::uno::Reference
< ::com::sun::star::chart::XStatisticDisplay
> mxStockPropProvider
;
262 ContextType meContextType
;
265 SchXMLStockContext( SchXMLImportHelper
& rImportHelper
,
266 SvXMLImport
& rImport
,
268 const rtl::OUString
& rLocalName
,
269 ::com::sun::star::uno::Reference
< ::com::sun::star::chart::XDiagram
>& xDiagram
,
270 ContextType eContextType
);
271 virtual ~SchXMLStockContext();
272 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
275 // ----------------------------------------
277 class SchXMLStatisticsObjectContext
: public SvXMLImportContext
282 CONTEXT_TYPE_MEAN_VALUE_LINE
,
283 CONTEXT_TYPE_REGRESSION_CURVE
,
284 CONTEXT_TYPE_ERROR_INDICATOR
287 SchXMLStatisticsObjectContext(
288 SchXMLImportHelper
& rImportHelper
,
289 SvXMLImport
& rImport
,
291 const rtl::OUString
& rLocalName
,
292 ::std::list
< DataRowPointStyle
>& rStyleList
,
293 const ::com::sun::star::uno::Reference
<
294 ::com::sun::star::chart2::XDataSeries
>& xSeries
,
295 ContextType eContextType
,
296 const ::com::sun::star::awt::Size
& rChartSize
);
298 virtual ~SchXMLStatisticsObjectContext();
300 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
301 virtual SvXMLImportContext
* CreateChildContext(
303 const rtl::OUString
& rLocalName
,
304 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
307 SchXMLImportHelper
& mrImportHelper
;
308 ::std::list
< DataRowPointStyle
> & mrStyleList
;
309 ::com::sun::star::uno::Reference
<
310 ::com::sun::star::chart2::XDataSeries
> m_xSeries
;
311 ContextType meContextType
;
312 ::com::sun::star::awt::Size maChartSize
;
315 // ----------------------------------------
317 class SchXMLEquationContext
: public SvXMLImportContext
320 SchXMLEquationContext(
321 SchXMLImportHelper
& rImportHelper
,
322 SvXMLImport
& rImport
,
324 const rtl::OUString
& rLocalName
,
325 const ::com::sun::star::uno::Reference
<
326 ::com::sun::star::chart2::XDataSeries
>& xSeries
,
327 const ::com::sun::star::awt::Size
& rChartSize
,
328 DataRowPointStyle
& rRegressionStyle
);
330 virtual ~SchXMLEquationContext();
332 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
335 SchXMLImportHelper
& mrImportHelper
;
336 DataRowPointStyle
& mrRegressionStyle
;
337 ::com::sun::star::uno::Reference
<
338 ::com::sun::star::chart2::XDataSeries
> m_xSeries
;
339 ::com::sun::star::awt::Size maChartSize
;
342 #endif // _SCH_XMLPLOTAREACONTEXT_HXX_