fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / view / inc / VDataSeries.hxx
blob1cc5ee46fa876c4879af2e6d789b2aa49fe8d1f5
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/DataPointLabel.hpp>
25 #include <com/sun/star/chart2/Symbol.hpp>
26 #include <com/sun/star/chart2/StackingDirection.hpp>
27 #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
28 #include <com/sun/star/chart2/XChartType.hpp>
29 #include <com/sun/star/chart2/XDataSeries.hpp>
30 #include <com/sun/star/drawing/HomogenMatrix.hpp>
31 #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
32 #include <com/sun/star/drawing/XShape.hpp>
33 #include <com/sun/star/drawing/XShapes.hpp>
34 #include <cppuhelper/weakref.hxx>
36 #include <vector>
37 #include <boost/noncopyable.hpp>
38 #include <boost/scoped_ptr.hpp>
39 #include <boost/ptr_container/ptr_map.hpp>
41 namespace chart
44 class VDataSequence
46 public:
47 void init( const css::uno::Reference<css::chart2::data::XDataSequence>& xModel );
48 bool is() const;
49 void clear();
50 double getValue( sal_Int32 index ) const;
51 sal_Int32 detectNumberFormatKey( sal_Int32 index ) const;
52 sal_Int32 getLength() const;
54 css::uno::Reference<css::chart2::data::XDataSequence> Model;
56 mutable css::uno::Sequence<double> Doubles;
59 class VDataSeries SAL_FINAL : boost::noncopyable
61 public:
62 VDataSeries( const css::uno::Reference<css::chart2::XDataSeries>& xDataSeries );
64 ~VDataSeries();
66 css::uno::Reference<css::chart2::XDataSeries> getModel() const;
68 void setCategoryXAxis();
69 void setXValues( const css::uno::Reference<css::chart2::data::XDataSequence>& xValues );
70 void setXValuesIfNone( const css::uno::Reference<css::chart2::data::XDataSequence>& xValues );
71 void setParticle( const OUString& rSeriesParticle );
72 void setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex );
73 void setPageReferenceSize( const css::awt::Size & rPageRefSize );
75 sal_Int32 getTotalPointCount() const { return m_nPointCount;}
76 double getXValue( sal_Int32 index ) const;
77 double getYValue( sal_Int32 index ) const;
79 void getMinMaxXValue( double& fMin, double& fMax ) const;
81 double getY_Min( sal_Int32 index ) const;
82 double getY_Max( sal_Int32 index ) const;
83 double getY_First( sal_Int32 index ) const;
84 double getY_Last( sal_Int32 index ) const;
86 double getBubble_Size( sal_Int32 index ) const;
88 double getMinimumofAllDifferentYValues( sal_Int32 index ) const;
89 double getMaximumofAllDifferentYValues( sal_Int32 index ) const;
91 double getValueByProperty( sal_Int32 index, const OUString& rPropName ) const;
93 bool hasPropertyMapping( const OUString& rPropName ) const;
95 css::uno::Sequence< double > getAllX() const;
96 css::uno::Sequence< double > getAllY() const;
98 double getXMeanValue() const;
99 double getYMeanValue() const;
101 bool hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
102 sal_Int32 getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
103 sal_Int32 detectNumberFormatKey( sal_Int32 nPointIndex ) const;
104 bool shouldLabelNumberFormatKeyBeDetectedFromYAxis() const;
106 sal_Int32 getLabelPlacement(
107 sal_Int32 nPointIndex, const css::uno::Reference<css::chart2::XChartType>& xChartType,
108 sal_Int32 nDimensionCount, bool bSwapXAndY ) const;
110 css::uno::Reference<css::beans::XPropertySet> getPropertiesOfPoint( sal_Int32 index ) const;
112 css::uno::Reference<css::beans::XPropertySet> getPropertiesOfSeries() const;
114 css::chart2::Symbol* getSymbolProperties( sal_Int32 index ) const;
116 css::uno::Reference<css::beans::XPropertySet> getXErrorBarProperties( sal_Int32 index ) const;
118 css::uno::Reference<css::beans::XPropertySet> getYErrorBarProperties( sal_Int32 index ) const;
120 bool hasPointOwnColor( sal_Int32 index ) const;
122 css::chart2::StackingDirection getStackingDirection() const;
123 sal_Int32 getAttachedAxisIndex() const;
124 void setAttachedAxisIndex( sal_Int32 nAttachedAxisIndex );
126 void doSortByXValues();
128 void setConnectBars( bool bConnectBars );
129 bool getConnectBars() const;
131 void setGroupBarsPerAxis( bool bGroupBarsPerAxis );
132 bool getGroupBarsPerAxis() const;
134 void setStartingAngle( sal_Int32 nStartingAngle );
135 sal_Int32 getStartingAngle() const;
137 void setRoleOfSequenceForDataLabelNumberFormatDetection( const OUString& rRole );
139 //this is only temporarily here for area chart:
140 css::drawing::PolyPolygonShape3D m_aPolyPolygonShape3D;
141 sal_Int32 m_nPolygonIndex;
142 double m_fLogicMinX;
143 double m_fLogicMaxX;
145 //this is here for deep stacking:
146 double m_fLogicZPos;//from 0 to series count -1
148 OUString getCID() const { return m_aCID;}
149 OUString getSeriesParticle() const { return m_aSeriesParticle;}
150 OUString getPointCID_Stub() const { return m_aPointCID_Stub;}
151 OUString getErrorBarsCID( bool bYError ) const;
152 OUString getLabelsCID() const;
153 OUString getLabelCID_Stub() const { return m_aLabelCID_Stub;}
154 OUString getDataCurveCID( sal_Int32 nCurveIndex, bool bAverageLine ) const;
156 css::chart2::DataPointLabel* getDataPointLabelIfLabel( sal_Int32 index ) const;
157 bool getTextLabelMultiPropertyLists( sal_Int32 index, tNameSequence*& pPropNames, tAnySequence*& pPropValues ) const;
159 OUString getDataCurveEquationCID( sal_Int32 nCurveIndex ) const;
160 bool isAttributedDataPoint( sal_Int32 index ) const;
162 bool isVaryColorsByPoint() const;
164 void releaseShapes();
166 void setMissingValueTreatment( sal_Int32 nMissingValueTreatment );
167 sal_Int32 getMissingValueTreatment() const;
169 void setOldTimeBased( VDataSeries* pOldSeries, double nPercent );
170 VDataSeries* createCopyForTimeBased() const;
172 private: //methods
173 css::chart2::DataPointLabel* getDataPointLabel( sal_Int32 index ) const;
174 void adaptPointCache( sal_Int32 nNewPointIndex ) const;
176 // for copies for time based charting
177 VDataSeries();
179 public: //member
180 css::uno::Reference<css::drawing::XShapes> m_xGroupShape;
181 css::uno::Reference<css::drawing::XShapes> m_xLabelsGroupShape;
182 css::uno::Reference<css::drawing::XShapes> m_xErrorXBarsGroupShape;
183 css::uno::Reference<css::drawing::XShapes> m_xErrorYBarsGroupShape;
185 //the following group shapes will be created as children of m_xGroupShape on demand
186 //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)
187 css::uno::Reference<css::drawing::XShapes> m_xFrontSubGroupShape;
188 css::uno::Reference<css::drawing::XShapes> m_xBackSubGroupShape;
190 private: //member
191 css::uno::Reference<css::chart2::XDataSeries> m_xDataSeries;
193 //all points given by the model data (here are not only the visible points meant)
194 sal_Int32 m_nPointCount;
196 VDataSequence m_aValues_X;
197 VDataSequence m_aValues_Y;
198 VDataSequence m_aValues_Z;
200 VDataSequence m_aValues_Y_Min;
201 VDataSequence m_aValues_Y_Max;
202 VDataSequence m_aValues_Y_First;
203 VDataSequence m_aValues_Y_Last;
205 VDataSequence m_aValues_Bubble_Size;
207 VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection;
209 boost::ptr_map<OUString, VDataSequence> maPropertyMap;
211 mutable double m_fXMeanValue;
212 mutable double m_fYMeanValue;
214 css::uno::Sequence<sal_Int32> m_aAttributedDataPointIndexList;
216 css::chart2::StackingDirection m_eStackingDirection;
218 sal_Int32 m_nAxisIndex;//indicates whether this is attached to a main or secondary axis
220 bool m_bConnectBars;
222 bool m_bGroupBarsPerAxis;
224 sal_Int32 m_nStartingAngle;
226 OUString m_aSeriesParticle;
227 OUString m_aCID;
228 OUString m_aPointCID_Stub;
229 OUString m_aLabelCID_Stub;
231 sal_Int32 m_nGlobalSeriesIndex;
233 //some cached values for data labels as they are very expensive
234 mutable boost::scoped_ptr<css::chart2::DataPointLabel>
235 m_apLabel_Series;
236 mutable boost::scoped_ptr<tNameSequence> m_apLabelPropNames_Series;
237 mutable boost::scoped_ptr<tAnySequence> m_apLabelPropValues_Series;
238 mutable boost::scoped_ptr<css::chart2::Symbol> m_apSymbolProperties_Series;
240 mutable boost::scoped_ptr<css::chart2::DataPointLabel>
241 m_apLabel_AttributedPoint;
242 mutable boost::scoped_ptr<tNameSequence> m_apLabelPropNames_AttributedPoint;
243 mutable boost::scoped_ptr<tAnySequence> m_apLabelPropValues_AttributedPoint;
244 mutable boost::scoped_ptr<css::chart2::Symbol> m_apSymbolProperties_AttributedPoint;
245 mutable boost::scoped_ptr<css::chart2::Symbol>
246 m_apSymbolProperties_InvisibleSymbolForSelection;
247 mutable sal_Int32 m_nCurrentAttributedPoint;
248 css::awt::Size m_aReferenceSize;
250 sal_Int32 m_nMissingValueTreatment;
251 bool m_bAllowPercentValueInDataLabel;
253 // for time based charting
254 VDataSeries* mpOldSeries;
255 double mnPercent;
258 } //namespace chart
259 #endif
261 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */