tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / chart2 / source / view / inc / VDataSeries.hxx
blob72f5fca800895ef06ebf0655e33239839c9f7911
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
21 #include "PropertyMapper.hxx"
23 #include <com/sun/star/chart2/DataPointLabel.hpp>
24 #include <com/sun/star/chart2/StackingDirection.hpp>
25 #include <com/sun/star/chart2/Symbol.hpp>
26 #include <com/sun/star/drawing/Position3D.hpp>
27 #include <com/sun/star/awt/Size.hpp>
28 #include <com/sun/star/awt/Point.hpp>
29 #include <rtl/ref.hxx>
30 #include <svx/unoshape.hxx>
32 #include <memory>
33 #include <map>
35 namespace com::sun::star::beans { class XPropertySet; }
36 namespace com::sun::star::chart2 { class XChartType; }
37 namespace com::sun::star::chart2 { class XDataSeries; }
38 namespace com::sun::star::chart2::data { class XDataSequence; }
39 namespace com::sun::star::drawing { class XShapes; }
41 namespace chart
43 class ChartType;
44 class DataSeries;
46 class VDataSequence
48 public:
49 void init( const css::uno::Reference<css::chart2::data::XDataSequence>& xModel );
50 bool is() const;
51 void clear();
52 double getValue( sal_Int32 index ) const;
53 sal_Int32 detectNumberFormatKey( sal_Int32 index ) const;
54 sal_Int32 getLength() const;
56 css::uno::Reference<css::chart2::data::XDataSequence> m_xModel;
57 mutable css::uno::Sequence<double> m_aValues;
60 class VDataSeries final
62 public:
63 VDataSeries( const rtl::Reference<::chart::DataSeries>& xDataSeries );
65 ~VDataSeries();
67 VDataSeries(const VDataSeries&) = delete;
68 const VDataSeries& operator=(const VDataSeries&) = delete;
70 const rtl::Reference<::chart::DataSeries>& getModel() const;
72 void setCategoryXAxis();
73 void setXValues( const css::uno::Reference<css::chart2::data::XDataSequence>& xValues );
74 void setXValuesIfNone( const css::uno::Reference<css::chart2::data::XDataSequence>& xValues );
75 void setParticle( const OUString& rSeriesParticle );
76 void setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex );
77 void setPageReferenceSize( const css::awt::Size & rPageRefSize );
79 sal_Int32 getTotalPointCount() const { return m_nPointCount;}
80 double getXValue( sal_Int32 index ) const;
81 double getYValue( sal_Int32 index ) const;
83 void getMinMaxXValue( double& fMin, double& fMax ) const;
85 double getY_Min( sal_Int32 index ) const;
86 double getY_Max( sal_Int32 index ) const;
87 double getY_First( sal_Int32 index ) const;
88 double getY_Last( sal_Int32 index ) const;
90 double getBubble_Size( sal_Int32 index ) const;
92 double getMinimumofAllDifferentYValues( sal_Int32 index ) const;
93 double getMaximumofAllDifferentYValues( sal_Int32 index ) const;
95 double getValueByProperty( sal_Int32 index, const OUString& rPropName ) const;
97 bool hasPropertyMapping( const OUString& rPropName ) const;
99 css::uno::Sequence< double > const & getAllX() const;
100 css::uno::Sequence< double > const & getAllY() const;
102 double getXMeanValue() const;
103 double getYMeanValue() const;
105 bool hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
106 sal_Int32 getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
107 sal_Int32 detectNumberFormatKey( sal_Int32 nPointIndex ) const;
109 sal_Int32 getLabelPlacement(
110 sal_Int32 nPointIndex, const rtl::Reference<::chart::ChartType>& xChartType,
111 bool bSwapXAndY ) const;
113 css::awt::Point getLabelPosition( css::awt::Point aTextShapePos, sal_Int32 nPointIndex ) const;
114 bool isLabelCustomPos( sal_Int32 nPointIndex ) const;
115 css::awt::Size getLabelCustomSize(sal_Int32 nPointIndex) const;
117 css::uno::Reference<css::beans::XPropertySet> getPropertiesOfPoint( sal_Int32 index ) const;
119 const css::uno::Reference<css::beans::XPropertySet> & getPropertiesOfSeries() const;
121 css::chart2::Symbol* getSymbolProperties( sal_Int32 index ) const;
123 css::uno::Reference<css::beans::XPropertySet> getXErrorBarProperties( sal_Int32 index ) const;
125 css::uno::Reference<css::beans::XPropertySet> getYErrorBarProperties( sal_Int32 index ) const;
127 bool hasPointOwnColor( sal_Int32 index ) const;
129 css::chart2::StackingDirection getStackingDirection() const;
130 sal_Int32 getAttachedAxisIndex() const;
131 void setAttachedAxisIndex( sal_Int32 nAttachedAxisIndex );
133 void doSortByXValues();
135 void setConnectBars( bool bConnectBars );
136 bool getConnectBars() const;
138 void setGroupBarsPerAxis( bool bGroupBarsPerAxis );
139 bool getGroupBarsPerAxis() const;
141 void setStartingAngle( sal_Int32 nStartingAngle );
142 sal_Int32 getStartingAngle() const;
144 void setRoleOfSequenceForDataLabelNumberFormatDetection( std::u16string_view rRole );
146 //this is only temporarily here for area chart:
147 std::vector<std::vector<css::drawing::Position3D>> m_aPolyPolygonShape3D;
148 sal_Int32 m_nPolygonIndex;
149 double m_fLogicMinX;
150 double m_fLogicMaxX;
152 //this is here for deep stacking:
153 double m_fLogicZPos;//from 0 to series count -1
155 const OUString& getCID() const { return m_aCID;}
156 const OUString& getSeriesParticle() const { return m_aSeriesParticle;}
157 const OUString& getPointCID_Stub() const { return m_aPointCID_Stub;}
158 OUString getErrorBarsCID( bool bYError ) const;
159 OUString getLabelsCID() const;
160 const OUString& getLabelCID_Stub() const { return m_aLabelCID_Stub;}
161 OUString getDataCurveCID( sal_Int32 nCurveIndex, bool bAverageLine ) const;
163 css::chart2::DataPointLabel* getDataPointLabelIfLabel( sal_Int32 index ) const;
164 bool getTextLabelMultiPropertyLists( sal_Int32 index, tNameSequence*& pPropNames, tAnySequence*& pPropValues ) const;
166 OUString getDataCurveEquationCID( sal_Int32 nCurveIndex ) const;
167 bool isAttributedDataPoint( sal_Int32 index ) const;
169 bool isVaryColorsByPoint() const;
171 void releaseShapes();
173 void setMissingValueTreatment( sal_Int32 nMissingValueTreatment );
174 sal_Int32 getMissingValueTreatment() const;
176 void setOldTimeBased( VDataSeries* pOldSeries, double nPercent );
177 VDataSeries* createCopyForTimeBased() const;
179 private: //methods
180 css::chart2::DataPointLabel* getDataPointLabel( sal_Int32 index ) const;
181 void adaptPointCache( sal_Int32 nNewPointIndex ) const;
183 // for copies for time based charting
184 VDataSeries();
186 public: //member
187 rtl::Reference<SvxShapeGroupAnyD> m_xGroupShape;
188 rtl::Reference<SvxShapeGroup> m_xLabelsGroupShape;
189 rtl::Reference<SvxShapeGroupAnyD> m_xErrorXBarsGroupShape;
190 rtl::Reference<SvxShapeGroupAnyD> m_xErrorYBarsGroupShape;
192 //the following group shapes will be created as children of m_xGroupShape on demand
193 //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)
194 rtl::Reference<SvxShapeGroupAnyD> m_xFrontSubGroupShape;
195 rtl::Reference<SvxShapeGroupAnyD> m_xBackSubGroupShape;
197 private: //member
198 rtl::Reference<::chart::DataSeries> m_xDataSeries;
199 css::uno::Reference<css::beans::XPropertySet> m_xDataSeriesProps; // cached
201 //all points given by the model data (here are not only the visible points meant)
202 sal_Int32 m_nPointCount;
204 VDataSequence m_aValues_X;
205 VDataSequence m_aValues_Y;
206 VDataSequence m_aValues_Z;
208 VDataSequence m_aValues_Y_Min;
209 VDataSequence m_aValues_Y_Max;
210 VDataSequence m_aValues_Y_First;
211 VDataSequence m_aValues_Y_Last;
213 VDataSequence m_aValues_Bubble_Size;
215 VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection;
217 std::map<OUString, VDataSequence> m_PropertyMap;
219 mutable double m_fXMeanValue;
220 mutable double m_fYMeanValue;
222 css::uno::Sequence<sal_Int32> m_aAttributedDataPointIndexList;
224 css::chart2::StackingDirection m_eStackingDirection;
226 sal_Int32 m_nAxisIndex;//indicates whether this is attached to a main or secondary axis
228 bool m_bConnectBars;
230 bool m_bGroupBarsPerAxis;
232 sal_Int32 m_nStartingAngle;
234 OUString m_aSeriesParticle;
235 OUString m_aCID;
236 OUString m_aPointCID_Stub;
237 OUString m_aLabelCID_Stub;
239 sal_Int32 m_nGlobalSeriesIndex;
241 //some cached values for data labels as they are very expensive
242 mutable std::optional<css::chart2::DataPointLabel>
243 m_oLabel_Series;
244 mutable std::optional<tNameSequence> m_oLabelPropNames_Series;
245 mutable std::optional<tAnySequence> m_oLabelPropValues_Series;
246 mutable std::optional<css::chart2::Symbol> m_oSymbolProperties_Series;
248 mutable std::optional<css::chart2::DataPointLabel>
249 m_oLabel_AttributedPoint;
250 mutable std::optional<tNameSequence> m_oLabelPropNames_AttributedPoint;
251 mutable std::optional<tAnySequence> m_oLabelPropValues_AttributedPoint;
252 mutable std::optional<css::chart2::Symbol> m_oSymbolProperties_AttributedPoint;
253 mutable std::optional<css::chart2::Symbol> m_oSymbolProperties_InvisibleSymbolForSelection;
254 mutable sal_Int32 m_nCurrentAttributedPoint;
255 css::awt::Size m_aReferenceSize;
257 sal_Int32 m_nMissingValueTreatment;
258 bool m_bAllowPercentValueInDataLabel;
260 // for time based charting
261 VDataSeries* mpOldSeries;
262 double mnPercent;
265 } //namespace chart
267 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */