Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / chart2 / source / view / inc / VDataSeries.hxx
blob4a20eb79bfeae24bf3453e2370ab5b4ecdc54e23
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_VDATASERIES_HXX
20 #define INCLUDED_CHART2_SOURCE_VIEW_INC_VDATASERIES_HXX
22 #include "PropertyMapper.hxx"
24 #include <com/sun/star/chart2/StackingDirection.hpp>
25 #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
26 #include <com/sun/star/awt/Size.hpp>
28 #include <memory>
29 #include <map>
31 namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
32 namespace com { namespace sun { namespace star { namespace chart2 { class XChartType; } } } }
33 namespace com { namespace sun { namespace star { namespace chart2 { class XDataSeries; } } } }
34 namespace com { namespace sun { namespace star { namespace chart2 { namespace data { class XDataSequence; } } } } }
35 namespace com { namespace sun { namespace star { namespace chart2 { struct DataPointLabel; } } } }
36 namespace com { namespace sun { namespace star { namespace chart2 { struct Symbol; } } } }
37 namespace com { namespace sun { namespace star { namespace drawing { class XShapes; } } } }
39 namespace chart
42 class VDataSequence
44 public:
45 void init( const css::uno::Reference<css::chart2::data::XDataSequence>& xModel );
46 bool is() const;
47 void clear();
48 double getValue( sal_Int32 index ) const;
49 sal_Int32 detectNumberFormatKey( sal_Int32 index ) const;
50 sal_Int32 getLength() const;
52 css::uno::Reference<css::chart2::data::XDataSequence> Model;
54 mutable css::uno::Sequence<double> Doubles;
57 class VDataSeries final
59 public:
60 VDataSeries( const css::uno::Reference<css::chart2::XDataSeries>& xDataSeries );
62 ~VDataSeries();
64 VDataSeries(const VDataSeries&) = delete;
65 const VDataSeries& operator=(const VDataSeries&) = delete;
67 const css::uno::Reference<css::chart2::XDataSeries>& getModel() const;
69 void setCategoryXAxis();
70 void setXValues( const css::uno::Reference<css::chart2::data::XDataSequence>& xValues );
71 void setXValuesIfNone( const css::uno::Reference<css::chart2::data::XDataSequence>& xValues );
72 void setParticle( const OUString& rSeriesParticle );
73 void setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex );
74 void setPageReferenceSize( const css::awt::Size & rPageRefSize );
76 sal_Int32 getTotalPointCount() const { return m_nPointCount;}
77 double getXValue( sal_Int32 index ) const;
78 double getYValue( sal_Int32 index ) const;
80 void getMinMaxXValue( double& fMin, double& fMax ) const;
82 double getY_Min( sal_Int32 index ) const;
83 double getY_Max( sal_Int32 index ) const;
84 double getY_First( sal_Int32 index ) const;
85 double getY_Last( sal_Int32 index ) const;
87 double getBubble_Size( sal_Int32 index ) const;
89 double getMinimumofAllDifferentYValues( sal_Int32 index ) const;
90 double getMaximumofAllDifferentYValues( sal_Int32 index ) const;
92 double getValueByProperty( sal_Int32 index, const OUString& rPropName ) const;
94 bool hasPropertyMapping( const OUString& rPropName ) const;
96 css::uno::Sequence< double > const & getAllX() const;
97 css::uno::Sequence< double > const & getAllY() const;
99 double getXMeanValue() const;
100 double getYMeanValue() const;
102 bool hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
103 sal_Int32 getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
104 sal_Int32 detectNumberFormatKey( sal_Int32 nPointIndex ) const;
105 bool shouldLabelNumberFormatKeyBeDetectedFromYAxis() const;
107 sal_Int32 getLabelPlacement(
108 sal_Int32 nPointIndex, const css::uno::Reference<css::chart2::XChartType>& xChartType,
109 bool bSwapXAndY ) const;
111 css::uno::Reference<css::beans::XPropertySet> getPropertiesOfPoint( sal_Int32 index ) const;
113 css::uno::Reference<css::beans::XPropertySet> getPropertiesOfSeries() const;
115 css::chart2::Symbol* getSymbolProperties( sal_Int32 index ) const;
117 css::uno::Reference<css::beans::XPropertySet> getXErrorBarProperties( sal_Int32 index ) const;
119 css::uno::Reference<css::beans::XPropertySet> getYErrorBarProperties( sal_Int32 index ) const;
121 bool hasPointOwnColor( sal_Int32 index ) const;
123 css::chart2::StackingDirection getStackingDirection() const;
124 sal_Int32 getAttachedAxisIndex() const;
125 void setAttachedAxisIndex( sal_Int32 nAttachedAxisIndex );
127 void doSortByXValues();
129 void setConnectBars( bool bConnectBars );
130 bool getConnectBars() const;
132 void setGroupBarsPerAxis( bool bGroupBarsPerAxis );
133 bool getGroupBarsPerAxis() const;
135 void setStartingAngle( sal_Int32 nStartingAngle );
136 sal_Int32 getStartingAngle() const;
138 void setRoleOfSequenceForDataLabelNumberFormatDetection( const OUString& rRole );
140 //this is only temporarily here for area chart:
141 css::drawing::PolyPolygonShape3D m_aPolyPolygonShape3D;
142 sal_Int32 m_nPolygonIndex;
143 double m_fLogicMinX;
144 double m_fLogicMaxX;
146 //this is here for deep stacking:
147 double m_fLogicZPos;//from 0 to series count -1
149 const OUString& getCID() const { return m_aCID;}
150 const OUString& getSeriesParticle() const { return m_aSeriesParticle;}
151 const OUString& getPointCID_Stub() const { return m_aPointCID_Stub;}
152 OUString getErrorBarsCID( bool bYError ) const;
153 OUString getLabelsCID() const;
154 const OUString& getLabelCID_Stub() const { return m_aLabelCID_Stub;}
155 OUString getDataCurveCID( sal_Int32 nCurveIndex, bool bAverageLine ) const;
157 css::chart2::DataPointLabel* getDataPointLabelIfLabel( sal_Int32 index ) const;
158 bool getTextLabelMultiPropertyLists( sal_Int32 index, tNameSequence*& pPropNames, tAnySequence*& pPropValues ) const;
160 OUString getDataCurveEquationCID( sal_Int32 nCurveIndex ) const;
161 bool isAttributedDataPoint( sal_Int32 index ) const;
163 bool isVaryColorsByPoint() const;
165 void releaseShapes();
167 void setMissingValueTreatment( sal_Int32 nMissingValueTreatment );
168 sal_Int32 getMissingValueTreatment() const;
170 void setOldTimeBased( VDataSeries* pOldSeries, double nPercent );
171 VDataSeries* createCopyForTimeBased() const;
173 private: //methods
174 css::chart2::DataPointLabel* getDataPointLabel( sal_Int32 index ) const;
175 void adaptPointCache( sal_Int32 nNewPointIndex ) const;
177 // for copies for time based charting
178 VDataSeries();
180 public: //member
181 css::uno::Reference<css::drawing::XShapes> m_xGroupShape;
182 css::uno::Reference<css::drawing::XShapes> m_xLabelsGroupShape;
183 css::uno::Reference<css::drawing::XShapes> m_xErrorXBarsGroupShape;
184 css::uno::Reference<css::drawing::XShapes> m_xErrorYBarsGroupShape;
186 //the following group shapes will be created as children of m_xGroupShape on demand
187 //they can be used to assure that some parts of a series shape are always in front of others (e.g. symbols in front of lines)
188 css::uno::Reference<css::drawing::XShapes> m_xFrontSubGroupShape;
189 css::uno::Reference<css::drawing::XShapes> m_xBackSubGroupShape;
191 private: //member
192 css::uno::Reference<css::chart2::XDataSeries> m_xDataSeries;
194 //all points given by the model data (here are not only the visible points meant)
195 sal_Int32 m_nPointCount;
197 VDataSequence m_aValues_X;
198 VDataSequence m_aValues_Y;
199 VDataSequence m_aValues_Z;
201 VDataSequence m_aValues_Y_Min;
202 VDataSequence m_aValues_Y_Max;
203 VDataSequence m_aValues_Y_First;
204 VDataSequence m_aValues_Y_Last;
206 VDataSequence m_aValues_Bubble_Size;
208 VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection;
210 std::map<OUString, VDataSequence> m_PropertyMap;
212 mutable double m_fXMeanValue;
213 mutable double m_fYMeanValue;
215 css::uno::Sequence<sal_Int32> m_aAttributedDataPointIndexList;
217 css::chart2::StackingDirection m_eStackingDirection;
219 sal_Int32 m_nAxisIndex;//indicates whether this is attached to a main or secondary axis
221 bool m_bConnectBars;
223 bool m_bGroupBarsPerAxis;
225 sal_Int32 m_nStartingAngle;
227 OUString m_aSeriesParticle;
228 OUString m_aCID;
229 OUString m_aPointCID_Stub;
230 OUString m_aLabelCID_Stub;
232 sal_Int32 m_nGlobalSeriesIndex;
234 //some cached values for data labels as they are very expensive
235 mutable std::unique_ptr<css::chart2::DataPointLabel>
236 m_apLabel_Series;
237 mutable std::unique_ptr<tNameSequence> m_apLabelPropNames_Series;
238 mutable std::unique_ptr<tAnySequence> m_apLabelPropValues_Series;
239 mutable std::unique_ptr<css::chart2::Symbol> m_apSymbolProperties_Series;
241 mutable std::unique_ptr<css::chart2::DataPointLabel>
242 m_apLabel_AttributedPoint;
243 mutable std::unique_ptr<tNameSequence> m_apLabelPropNames_AttributedPoint;
244 mutable std::unique_ptr<tAnySequence> m_apLabelPropValues_AttributedPoint;
245 mutable std::unique_ptr<css::chart2::Symbol> m_apSymbolProperties_AttributedPoint;
246 mutable std::unique_ptr<css::chart2::Symbol>
247 m_apSymbolProperties_InvisibleSymbolForSelection;
248 mutable sal_Int32 m_nCurrentAttributedPoint;
249 css::awt::Size m_aReferenceSize;
251 sal_Int32 m_nMissingValueTreatment;
252 bool m_bAllowPercentValueInDataLabel;
254 // for time based charting
255 VDataSeries* mpOldSeries;
256 double mnPercent;
259 } //namespace chart
260 #endif
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */