Branch data Line data Source code
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 : : #ifndef _CHART2_VIEW_DATASERIES_HXX
20 : : #define _CHART2_VIEW_DATASERIES_HXX
21 : :
22 : : #include "PropertyMapper.hxx"
23 : :
24 : : #include <vector>
25 : : //for auto_ptr
26 : : #include <memory>
27 : : #include <com/sun/star/chart2/DataPointLabel.hpp>
28 : : #include <com/sun/star/chart2/Symbol.hpp>
29 : : #include <com/sun/star/chart2/StackingDirection.hpp>
30 : : #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
31 : : #include <com/sun/star/chart2/XChartType.hpp>
32 : : #include <com/sun/star/chart2/XDataSeries.hpp>
33 : : #include <com/sun/star/drawing/HomogenMatrix.hpp>
34 : : #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
35 : : #include <com/sun/star/drawing/XShape.hpp>
36 : : #include <com/sun/star/drawing/XShapes.hpp>
37 : : #include <cppuhelper/weakref.hxx>
38 : :
39 : : namespace chart
40 : : {
41 : :
42 [ + - ][ + - ]: 51296 : class VDataSequence
43 : : {
44 : : public:
45 : : void init( const ::com::sun::star::uno::Reference<
46 : : ::com::sun::star::chart2::data::XDataSequence >& xModel );
47 : : bool is() const;
48 : : void clear();
49 : : double getValue( sal_Int32 index ) const;
50 : : sal_Int32 detectNumberFormatKey( sal_Int32 index ) const;
51 : : sal_Int32 getLength() const;
52 : :
53 : :
54 : : ::com::sun::star::uno::Reference<
55 : : ::com::sun::star::chart2::data::XDataSequence > Model;
56 : :
57 : : mutable ::com::sun::star::uno::Sequence< double > Doubles;
58 : : };
59 : :
60 : : class VDataSeries
61 : : {
62 : : public:
63 : : VDataSeries( const ::com::sun::star::uno::Reference<
64 : : ::com::sun::star::chart2::XDataSeries >& xDataSeries );
65 : : virtual ~VDataSeries();
66 : :
67 : : ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >
68 : : getModel() const;
69 : :
70 : : void setCategoryXAxis();
71 : : void setXValues( const ::com::sun::star::uno::Reference<
72 : : ::com::sun::star::chart2::data::XDataSequence >& xValues );
73 : : void setXValuesIfNone( const ::com::sun::star::uno::Reference<
74 : : ::com::sun::star::chart2::data::XDataSequence >& xValues );
75 : : void setParticle( const rtl::OUString& rSeriesParticle );
76 : : void setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex );
77 : : void setPageReferenceSize( const ::com::sun::star::awt::Size & rPageRefSize );
78 : :
79 : : sal_Int32 getTotalPointCount() const;
80 : : double getXValue( sal_Int32 index ) const;
81 : : double getYValue( sal_Int32 index ) const;
82 : :
83 : : double getY_Min( sal_Int32 index ) const;
84 : : double getY_Max( sal_Int32 index ) const;
85 : : double getY_First( sal_Int32 index ) const;
86 : : double getY_Last( sal_Int32 index ) const;
87 : :
88 : : double getBubble_Size( sal_Int32 index ) const;
89 : :
90 : : double getMinimumofAllDifferentYValues( sal_Int32 index ) const;
91 : : double getMaximumofAllDifferentYValues( sal_Int32 index ) const;
92 : :
93 : : ::com::sun::star::uno::Sequence< double > getAllX() const;
94 : : ::com::sun::star::uno::Sequence< double > getAllY() const;
95 : :
96 : : double getXMeanValue() const;
97 : : double getYMeanValue() const;
98 : :
99 : : bool hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
100 : : sal_Int32 getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
101 : : sal_Int32 detectNumberFormatKey( sal_Int32 nPointIndex ) const;
102 : : bool shouldLabelNumberFormatKeyBeDetectedFromYAxis() const;
103 : :
104 : : sal_Int32 getLabelPlacement( sal_Int32 nPointIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType
105 : : , sal_Int32 nDimensionCount, sal_Bool bSwapXAndY ) const;
106 : :
107 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
108 : : getPropertiesOfPoint( sal_Int32 index ) const;
109 : :
110 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
111 : : getPropertiesOfSeries() const;
112 : :
113 : : ::com::sun::star::chart2::Symbol*
114 : : getSymbolProperties( sal_Int32 index ) const;
115 : :
116 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
117 : : getXErrorBarProperties( sal_Int32 index ) const;
118 : :
119 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
120 : : getYErrorBarProperties( sal_Int32 index ) const;
121 : :
122 : : bool hasPointOwnColor( sal_Int32 index ) const;
123 : :
124 : : ::com::sun::star::chart2::StackingDirection getStackingDirection() const;
125 : : sal_Int32 getAttachedAxisIndex() const;
126 : : void setAttachedAxisIndex( sal_Int32 nAttachedAxisIndex );
127 : :
128 : : void doSortByXValues();
129 : :
130 : : void setConnectBars( sal_Bool bConnectBars );
131 : : sal_Bool getConnectBars() const;
132 : :
133 : : void setGroupBarsPerAxis( sal_Bool bGroupBarsPerAxis );
134 : : sal_Bool getGroupBarsPerAxis() const;
135 : :
136 : : void setStartingAngle( sal_Int32 nStartingAngle );
137 : : sal_Int32 getStartingAngle() const;
138 : :
139 : : void setRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::OUString& rRole );
140 : :
141 : : //this is only temporarily here for area chart:
142 : : ::com::sun::star::drawing::PolyPolygonShape3D m_aPolyPolygonShape3D;
143 : : sal_Int32 m_nPolygonIndex;
144 : : double m_fLogicMinX;
145 : : double m_fLogicMaxX;
146 : :
147 : : //this is here for deep stacking:
148 : : double m_fLogicZPos;//from 0 to series count -1
149 : :
150 : : rtl::OUString getCID() const;
151 : : rtl::OUString getSeriesParticle() const;
152 : : rtl::OUString getPointCID_Stub() const;
153 : : rtl::OUString getErrorBarsCID( bool bYError ) const;
154 : : rtl::OUString getLabelsCID() const;
155 : : rtl::OUString getLabelCID_Stub() const;
156 : : rtl::OUString getDataCurveCID( sal_Int32 nCurveIndex, bool bAverageLine ) const;
157 : :
158 : : ::com::sun::star::chart2::DataPointLabel*
159 : : getDataPointLabelIfLabel( sal_Int32 index ) const;
160 : : bool getTextLabelMultiPropertyLists( sal_Int32 index, tNameSequence*& pPropNames, tAnySequence*& pPropValues ) const;
161 : :
162 : : rtl::OUString getDataCurveEquationCID( sal_Int32 nCurveIndex ) const;
163 : : bool isAttributedDataPoint( sal_Int32 index ) const;
164 : :
165 : : bool isVaryColorsByPoint() const;
166 : :
167 : : void releaseShapes();
168 : :
169 : : void setMissingValueTreatment( sal_Int32 nMissingValueTreatment );
170 : : sal_Int32 getMissingValueTreatment() const;
171 : :
172 : : private: //methods
173 : : ::com::sun::star::chart2::DataPointLabel*
174 : : getDataPointLabel( sal_Int32 index ) const;
175 : : void adaptPointCache( sal_Int32 nNewPointIndex ) const;
176 : :
177 : : public: //member
178 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xGroupShape;
179 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xLabelsGroupShape;
180 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xErrorXBarsGroupShape;
181 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xErrorYBarsGroupShape;
182 : :
183 : : //the following group shapes will be created as children of m_xGroupShape on demand
184 : : //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)
185 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xFrontSubGroupShape;
186 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xBackSubGroupShape;
187 : :
188 : : private: //member
189 : : ::com::sun::star::uno::Reference<
190 : : ::com::sun::star::chart2::XDataSeries > m_xDataSeries;
191 : : ::com::sun::star::uno::Sequence<
192 : : ::com::sun::star::uno::Reference<
193 : : ::com::sun::star::chart2::data::XLabeledDataSequence > > m_aDataSequences;
194 : :
195 : : //all points given by the model data (here are not only the visible points meant)
196 : : sal_Int32 m_nPointCount;
197 : :
198 : : VDataSequence m_aValues_X;
199 : : VDataSequence m_aValues_Y;
200 : : VDataSequence m_aValues_Z;
201 : :
202 : : VDataSequence m_aValues_Y_Min;
203 : : VDataSequence m_aValues_Y_Max;
204 : : VDataSequence m_aValues_Y_First;
205 : : VDataSequence m_aValues_Y_Last;
206 : :
207 : : VDataSequence m_aValues_Bubble_Size;
208 : :
209 : : VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection;
210 : :
211 : : mutable double m_fXMeanValue;
212 : : mutable double m_fYMeanValue;
213 : :
214 : : ::com::sun::star::uno::Sequence< sal_Int32 > m_aAttributedDataPointIndexList;
215 : :
216 : : ::com::sun::star::chart2::StackingDirection m_eStackingDirection;
217 : :
218 : : sal_Int32 m_nAxisIndex;//indicates whether this is attached to a main or secondary axis
219 : :
220 : : sal_Bool m_bConnectBars;
221 : :
222 : : sal_Bool m_bGroupBarsPerAxis;
223 : :
224 : : sal_Int32 m_nStartingAngle;
225 : :
226 : : rtl::OUString m_aSeriesParticle;
227 : : rtl::OUString m_aCID;
228 : : rtl::OUString m_aPointCID_Stub;
229 : : rtl::OUString m_aLabelCID_Stub;
230 : :
231 : : sal_Int32 m_nGlobalSeriesIndex;
232 : :
233 : : //some cached values for data labels as they are very expensive
234 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
235 : : mutable ::std::auto_ptr< ::com::sun::star::chart2::DataPointLabel >
236 : : m_apLabel_Series;
237 : : mutable ::std::auto_ptr< tNameSequence > m_apLabelPropNames_Series;
238 : : mutable ::std::auto_ptr< tAnySequence > m_apLabelPropValues_Series;
239 : : mutable ::std::auto_ptr< ::com::sun::star::chart2::Symbol >
240 : : m_apSymbolProperties_Series;
241 : :
242 : : mutable ::std::auto_ptr< ::com::sun::star::chart2::DataPointLabel >
243 : : m_apLabel_AttributedPoint;
244 : : mutable ::std::auto_ptr< tNameSequence > m_apLabelPropNames_AttributedPoint;
245 : : mutable ::std::auto_ptr< tAnySequence > m_apLabelPropValues_AttributedPoint;
246 : : mutable ::std::auto_ptr< ::com::sun::star::chart2::Symbol >
247 : : m_apSymbolProperties_AttributedPoint;
248 : : mutable ::std::auto_ptr< ::com::sun::star::chart2::Symbol >
249 : : m_apSymbolProperties_InvisibleSymbolForSelection;
250 : : SAL_WNODEPRECATED_DECLARATIONS_POP
251 : : mutable sal_Int32 m_nCurrentAttributedPoint;
252 : : ::com::sun::star::awt::Size m_aReferenceSize;
253 : :
254 : : sal_Int32 m_nMissingValueTreatment;
255 : : bool m_bAllowPercentValueInDataLabel;
256 : : };
257 : :
258 : : } //namespace chart
259 : : #endif
260 : :
261 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|