1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 _CHART2_VIEW_DATASERIES_HXX
20 #define _CHART2_VIEW_DATASERIES_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>
37 #include <boost/noncopyable.hpp>
38 #include <boost/scoped_ptr.hpp>
43 class VDataSequence
: boost::noncopyable
46 void init( const ::com::sun::star::uno::Reference
<
47 ::com::sun::star::chart2::data::XDataSequence
>& xModel
);
50 double getValue( sal_Int32 index
) const;
51 sal_Int32
detectNumberFormatKey( sal_Int32 index
) const;
52 sal_Int32
getLength() const;
55 ::com::sun::star::uno::Reference
<
56 ::com::sun::star::chart2::data::XDataSequence
> Model
;
58 mutable ::com::sun::star::uno::Sequence
< double > Doubles
;
61 class VDataSeries
: boost::noncopyable
64 VDataSeries( const ::com::sun::star::uno::Reference
<
65 ::com::sun::star::chart2::XDataSeries
>& xDataSeries
);
66 virtual ~VDataSeries();
68 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
>
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
);
80 sal_Int32
getTotalPointCount() const;
81 double getXValue( sal_Int32 index
) const;
82 double getYValue( sal_Int32 index
) const;
84 double getY_Min( sal_Int32 index
) const;
85 double getY_Max( sal_Int32 index
) const;
86 double getY_First( sal_Int32 index
) const;
87 double getY_Last( sal_Int32 index
) const;
89 double getBubble_Size( sal_Int32 index
) const;
91 double getMinimumofAllDifferentYValues( sal_Int32 index
) const;
92 double getMaximumofAllDifferentYValues( sal_Int32 index
) const;
94 ::com::sun::star::uno::Sequence
< double > getAllX() const;
95 ::com::sun::star::uno::Sequence
< double > getAllY() const;
97 double getXMeanValue() const;
98 double getYMeanValue() const;
100 bool hasExplicitNumberFormat( sal_Int32 nPointIndex
, bool bForPercentage
) const;
101 sal_Int32
getExplicitNumberFormat( sal_Int32 nPointIndex
, bool bForPercentage
) const;
102 sal_Int32
detectNumberFormatKey( sal_Int32 nPointIndex
) const;
103 bool shouldLabelNumberFormatKeyBeDetectedFromYAxis() const;
105 sal_Int32
getLabelPlacement( sal_Int32 nPointIndex
, const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartType
>& xChartType
106 , sal_Int32 nDimensionCount
, sal_Bool bSwapXAndY
) const;
108 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
109 getPropertiesOfPoint( sal_Int32 index
) const;
111 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
112 getPropertiesOfSeries() const;
114 ::com::sun::star::chart2::Symbol
*
115 getSymbolProperties( sal_Int32 index
) const;
117 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
118 getXErrorBarProperties( sal_Int32 index
) const;
120 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
121 getYErrorBarProperties( sal_Int32 index
) const;
123 bool hasPointOwnColor( sal_Int32 index
) const;
125 ::com::sun::star::chart2::StackingDirection
getStackingDirection() const;
126 sal_Int32
getAttachedAxisIndex() const;
127 void setAttachedAxisIndex( sal_Int32 nAttachedAxisIndex
);
129 void doSortByXValues();
131 void setConnectBars( sal_Bool bConnectBars
);
132 sal_Bool
getConnectBars() const;
134 void setGroupBarsPerAxis( sal_Bool bGroupBarsPerAxis
);
135 sal_Bool
getGroupBarsPerAxis() const;
137 void setStartingAngle( sal_Int32 nStartingAngle
);
138 sal_Int32
getStartingAngle() const;
140 void setRoleOfSequenceForDataLabelNumberFormatDetection( const OUString
& rRole
);
142 //this is only temporarily here for area chart:
143 ::com::sun::star::drawing::PolyPolygonShape3D m_aPolyPolygonShape3D
;
144 sal_Int32 m_nPolygonIndex
;
148 //this is here for deep stacking:
149 double m_fLogicZPos
;//from 0 to series count -1
151 OUString
getCID() const;
152 OUString
getSeriesParticle() const;
153 OUString
getPointCID_Stub() const;
154 OUString
getErrorBarsCID( bool bYError
) const;
155 OUString
getLabelsCID() const;
156 OUString
getLabelCID_Stub() const;
157 OUString
getDataCurveCID( sal_Int32 nCurveIndex
, bool bAverageLine
) const;
159 ::com::sun::star::chart2::DataPointLabel
*
160 getDataPointLabelIfLabel( sal_Int32 index
) const;
161 bool getTextLabelMultiPropertyLists( sal_Int32 index
, tNameSequence
*& pPropNames
, tAnySequence
*& pPropValues
) const;
163 OUString
getDataCurveEquationCID( sal_Int32 nCurveIndex
) const;
164 bool isAttributedDataPoint( sal_Int32 index
) const;
166 bool isVaryColorsByPoint() const;
168 void releaseShapes();
170 void setMissingValueTreatment( sal_Int32 nMissingValueTreatment
);
171 sal_Int32
getMissingValueTreatment() const;
174 ::com::sun::star::chart2::DataPointLabel
*
175 getDataPointLabel( sal_Int32 index
) const;
176 void adaptPointCache( sal_Int32 nNewPointIndex
) const;
179 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShapes
> m_xGroupShape
;
180 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShapes
> m_xLabelsGroupShape
;
181 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShapes
> m_xErrorXBarsGroupShape
;
182 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShapes
> m_xErrorYBarsGroupShape
;
184 //the following group shapes will be created as children of m_xGroupShape on demand
185 //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)
186 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShapes
> m_xFrontSubGroupShape
;
187 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShapes
> m_xBackSubGroupShape
;
190 ::com::sun::star::uno::Reference
<
191 ::com::sun::star::chart2::XDataSeries
> m_xDataSeries
;
192 ::com::sun::star::uno::Sequence
<
193 ::com::sun::star::uno::Reference
<
194 ::com::sun::star::chart2::data::XLabeledDataSequence
> > m_aDataSequences
;
196 //all points given by the model data (here are not only the visible points meant)
197 sal_Int32 m_nPointCount
;
199 VDataSequence m_aValues_X
;
200 VDataSequence m_aValues_Y
;
201 VDataSequence m_aValues_Z
;
203 VDataSequence m_aValues_Y_Min
;
204 VDataSequence m_aValues_Y_Max
;
205 VDataSequence m_aValues_Y_First
;
206 VDataSequence m_aValues_Y_Last
;
208 VDataSequence m_aValues_Bubble_Size
;
210 VDataSequence
* m_pValueSequenceForDataLabelNumberFormatDetection
;
212 mutable double m_fXMeanValue
;
213 mutable double m_fYMeanValue
;
215 ::com::sun::star::uno::Sequence
< sal_Int32
> m_aAttributedDataPointIndexList
;
217 ::com::sun::star::chart2::StackingDirection m_eStackingDirection
;
219 sal_Int32 m_nAxisIndex
;//indicates whether this is attached to a main or secondary axis
221 sal_Bool m_bConnectBars
;
223 sal_Bool m_bGroupBarsPerAxis
;
225 sal_Int32 m_nStartingAngle
;
227 OUString m_aSeriesParticle
;
229 OUString m_aPointCID_Stub
;
230 OUString m_aLabelCID_Stub
;
232 sal_Int32 m_nGlobalSeriesIndex
;
234 //some cached values for data labels as they are very expensive
235 mutable boost::scoped_ptr
<com::sun::star::chart2::DataPointLabel
>
237 mutable boost::scoped_ptr
<tNameSequence
> m_apLabelPropNames_Series
;
238 mutable boost::scoped_ptr
<tAnySequence
> m_apLabelPropValues_Series
;
239 mutable boost::scoped_ptr
<com::sun::star::chart2::Symbol
>
240 m_apSymbolProperties_Series
;
242 mutable boost::scoped_ptr
<com::sun::star::chart2::DataPointLabel
>
243 m_apLabel_AttributedPoint
;
244 mutable boost::scoped_ptr
<tNameSequence
> m_apLabelPropNames_AttributedPoint
;
245 mutable boost::scoped_ptr
<tAnySequence
> m_apLabelPropValues_AttributedPoint
;
246 mutable boost::scoped_ptr
<com::sun::star::chart2::Symbol
>
247 m_apSymbolProperties_AttributedPoint
;
248 mutable boost::scoped_ptr
<com::sun::star::chart2::Symbol
>
249 m_apSymbolProperties_InvisibleSymbolForSelection
;
250 mutable sal_Int32 m_nCurrentAttributedPoint
;
251 ::com::sun::star::awt::Size m_aReferenceSize
;
253 sal_Int32 m_nMissingValueTreatment
;
254 bool m_bAllowPercentValueInDataLabel
;
260 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */