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