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