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