/src/libreoffice/xmloff/source/chart/SchXMLPlotAreaContext.hxx
Line | Count | Source |
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 | | #pragma once |
20 | | |
21 | | #include "SchXMLChartContext.hxx" |
22 | | #include <rtl/ustrbuf.hxx> |
23 | | #include <xmloff/xmlictxt.hxx> |
24 | | #include <xmloff/prstylei.hxx> |
25 | | #include <xmloff/shapeimport.hxx> |
26 | | #include <com/sun/star/awt/Rectangle.hpp> |
27 | | #include <com/sun/star/chart/ChartDataRowSource.hpp> |
28 | | |
29 | | #include "transporttypes.hxx" |
30 | | |
31 | | class SvXMLImport; |
32 | | |
33 | | namespace com::sun::star { |
34 | | namespace chart { |
35 | | class XDiagram; |
36 | | class X3DDisplay; |
37 | | class XStatisticDisplay; |
38 | | } |
39 | | namespace chart2 { |
40 | | class XChartDocument; |
41 | | } |
42 | | } |
43 | | |
44 | | class SchXML3DSceneAttributesHelper : public SdXML3DSceneAttributesHelper |
45 | | { |
46 | | public: |
47 | | explicit SchXML3DSceneAttributesHelper( SvXMLImport& rImporter ); |
48 | | virtual ~SchXML3DSceneAttributesHelper(); |
49 | | |
50 | | void getCameraDefaultFromDiagram( const css::uno::Reference< css::chart::XDiagram >& xDiagram ); |
51 | | }; |
52 | | |
53 | | class SchXMLPositionAttributesHelper |
54 | | { |
55 | | public: |
56 | | explicit SchXMLPositionAttributesHelper( SvXMLImport& rImporter ); |
57 | | |
58 | | void readPositioningAttribute( sal_Int32 nAttributeToken, std::string_view rValue ); |
59 | | void readAutomaticPositioningProperties( XMLPropStyleContext const * pPropStyleContext, const SvXMLStylesContext* pStylesCtxt ); |
60 | | |
61 | | bool hasPosSize() const; |
62 | | bool isAutomatic() const; |
63 | 0 | css::awt::Rectangle getRectangle() const { return css::awt::Rectangle( m_aPosition.X, m_aPosition.Y, m_aSize.Width, m_aSize.Height );} |
64 | | |
65 | | private: |
66 | | SvXMLImport& m_rImport; |
67 | | |
68 | | css::awt::Point m_aPosition; |
69 | | css::awt::Size m_aSize; |
70 | | |
71 | | bool m_bHasSizeWidth; |
72 | | bool m_bHasSizeHeight; |
73 | | bool m_bHasPositionX; |
74 | | bool m_bHasPositionY; |
75 | | bool m_bAutoSize; |
76 | | bool m_bAutoPosition; |
77 | | }; |
78 | | |
79 | | class SchXMLPlotAreaContext : public SvXMLImportContext |
80 | | { |
81 | | public: |
82 | | SchXMLPlotAreaContext( SchXMLImportHelper& rImpHelper, |
83 | | SvXMLImport& rImport, |
84 | | const OUString& rXLinkHRefAttributeToIndicateDataProvider, |
85 | | OUString& rCategoriesAddress, |
86 | | OUString& rChartAddress, |
87 | | bool& bHasRangeAtPlotArea, |
88 | | bool & rAllRangeAddressesAvailable, |
89 | | bool & rColHasLabels, |
90 | | bool & rRowHasLabels, |
91 | | css::chart::ChartDataRowSource & rDataRowSource, |
92 | | SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles, |
93 | | OUString aChartTypeServiceName, |
94 | | tSchXMLLSequencesPerIndex & rLSequencesPerIndex, |
95 | | const css::awt::Size & rChartSize ); |
96 | | virtual ~SchXMLPlotAreaContext() override; |
97 | | |
98 | | virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( |
99 | | sal_Int32 nElement, |
100 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; |
101 | | virtual void SAL_CALL startFastElement( |
102 | | sal_Int32 nElement, |
103 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; |
104 | | virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; |
105 | | |
106 | | private: |
107 | | SchXMLImportHelper& mrImportHelper; |
108 | | css::uno::Reference< css::chart::XDiagram > mxDiagram; |
109 | | css::uno::Reference< css::chart2::XChartDocument > mxNewDoc; |
110 | | ::std::vector< SchXMLAxis > maAxes; |
111 | | OUString& mrCategoriesAddress; |
112 | | SeriesDefaultsAndStyles& mrSeriesDefaultsAndStyles; |
113 | | sal_Int32 mnNumOfLinesProp; |
114 | | bool mbStockHasVolume; |
115 | | sal_Int32 mnSeries; |
116 | | GlobalSeriesImportInfo m_aGlobalSeriesImportInfo; |
117 | | |
118 | | SchXML3DSceneAttributesHelper maSceneImportHelper; |
119 | | SchXMLPositionAttributesHelper m_aOuterPositioning;//including axes and axes titles |
120 | | SchXMLPositionAttributesHelper m_aInnerPositioning;//excluding axes and axes titles |
121 | | bool mbPercentStacked; |
122 | | bool m_bAxisPositionAttributeImported; |
123 | | OUString msAutoStyleName; |
124 | | const OUString& m_rXLinkHRefAttributeToIndicateDataProvider; |
125 | | OUString& mrChartAddress; |
126 | | bool& m_rbHasRangeAtPlotArea; |
127 | | bool & mrColHasLabels; |
128 | | bool & mrRowHasLabels; |
129 | | css::chart::ChartDataRowSource & mrDataRowSource; |
130 | | OUString maChartTypeServiceName; |
131 | | |
132 | | tSchXMLLSequencesPerIndex & mrLSequencesPerIndex; |
133 | | |
134 | | bool mbGlobalChartTypeUsedBySeries; |
135 | | css::awt::Size maChartSize; |
136 | | }; |
137 | | |
138 | | class SchXMLDataLabelSpanContext: public SvXMLImportContext |
139 | | { |
140 | | private: |
141 | | ::std::vector<OUString>& mrLabels; |
142 | | OUStringBuffer maCharBuffer; |
143 | | public: |
144 | | SchXMLDataLabelSpanContext( SvXMLImport& rImport, ::std::vector<OUString>& rLabels); |
145 | | virtual void SAL_CALL characters( const OUString& rChars ) override; |
146 | | virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; |
147 | | }; |
148 | | |
149 | | class SchXMLDataLabelParaContext: public SvXMLImportContext |
150 | | { |
151 | | private: |
152 | | ::std::vector<OUString>& mrLabels; |
153 | | public: |
154 | | SchXMLDataLabelParaContext( SvXMLImport& rImport, ::std::vector<OUString>& rLabels); |
155 | | virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( |
156 | | sal_Int32 nElement, |
157 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; |
158 | | }; |
159 | | |
160 | | class SchXMLDataLabelContext: public SvXMLImportContext |
161 | | { |
162 | | private: |
163 | | CustomLabelsInfo& mrLabels; |
164 | | DataRowPointStyle& mrDataLabelStyle; |
165 | | public: |
166 | | SchXMLDataLabelContext(SvXMLImport& rImport, |
167 | | CustomLabelsInfo& rLabels, DataRowPointStyle& rDataLabel); |
168 | | |
169 | | virtual void SAL_CALL startFastElement( |
170 | | sal_Int32 nElement, |
171 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; |
172 | | |
173 | | virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( |
174 | | sal_Int32 nElement, |
175 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; |
176 | | }; |
177 | | |
178 | | class SchXMLDataPointContext : public SvXMLImportContext |
179 | | { |
180 | | private: |
181 | | ::std::vector<DataRowPointStyle>& mrStyleVector; |
182 | | bool mbHasLabelParagraph = false; |
183 | | sal_Int32& mrIndex; |
184 | | DataRowPointStyle mDataPoint; |
185 | | // We let the data point manage the DataRowPointStyle-struct of its data label |
186 | | DataRowPointStyle mDataLabel; |
187 | | |
188 | | public: |
189 | | SchXMLDataPointContext( SvXMLImport& rImport, |
190 | | ::std::vector< DataRowPointStyle >& rStyleVector, |
191 | | const css::uno::Reference< css::chart2::XDataSeries >& xSeries, |
192 | | sal_Int32& rIndex, |
193 | | bool bSymbolSizeForSeriesIsMissingInFile ); |
194 | | virtual ~SchXMLDataPointContext() override; |
195 | | |
196 | | virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( |
197 | | sal_Int32 nElement, |
198 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; |
199 | | virtual void SAL_CALL startFastElement( |
200 | | sal_Int32 nElement, |
201 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; |
202 | | virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; |
203 | | }; |
204 | | |
205 | | class SchXMLCoordinateRegionContext : public SvXMLImportContext |
206 | | { |
207 | | public: |
208 | | SchXMLCoordinateRegionContext( |
209 | | SvXMLImport& rImport |
210 | | , SchXMLPositionAttributesHelper& rPositioning ); |
211 | | virtual ~SchXMLCoordinateRegionContext() override; |
212 | | virtual void SAL_CALL startFastElement( |
213 | | sal_Int32 nElement, |
214 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; |
215 | | |
216 | | private: |
217 | | SchXMLPositionAttributesHelper& m_rPositioning; |
218 | | }; |
219 | | |
220 | | class SchXMLWallFloorContext : public SvXMLImportContext |
221 | | { |
222 | | public: |
223 | | enum ContextType |
224 | | { |
225 | | CONTEXT_TYPE_WALL, |
226 | | CONTEXT_TYPE_FLOOR |
227 | | }; |
228 | | |
229 | | private: |
230 | | SchXMLImportHelper& mrImportHelper; |
231 | | css::uno::Reference< css::chart::X3DDisplay > mxWallFloorSupplier; |
232 | | ContextType meContextType; |
233 | | |
234 | | public: |
235 | | SchXMLWallFloorContext( SchXMLImportHelper& rImportHelper, |
236 | | SvXMLImport& rImport, |
237 | | css::uno::Reference< css::chart::XDiagram > const & xDiagram, |
238 | | ContextType eContextType ); |
239 | | virtual ~SchXMLWallFloorContext() override; |
240 | | virtual void SAL_CALL startFastElement (sal_Int32 Element, |
241 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs) override; |
242 | | }; |
243 | | |
244 | | class SchXMLStockContext : public SvXMLImportContext |
245 | | { |
246 | | public: |
247 | | enum ContextType |
248 | | { |
249 | | CONTEXT_TYPE_GAIN, |
250 | | CONTEXT_TYPE_LOSS, |
251 | | CONTEXT_TYPE_RANGE |
252 | | }; |
253 | | |
254 | | private: |
255 | | SchXMLImportHelper& mrImportHelper; |
256 | | css::uno::Reference< css::chart::XStatisticDisplay > mxStockPropProvider; |
257 | | ContextType meContextType; |
258 | | |
259 | | public: |
260 | | SchXMLStockContext( SchXMLImportHelper& rImportHelper, |
261 | | SvXMLImport& rImport, |
262 | | css::uno::Reference< css::chart::XDiagram > const & xDiagram, |
263 | | ContextType eContextType ); |
264 | | virtual ~SchXMLStockContext() override; |
265 | | virtual void SAL_CALL startFastElement (sal_Int32 Element, |
266 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs) override; |
267 | | }; |
268 | | |
269 | | class SchXMLStatisticsObjectContext : public SvXMLImportContext |
270 | | { |
271 | | public: |
272 | | enum ContextType |
273 | | { |
274 | | CONTEXT_TYPE_MEAN_VALUE_LINE, |
275 | | CONTEXT_TYPE_ERROR_INDICATOR |
276 | | }; |
277 | | |
278 | | SchXMLStatisticsObjectContext( |
279 | | SchXMLImportHelper& rImportHelper, |
280 | | SvXMLImport& rImport, |
281 | | OUString aSeriesStyleName, |
282 | | ::std::vector< DataRowPointStyle >& rStyleVector, |
283 | | css::uno::Reference< css::chart2::XDataSeries > xSeries, |
284 | | ContextType eContextType, |
285 | | tSchXMLLSequencesPerIndex & rLSequencesPerIndex ); |
286 | | |
287 | | virtual ~SchXMLStatisticsObjectContext() override; |
288 | | |
289 | | virtual void SAL_CALL startFastElement (sal_Int32 Element, |
290 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs) override; |
291 | | |
292 | | private: |
293 | | SchXMLImportHelper & mrImportHelper; |
294 | | ::std::vector< DataRowPointStyle > & mrStyleVector; |
295 | | css::uno::Reference< css::chart2::XDataSeries > m_xSeries; |
296 | | ContextType meContextType; |
297 | | OUString maSeriesStyleName; |
298 | | tSchXMLLSequencesPerIndex& mrLSequencesPerIndex; |
299 | | }; |
300 | | |
301 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |