merge the formfield patch from ooo-build
[ooovba.git] / chart2 / source / view / inc / VDataSeries.hxx
blob51c68874dca621080dee13dc814440028b6e90c3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: VDataSeries.hxx,v $
10 * $Revision: 1.21.8.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CHART2_VIEW_DATASERIES_HXX
31 #define _CHART2_VIEW_DATASERIES_HXX
33 #include "PropertyMapper.hxx"
35 #include <vector>
36 //for auto_ptr
37 #include <memory>
38 #include <com/sun/star/chart2/DataPointLabel.hpp>
39 #include <com/sun/star/chart2/Symbol.hpp>
40 #include <com/sun/star/chart2/StackingDirection.hpp>
41 #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
42 #include <com/sun/star/chart2/XChartType.hpp>
43 #include <com/sun/star/chart2/XDataSeries.hpp>
44 #include <com/sun/star/drawing/HomogenMatrix.hpp>
45 #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
46 #include <com/sun/star/drawing/XShape.hpp>
47 #include <com/sun/star/drawing/XShapes.hpp>
48 #include <cppuhelper/weakref.hxx>
50 //.............................................................................
51 namespace chart
53 //.............................................................................
55 //-----------------------------------------------------------------------------
56 /**
58 class VDataSequence
60 public:
61 void init( const ::com::sun::star::uno::Reference<
62 ::com::sun::star::chart2::data::XDataSequence >& xModel );
63 bool is() const;
64 void clear();
65 double getValue( sal_Int32 index ) const;
66 sal_Int32 detectNumberFormatKey( sal_Int32 index ) const;
67 sal_Int32 getLength() const;
70 ::com::sun::star::uno::Reference<
71 ::com::sun::star::chart2::data::XDataSequence > Model;
73 mutable ::com::sun::star::uno::Sequence< double > Doubles;
76 class VDataSeries
78 public:
79 VDataSeries( const ::com::sun::star::uno::Reference<
80 ::com::sun::star::chart2::XDataSeries >& xDataSeries );
81 virtual ~VDataSeries();
83 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >
84 getModel() const;
86 void setCategoryXAxis();
87 void setParticle( const rtl::OUString& rSeriesParticle );
88 void setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex );
89 void setPageReferenceSize( const ::com::sun::star::awt::Size & rPageRefSize );
91 sal_Int32 getTotalPointCount() const;
92 double getXValue( sal_Int32 index ) const;
93 double getYValue( sal_Int32 index ) const;
95 double getY_Min( sal_Int32 index ) const;
96 double getY_Max( sal_Int32 index ) const;
97 double getY_First( sal_Int32 index ) const;
98 double getY_Last( sal_Int32 index ) const;
100 double getBubble_Size( sal_Int32 index ) const;
102 double getMinimumofAllDifferentYValues( sal_Int32 index ) const;
103 double getMaximumofAllDifferentYValues( sal_Int32 index ) const;
105 ::com::sun::star::uno::Sequence< double > getAllX() const;
106 ::com::sun::star::uno::Sequence< double > getAllY() const;
108 double getYMeanValue() const;
110 bool hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
111 sal_Int32 getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
112 sal_Int32 detectNumberFormatKey( sal_Int32 nPointIndex ) const;
113 bool shouldLabelNumberFormatKeyBeDetectedFromYAxis() const;
115 sal_Int32 getLabelPlacement( sal_Int32 nPointIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType
116 , sal_Int32 nDimensionCount, sal_Bool bSwapXAndY ) const;
118 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
119 getPropertiesOfPoint( sal_Int32 index ) const;
121 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
122 getPropertiesOfSeries() const;
124 ::com::sun::star::chart2::Symbol*
125 getSymbolProperties( sal_Int32 index ) const;
127 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
128 getYErrorBarProperties( sal_Int32 index ) const;
130 bool hasPointOwnColor( sal_Int32 index ) const;
132 ::com::sun::star::chart2::StackingDirection getStackingDirection() const;
133 sal_Int32 getAttachedAxisIndex() const;
134 void setAttachedAxisIndex( sal_Int32 nAttachedAxisIndex );
136 void doSortByXValues();
138 void setConnectBars( sal_Bool bConnectBars );
139 sal_Bool getConnectBars() const;
141 void setGroupBarsPerAxis( sal_Bool bGroupBarsPerAxis );
142 sal_Bool getGroupBarsPerAxis() const;
144 void setStartingAngle( sal_Int32 nStartingAngle );
145 sal_Int32 getStartingAngle() const;
147 void setRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::OUString& rRole );
149 //this is only temporarily here for area chart:
150 ::com::sun::star::drawing::PolyPolygonShape3D m_aPolyPolygonShape3D;
151 sal_Int32 m_nPolygonIndex;
152 double m_fLogicMinX;
153 double m_fLogicMaxX;
155 //this is here for deep stacking:
156 double m_fLogicZPos;//from 0 to series count -1
159 rtl::OUString getCID() const;
160 rtl::OUString getSeriesParticle() const;
161 rtl::OUString getPointCID_Stub() const;
162 rtl::OUString getErrorBarsCID() const;
163 rtl::OUString getLabelsCID() const;
164 rtl::OUString getLabelCID_Stub() const;
165 rtl::OUString getDataCurveCID( sal_Int32 nCurveIndex, bool bAverageLine ) const;
167 ::com::sun::star::chart2::DataPointLabel*
168 getDataPointLabelIfLabel( sal_Int32 index ) const;
169 bool getTextLabelMultiPropertyLists( sal_Int32 index, tNameSequence*& pPropNames, tAnySequence*& pPropValues ) const;
171 rtl::OUString getDataCurveEquationCID( sal_Int32 nCurveIndex ) const;
172 bool isAttributedDataPoint( sal_Int32 index ) const;
174 bool isVaryColorsByPoint() const;
176 void releaseShapes();
178 void setMissingValueTreatment( sal_Int32 nMissingValueTreatment );
179 sal_Int32 getMissingValueTreatment() const;
181 private: //methods
182 ::com::sun::star::chart2::DataPointLabel*
183 getDataPointLabel( sal_Int32 index ) const;
184 void adaptPointCache( sal_Int32 nNewPointIndex ) const;
186 public: //member
187 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xGroupShape;
188 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xLabelsGroupShape;
189 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xErrorBarsGroupShape;
191 //the following group shapes will be created as children of m_xGroupShape on demand
192 //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)
193 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xFrontSubGroupShape;
194 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xBackSubGroupShape;
196 private: //member
197 ::com::sun::star::uno::Reference<
198 ::com::sun::star::chart2::XDataSeries > m_xDataSeries;
199 ::com::sun::star::uno::Sequence<
200 ::com::sun::star::uno::Reference<
201 ::com::sun::star::chart2::data::XLabeledDataSequence > > m_aDataSequences;
203 //all points given by the model data (here are not only the visible points meant)
204 sal_Int32 m_nPointCount;
206 VDataSequence m_aValues_X;
207 VDataSequence m_aValues_Y;
208 VDataSequence m_aValues_Z;
210 VDataSequence m_aValues_Y_Min;
211 VDataSequence m_aValues_Y_Max;
212 VDataSequence m_aValues_Y_First;
213 VDataSequence m_aValues_Y_Last;
215 VDataSequence m_aValues_Bubble_Size;
217 VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection;
219 mutable double m_fYMeanValue;
221 ::com::sun::star::uno::Sequence< sal_Int32 > m_aAttributedDataPointIndexList;
223 ::com::sun::star::chart2::StackingDirection m_eStackingDirection;
225 sal_Int32 m_nAxisIndex;//indicates wether this is attached to a main or secondary axis
227 sal_Bool m_bConnectBars;
229 sal_Bool m_bGroupBarsPerAxis;
231 sal_Int32 m_nStartingAngle;
233 rtl::OUString m_aSeriesParticle;
234 rtl::OUString m_aCID;
235 rtl::OUString m_aPointCID_Stub;
236 rtl::OUString m_aLabelCID_Stub;
238 sal_Int32 m_nGlobalSeriesIndex;
240 //some cached values for data labels as they are very expensive
241 mutable ::std::auto_ptr< ::com::sun::star::chart2::DataPointLabel >
242 m_apLabel_Series;
243 mutable ::std::auto_ptr< tNameSequence > m_apLabelPropNames_Series;
244 mutable ::std::auto_ptr< tAnySequence > m_apLabelPropValues_Series;
245 mutable ::std::auto_ptr< ::com::sun::star::chart2::Symbol >
246 m_apSymbolProperties_Series;
248 mutable ::std::auto_ptr< ::com::sun::star::chart2::DataPointLabel >
249 m_apLabel_AttributedPoint;
250 mutable ::std::auto_ptr< tNameSequence > m_apLabelPropNames_AttributedPoint;
251 mutable ::std::auto_ptr< tAnySequence > m_apLabelPropValues_AttributedPoint;
252 mutable ::std::auto_ptr< ::com::sun::star::chart2::Symbol >
253 m_apSymbolProperties_AttributedPoint;
254 mutable ::std::auto_ptr< ::com::sun::star::chart2::Symbol >
255 m_apSymbolProperties_InvisibleSymbolForSelection;
256 mutable sal_Int32 m_nCurrentAttributedPoint;
257 ::com::sun::star::awt::Size m_aReferenceSize;
260 sal_Int32 m_nMissingValueTreatment;
261 bool m_bAllowPercentValueInDataLabel;
264 //.............................................................................
265 } //namespace chart
266 //.............................................................................
267 #endif