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 "transporttypes.hxx"
22 #include "SchXMLChartContext.hxx"
23 #include <xmloff/xmlictxt.hxx>
24 #include <xmloff/SchXMLImportHelper.hxx>
25 #include <xmloff/xmlstyle.hxx>
29 namespace com::sun::star
{
39 // class for child contexts: series, data point and statistics objects
40 class SchXMLSeries2Context
: public SvXMLImportContext
43 SchXMLImportHelper
& mrImportHelper
;
44 css::uno::Reference
< css::chart2::XChartDocument
> mxNewDoc
;
45 ::std::vector
< SchXMLAxis
>& mrAxes
;
46 ::std::vector
< DataRowPointStyle
>& mrStyleVector
;
47 ::std::vector
< RegressionStyle
>& mrRegressionStyleVector
;
48 css::uno::Reference
< css::chart2::XDataSeries
> m_xSeries
;
49 sal_Int32 mnSeriesIndex
;
50 sal_Int32 mnDataPointIndex
;
51 bool m_bStockHasVolume
;
53 GlobalSeriesImportInfo
& m_rGlobalSeriesImportInfo
;
55 SchXMLAxis
* mpAttachedAxis
;
56 sal_Int32 mnAttachedAxis
;
57 OUString msAutoStyleName
;
58 ::std::vector
< OUString
> maDomainAddresses
;
59 OUString maGlobalChartTypeName
;
60 OUString maSeriesChartTypeName
;
61 OUString m_aSeriesRange
;
62 bool m_bHasDomainContext
;
63 tSchXMLLSequencesPerIndex
& mrLSequencesPerIndex
;
64 tSchXMLLSequencesPerIndex maPostponedSequences
;
65 bool& mrGlobalChartTypeUsedBySeries
;
66 bool mbSymbolSizeIsMissingInFile
;
67 css::awt::Size maChartSize
;
68 // We let the series manage the DataRowPointStyle-struct of its data label
69 DataRowPointStyle mDataLabel
;
72 SchXMLSeries2Context( SchXMLImportHelper
& rImpHelper
,
74 const css::uno::Reference
< css::chart2::XChartDocument
> & xNewDoc
,
75 std::vector
< SchXMLAxis
>& rAxes
,
76 ::std::vector
< DataRowPointStyle
>& rStyleVector
,
77 ::std::vector
< RegressionStyle
>& rRegressionStyleVector
,
78 sal_Int32 nSeriesIndex
,
80 GlobalSeriesImportInfo
& rGlobalSeriesImportInfo
,
81 const OUString
& aGlobalChartTypeName
,
82 tSchXMLLSequencesPerIndex
& rLSequencesPerIndex
,
83 bool& rGlobalChartTypeUsedBySeries
,
84 const css::awt::Size
& rChartSize
);
85 virtual ~SchXMLSeries2Context() override
;
87 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
89 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
90 virtual void SAL_CALL
startFastElement(
92 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
93 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
95 static void initSeriesPropertySets( SeriesDefaultsAndStyles
& rSeriesDefaultsAndStyles
96 , const css::uno::Reference
< css::frame::XModel
>& xChartModel
);
98 static void setDefaultsToSeries( SeriesDefaultsAndStyles
& rSeriesDefaultsAndStyles
);
100 static void setStylesToSeries( SeriesDefaultsAndStyles
& rSeriesDefaultsAndStyles
101 , const SvXMLStylesContext
* pStylesCtxt
102 , const SvXMLStyleContext
*& rpStyle
103 , OUString
& rCurrStyleName
104 , const SchXMLImportHelper
& rImportHelper
105 , const SvXMLImport
& rImport
107 , tSchXMLLSequencesPerIndex
& rInOutLSequencesPerIndex
);
109 static void setStylesToStatisticsObjects( SeriesDefaultsAndStyles
& rSeriesDefaultsAndStyles
110 , const SvXMLStylesContext
* pStylesCtxt
111 , const SvXMLStyleContext
*& rpStyle
112 , OUString
&rCurrStyleName
);
114 static void setStylesToRegressionCurves(
115 SeriesDefaultsAndStyles
& rSeriesDefaultsAndStyles
,
116 const SvXMLStylesContext
* pStylesCtxt
,
117 const SvXMLStyleContext
*& rpStyle
,
118 OUString
const &rCurrStyleName
);
120 static void setStylesToDataPoints( SeriesDefaultsAndStyles
& rSeriesDefaultsAndStyles
121 , const SvXMLStylesContext
* pStylesCtxt
122 , const SvXMLStyleContext
*& rpStyle
123 , OUString
& rCurrStyleName
124 , const SchXMLImportHelper
& rImportHelper
125 , const SvXMLImport
& rImport
126 , bool bIsStockChart
, bool bIsDonutChart
, bool bSwitchOffLinesForScatter
);
128 static void switchSeriesLinesOff( ::std::vector
< DataRowPointStyle
>& rSeriesStyleVector
);
131 // INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLSERIES2CONTEXT_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */