1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
29 #include "transporttypes.hxx"
33 namespace com::sun::star
{
37 class XStatisticDisplay
;
47 class SchXML3DSceneAttributesHelper
: public SdXML3DSceneAttributesHelper
50 explicit SchXML3DSceneAttributesHelper( SvXMLImport
& rImporter
);
51 virtual ~SchXML3DSceneAttributesHelper();
53 void getCameraDefaultFromDiagram( const css::uno::Reference
< css::chart::XDiagram
>& xDiagram
);
56 class SchXMLPositionAttributesHelper
59 explicit SchXMLPositionAttributesHelper( SvXMLImport
& rImporter
);
61 void readPositioningAttribute( sal_Int32 nAttributeToken
, std::string_view rValue
);
62 void readAutomaticPositioningProperties( XMLPropStyleContext
const * pPropStyleContext
, const SvXMLStylesContext
* pStylesCtxt
);
64 bool hasPosSize() const;
65 bool isAutomatic() const;
66 css::awt::Rectangle
getRectangle() const { return css::awt::Rectangle( m_aPosition
.X
, m_aPosition
.Y
, m_aSize
.Width
, m_aSize
.Height
);}
69 SvXMLImport
& m_rImport
;
71 css::awt::Point m_aPosition
;
72 css::awt::Size m_aSize
;
75 bool m_bHasSizeHeight
;
82 class SchXMLPlotAreaContext
: public SvXMLImportContext
85 SchXMLPlotAreaContext( SchXMLImportHelper
& rImpHelper
,
87 const OUString
& rXLinkHRefAttributeToIndicateDataProvider
,
88 OUString
& rCategoriesAddress
,
89 OUString
& rChartAddress
,
90 bool& bHasRangeAtPlotArea
,
91 bool & rAllRangeAddressesAvailable
,
94 css::chart::ChartDataRowSource
& rDataRowSource
,
95 SeriesDefaultsAndStyles
& rSeriesDefaultsAndStyles
,
96 OUString aChartTypeServiceName
,
97 tSchXMLLSequencesPerIndex
& rLSequencesPerIndex
,
98 const css::awt::Size
& rChartSize
);
99 virtual ~SchXMLPlotAreaContext() override
;
101 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
103 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
104 virtual void SAL_CALL
startFastElement(
106 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
107 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
110 SchXMLImportHelper
& mrImportHelper
;
111 css::uno::Reference
< css::chart::XDiagram
> mxDiagram
;
112 css::uno::Reference
< css::chart2::XChartDocument
> mxNewDoc
;
113 ::std::vector
< SchXMLAxis
> maAxes
;
114 OUString
& mrCategoriesAddress
;
115 SeriesDefaultsAndStyles
& mrSeriesDefaultsAndStyles
;
116 sal_Int32 mnNumOfLinesProp
;
117 bool mbStockHasVolume
;
119 GlobalSeriesImportInfo m_aGlobalSeriesImportInfo
;
121 SchXML3DSceneAttributesHelper maSceneImportHelper
;
122 SchXMLPositionAttributesHelper m_aOuterPositioning
;//including axes and axes titles
123 SchXMLPositionAttributesHelper m_aInnerPositioning
;//excluding axes and axes titles
124 bool mbPercentStacked
;
125 bool m_bAxisPositionAttributeImported
;
126 OUString msAutoStyleName
;
127 const OUString
& m_rXLinkHRefAttributeToIndicateDataProvider
;
128 OUString
& mrChartAddress
;
129 bool& m_rbHasRangeAtPlotArea
;
130 bool & mrColHasLabels
;
131 bool & mrRowHasLabels
;
132 css::chart::ChartDataRowSource
& mrDataRowSource
;
133 OUString maChartTypeServiceName
;
135 tSchXMLLSequencesPerIndex
& mrLSequencesPerIndex
;
137 bool mbGlobalChartTypeUsedBySeries
;
138 css::awt::Size maChartSize
;
141 class SchXMLDataLabelSpanContext
: public SvXMLImportContext
144 ::std::vector
<OUString
>& mrLabels
;
145 OUStringBuffer maCharBuffer
;
147 SchXMLDataLabelSpanContext( SvXMLImport
& rImport
, ::std::vector
<OUString
>& rLabels
);
148 virtual void SAL_CALL
characters( const OUString
& rChars
) override
;
149 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
152 class SchXMLDataLabelParaContext
: public SvXMLImportContext
155 ::std::vector
<OUString
>& mrLabels
;
157 SchXMLDataLabelParaContext( SvXMLImport
& rImport
, ::std::vector
<OUString
>& rLabels
);
158 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
160 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
163 class SchXMLDataLabelContext
: public SvXMLImportContext
166 CustomLabelsInfo
& mrLabels
;
167 DataRowPointStyle
& mrDataLabelStyle
;
169 SchXMLDataLabelContext(SvXMLImport
& rImport
,
170 CustomLabelsInfo
& rLabels
, DataRowPointStyle
& rDataLabel
);
172 virtual void SAL_CALL
startFastElement(
174 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
176 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
178 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
181 class SchXMLDataPointContext
: public SvXMLImportContext
184 ::std::vector
<DataRowPointStyle
>& mrStyleVector
;
185 bool mbHasLabelParagraph
= false;
187 DataRowPointStyle mDataPoint
;
188 // We let the data point manage the DataRowPointStyle-struct of its data label
189 DataRowPointStyle mDataLabel
;
192 SchXMLDataPointContext( SvXMLImport
& rImport
,
193 ::std::vector
< DataRowPointStyle
>& rStyleVector
,
194 const css::uno::Reference
< css::chart2::XDataSeries
>& xSeries
,
196 bool bSymbolSizeForSeriesIsMissingInFile
);
197 virtual ~SchXMLDataPointContext() override
;
199 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
201 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
202 virtual void SAL_CALL
startFastElement(
204 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
205 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
208 class SchXMLCoordinateRegionContext
: public SvXMLImportContext
211 SchXMLCoordinateRegionContext(
213 , SchXMLPositionAttributesHelper
& rPositioning
);
214 virtual ~SchXMLCoordinateRegionContext() override
;
215 virtual void SAL_CALL
startFastElement(
217 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
220 SchXMLPositionAttributesHelper
& m_rPositioning
;
223 class SchXMLWallFloorContext
: public SvXMLImportContext
233 SchXMLImportHelper
& mrImportHelper
;
234 css::uno::Reference
< css::chart::X3DDisplay
> mxWallFloorSupplier
;
235 ContextType meContextType
;
238 SchXMLWallFloorContext( SchXMLImportHelper
& rImportHelper
,
239 SvXMLImport
& rImport
,
240 css::uno::Reference
< css::chart::XDiagram
> const & xDiagram
,
241 ContextType eContextType
);
242 virtual ~SchXMLWallFloorContext() override
;
243 virtual void SAL_CALL
startFastElement (sal_Int32 Element
,
244 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& Attribs
) override
;
247 class SchXMLStockContext
: public SvXMLImportContext
258 SchXMLImportHelper
& mrImportHelper
;
259 css::uno::Reference
< css::chart::XStatisticDisplay
> mxStockPropProvider
;
260 ContextType meContextType
;
263 SchXMLStockContext( SchXMLImportHelper
& rImportHelper
,
264 SvXMLImport
& rImport
,
265 css::uno::Reference
< css::chart::XDiagram
> const & xDiagram
,
266 ContextType eContextType
);
267 virtual ~SchXMLStockContext() override
;
268 virtual void SAL_CALL
startFastElement (sal_Int32 Element
,
269 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& Attribs
) override
;
272 class SchXMLStatisticsObjectContext
: public SvXMLImportContext
277 CONTEXT_TYPE_MEAN_VALUE_LINE
,
278 CONTEXT_TYPE_ERROR_INDICATOR
281 SchXMLStatisticsObjectContext(
282 SchXMLImportHelper
& rImportHelper
,
283 SvXMLImport
& rImport
,
284 OUString aSeriesStyleName
,
285 ::std::vector
< DataRowPointStyle
>& rStyleVector
,
286 css::uno::Reference
< css::chart2::XDataSeries
> xSeries
,
287 ContextType eContextType
,
288 tSchXMLLSequencesPerIndex
& rLSequencesPerIndex
);
290 virtual ~SchXMLStatisticsObjectContext() override
;
292 virtual void SAL_CALL
startFastElement (sal_Int32 Element
,
293 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& Attribs
) override
;
296 SchXMLImportHelper
& mrImportHelper
;
297 ::std::vector
< DataRowPointStyle
> & mrStyleVector
;
298 css::uno::Reference
< css::chart2::XDataSeries
> m_xSeries
;
299 ContextType meContextType
;
300 OUString maSeriesStyleName
;
301 tSchXMLLSequencesPerIndex
& mrLSequencesPerIndex
;
304 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */