Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLPLOTAREACONTEXT_HXX
20 : #define INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLPLOTAREACONTEXT_HXX
21 :
22 : #include "SchXMLImport.hxx"
23 : #include "SchXMLChartContext.hxx"
24 : #include <xmloff/xmlictxt.hxx>
25 : #include <xmloff/shapeimport.hxx>
26 : #include <com/sun/star/chart/ChartDataRowSource.hpp>
27 :
28 : #include "transporttypes.hxx"
29 :
30 : class SvXMLImport;
31 :
32 : namespace com { namespace sun { namespace star {
33 : namespace chart {
34 : class XDiagram;
35 : class X3DDisplay;
36 : class XStatisticDisplay;
37 : }
38 : namespace chart2 {
39 : class XChartDocument;
40 : }
41 : namespace xml { namespace sax {
42 : class XAttributeList;
43 : }}}}}
44 :
45 : class SchXML3DSceneAttributesHelper : public SdXML3DSceneAttributesHelper
46 : {
47 : public:
48 : explicit SchXML3DSceneAttributesHelper( SvXMLImport& rImporter );
49 : virtual ~SchXML3DSceneAttributesHelper();
50 :
51 : void getCameraDefaultFromDiagram( const ::com::sun::star::uno::Reference< com::sun::star::chart::XDiagram >& xDiagram );
52 :
53 : private:
54 : SchXML3DSceneAttributesHelper();
55 : };
56 :
57 : class SchXMLPositonAttributesHelper
58 : {
59 : public:
60 : explicit SchXMLPositonAttributesHelper( SvXMLImport& rImporter );
61 : ~SchXMLPositonAttributesHelper();
62 :
63 : bool readPositioningAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue );
64 : void readAutomaticPositioningProperties( XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt );
65 :
66 : bool hasPosSize() const;
67 : bool isAutomatic() const;
68 4 : ::com::sun::star::awt::Rectangle getRectangle() const { return css::awt::Rectangle( m_aPosition.X, m_aPosition.Y, m_aSize.Width, m_aSize.Height );}
69 :
70 : private:
71 : bool hasSize() const;
72 : bool hasPosition() const;
73 :
74 : SvXMLImport& m_rImport;
75 :
76 : ::com::sun::star::awt::Point m_aPosition;
77 : ::com::sun::star::awt::Size m_aSize;
78 :
79 : bool m_bHasSizeWidth;
80 : bool m_bHasSizeHeight;
81 : bool m_bHasPositionX;
82 : bool m_bHasPositionY;
83 : bool m_bAutoSize;
84 : bool m_bAutoPosition;
85 : };
86 :
87 : class SchXMLPlotAreaContext : public SvXMLImportContext
88 : {
89 : public:
90 : SchXMLPlotAreaContext( SchXMLImportHelper& rImpHelper,
91 : SvXMLImport& rImport, const OUString& rLocalName,
92 : const OUString& rXLinkHRefAttributeToIndicateDataProvider,
93 : OUString& rCategoriesAddress,
94 : OUString& rChartAddress,
95 : bool& bHasRangeAtPlotArea,
96 : bool & rAllRangeAddressesAvailable,
97 : bool & rColHasLabels,
98 : bool & rRowHasLabels,
99 : ::com::sun::star::chart::ChartDataRowSource & rDataRowSource,
100 : SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles,
101 : const OUString& aChartTypeServiceName,
102 : tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
103 : const ::com::sun::star::awt::Size & rChartSize );
104 : virtual ~SchXMLPlotAreaContext();
105 :
106 : virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
107 : virtual SvXMLImportContext* CreateChildContext(
108 : sal_uInt16 nPrefix,
109 : const OUString& rLocalName,
110 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
111 : virtual void EndElement() SAL_OVERRIDE;
112 :
113 : private:
114 : SchXMLImportHelper& mrImportHelper;
115 : ::com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram;
116 : ::com::sun::star::uno::Reference< com::sun::star::chart2::XChartDocument > mxNewDoc;
117 : ::std::vector< SchXMLAxis > maAxes;
118 : OUString& mrCategoriesAddress;
119 : SeriesDefaultsAndStyles& mrSeriesDefaultsAndStyles;
120 : sal_Int32 mnNumOfLinesProp;
121 : bool mbStockHasVolume;
122 : sal_Int32 mnSeries;
123 : GlobalSeriesImportInfo m_aGlobalSeriesImportInfo;
124 :
125 : SchXML3DSceneAttributesHelper maSceneImportHelper;
126 : SchXMLPositonAttributesHelper m_aOuterPositioning;//including axes and axes titles
127 : SchXMLPositonAttributesHelper m_aInnerPositioning;//excluding axes and axes titles
128 : bool mbPercentStacked;
129 : bool m_bAxisPositionAttributeImported;
130 : OUString msAutoStyleName;
131 : const OUString& m_rXLinkHRefAttributeToIndicateDataProvider;
132 : OUString& mrChartAddress;
133 : bool& m_rbHasRangeAtPlotArea;
134 : bool & mrColHasLabels;
135 : bool & mrRowHasLabels;
136 : ::com::sun::star::chart::ChartDataRowSource & mrDataRowSource;
137 : OUString maChartTypeServiceName;
138 :
139 : tSchXMLLSequencesPerIndex & mrLSequencesPerIndex;
140 :
141 : bool mbGlobalChartTypeUsedBySeries;
142 : ::com::sun::star::awt::Size maChartSize;
143 : };
144 :
145 : class SchXMLDataPointContext : public SvXMLImportContext
146 : {
147 : private:
148 : ::std::list< DataRowPointStyle >& mrStyleList;
149 : ::com::sun::star::uno::Reference<
150 : ::com::sun::star::chart2::XDataSeries > m_xSeries;
151 : sal_Int32& mrIndex;
152 : bool mbSymbolSizeForSeriesIsMissingInFile;
153 :
154 : public:
155 : SchXMLDataPointContext( SvXMLImport& rImport, const OUString& rLocalName,
156 : ::std::list< DataRowPointStyle >& rStyleList,
157 : const ::com::sun::star::uno::Reference<
158 : ::com::sun::star::chart2::XDataSeries >& xSeries, sal_Int32& rIndex,
159 : bool bSymbolSizeForSeriesIsMissingInFile );
160 : virtual ~SchXMLDataPointContext();
161 :
162 : virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
163 : };
164 :
165 : class SchXMLCoordinateRegionContext : public SvXMLImportContext
166 : {
167 : public:
168 : SchXMLCoordinateRegionContext(
169 : SvXMLImport& rImport
170 : , sal_uInt16 nPrefix
171 : , const OUString& rLocalName
172 : , SchXMLPositonAttributesHelper& rPositioning );
173 : virtual ~SchXMLCoordinateRegionContext();
174 : virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
175 :
176 : private:
177 : SchXMLPositonAttributesHelper& m_rPositioning;
178 : };
179 :
180 : class SchXMLWallFloorContext : public SvXMLImportContext
181 : {
182 : public:
183 : enum ContextType
184 : {
185 : CONTEXT_TYPE_WALL,
186 : CONTEXT_TYPE_FLOOR
187 : };
188 :
189 : private:
190 : SchXMLImportHelper& mrImportHelper;
191 : ::com::sun::star::uno::Reference< ::com::sun::star::chart::X3DDisplay > mxWallFloorSupplier;
192 : ContextType meContextType;
193 :
194 : public:
195 : SchXMLWallFloorContext( SchXMLImportHelper& rImportHelper,
196 : SvXMLImport& rImport,
197 : sal_uInt16 nPrefix,
198 : const OUString& rLocalName,
199 : ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram >& xDiagram,
200 : ContextType eContextType );
201 : virtual ~SchXMLWallFloorContext();
202 : virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
203 : };
204 :
205 : class SchXMLStockContext : public SvXMLImportContext
206 : {
207 : public:
208 : enum ContextType
209 : {
210 : CONTEXT_TYPE_GAIN,
211 : CONTEXT_TYPE_LOSS,
212 : CONTEXT_TYPE_RANGE
213 : };
214 :
215 : private:
216 : SchXMLImportHelper& mrImportHelper;
217 : ::com::sun::star::uno::Reference< ::com::sun::star::chart::XStatisticDisplay > mxStockPropProvider;
218 : ContextType meContextType;
219 :
220 : public:
221 : SchXMLStockContext( SchXMLImportHelper& rImportHelper,
222 : SvXMLImport& rImport,
223 : sal_uInt16 nPrefix,
224 : const OUString& rLocalName,
225 : ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram >& xDiagram,
226 : ContextType eContextType );
227 : virtual ~SchXMLStockContext();
228 : virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
229 : };
230 :
231 : class SchXMLStatisticsObjectContext : public SvXMLImportContext
232 : {
233 : public:
234 : enum ContextType
235 : {
236 : CONTEXT_TYPE_MEAN_VALUE_LINE,
237 : CONTEXT_TYPE_ERROR_INDICATOR
238 : };
239 :
240 : SchXMLStatisticsObjectContext(
241 : SchXMLImportHelper& rImportHelper,
242 : SvXMLImport& rImport,
243 : sal_uInt16 nPrefix,
244 : const OUString& rLocalName,
245 : const OUString &rSeriesStyleName,
246 : ::std::list< DataRowPointStyle >& rStyleList,
247 : const ::com::sun::star::uno::Reference<
248 : ::com::sun::star::chart2::XDataSeries >& xSeries,
249 : ContextType eContextType,
250 : const ::com::sun::star::awt::Size & rChartSize,
251 : tSchXMLLSequencesPerIndex & rLSequencesPerIndex );
252 :
253 : virtual ~SchXMLStatisticsObjectContext();
254 :
255 : virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
256 : virtual SvXMLImportContext* CreateChildContext(
257 : sal_uInt16 nPrefix,
258 : const OUString& rLocalName,
259 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
260 :
261 : private:
262 : SchXMLImportHelper & mrImportHelper;
263 : ::std::list< DataRowPointStyle > & mrStyleList;
264 : ::com::sun::star::uno::Reference<
265 : ::com::sun::star::chart2::XDataSeries > m_xSeries;
266 : ContextType meContextType;
267 : ::com::sun::star::awt::Size maChartSize;
268 : OUString maSeriesStyleName;
269 : tSchXMLLSequencesPerIndex& mrLSequencesPerIndex;
270 : };
271 :
272 : #endif // INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLPLOTAREACONTEXT_HXX
273 :
274 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|