diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-01-30 12:27:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-30 20:48:02 +0100 |
commit | c496412631c950f081d7696867db907fa313653a (patch) | |
tree | e0014ec35bbccc3499497eced2828666e8a52e72 /chart2/source | |
parent | c5ab758bc3e1227e9ab3013d2fba4c2cd387e296 (diff) |
use more concrete types in chart2, DataSeries
Change-Id: Ida984d1701e2426958127845418365f6645a9043
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129161
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/inc/ChartType.hxx | 13 | ||||
-rw-r--r-- | chart2/source/inc/DataSeries.hxx (renamed from chart2/source/model/inc/DataSeries.hxx) | 22 | ||||
-rw-r--r-- | chart2/source/inc/DataSeriesHelper.hxx | 4 | ||||
-rw-r--r-- | chart2/source/model/template/ChartType.cxx | 39 | ||||
-rw-r--r-- | chart2/source/tools/DataSeriesHelper.cxx | 31 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 114 | ||||
-rw-r--r-- | chart2/source/view/inc/VDataSeries.hxx | 7 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 9 | ||||
-rw-r--r-- | chart2/source/view/main/VDataSeries.cxx | 19 |
9 files changed, 160 insertions, 98 deletions
diff --git a/chart2/source/inc/ChartType.hxx b/chart2/source/inc/ChartType.hxx index 833fa9783993..4c95fac5a704 100644 --- a/chart2/source/inc/ChartType.hxx +++ b/chart2/source/inc/ChartType.hxx @@ -35,6 +35,7 @@ namespace chart { +class DataSeries; class ModifyEventForwarder; namespace impl @@ -93,6 +94,14 @@ public: virtual rtl::Reference<ChartType> cloneChartType() const = 0; + void addDataSeries( + const rtl::Reference< ::chart::DataSeries >& aDataSeries ); + void removeDataSeries( + const rtl::Reference< ::chart::DataSeries >& aDataSeries ); + void setDataSeries( + const std::vector< rtl::Reference< ::chart::DataSeries > >& aDataSeries ); + const std::vector< rtl::Reference< ::chart::DataSeries > > & getDataSeries2() const { return m_aDataSeries; } + protected: // ____ XModifyListener ____ @@ -124,11 +133,11 @@ protected: private: void impl_addDataSeriesWithoutNotification( - const css::uno::Reference< css::chart2::XDataSeries >& aDataSeries ); + const rtl::Reference< ::chart::DataSeries >& aDataSeries ); private: typedef - std::vector< css::uno::Reference< css::chart2::XDataSeries > > tDataSeriesContainerType; + std::vector< rtl::Reference< ::chart::DataSeries > > tDataSeriesContainerType; // --- mutable members: the following members need mutex guard --- diff --git a/chart2/source/model/inc/DataSeries.hxx b/chart2/source/inc/DataSeries.hxx index a7a91325a605..64aab7ff8822 100644 --- a/chart2/source/model/inc/DataSeries.hxx +++ b/chart2/source/inc/DataSeries.hxx @@ -30,13 +30,13 @@ #include <cppuhelper/basemutex.hxx> #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <ModifyListenerHelper.hxx> +#include "ModifyListenerHelper.hxx" // STL #include <vector> #include <map> -#include <OPropertySet.hxx> +#include "OPropertySet.hxx" namespace com::sun::star::beans { class XPropertySet; } @@ -77,12 +77,8 @@ public: /// merge XTypeProvider implementations DECLARE_XTYPEPROVIDER() -private: explicit DataSeries( const DataSeries & rOther ); - // late initialization to call after copy-constructing - void Init( const DataSeries & rOther ); - // ____ XDataSeries ____ /// @see css::chart2::XDataSeries virtual css::uno::Reference< css::beans::XPropertySet > @@ -134,6 +130,17 @@ private: virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + typedef + std::vector< rtl::Reference< ::chart::RegressionCurveModel > > + tRegressionCurveContainerType; + + const tRegressionCurveContainerType & getRegressionCurves2() const { return m_aRegressionCurves; } + +private: + + // late initialization to call after copy-constructing + void Init( const DataSeries & rOther ); + // ____ XModifyListener ____ virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; @@ -155,9 +162,6 @@ private: css::uno::Reference< css::beans::XPropertySet > > tDataPointAttributeContainer; tDataPointAttributeContainer m_aAttributedDataPoints; - typedef - std::vector< rtl::Reference< ::chart::RegressionCurveModel > > - tRegressionCurveContainerType; tRegressionCurveContainerType m_aRegressionCurves; rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx index 8d2e7e3d5672..72d759afe008 100644 --- a/chart2/source/inc/DataSeriesHelper.hxx +++ b/chart2/source/inc/DataSeriesHelper.hxx @@ -39,6 +39,7 @@ namespace com::sun::star::uno { template <class E> class Sequence; } namespace chart { class BaseCoordinateSystem; } namespace chart { class ChartType; } namespace chart { class Diagram; } +namespace chart { class DataSeries; } namespace chart::DataSeriesHelper { @@ -96,6 +97,9 @@ OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XDataSource > OOO_DLLPUBLIC_CHARTTOOLS OUString getDataSeriesLabel( const css::uno::Reference< css::chart2::XDataSeries > & xSeries, const OUString & rLabelSequenceRole ); +OOO_DLLPUBLIC_CHARTTOOLS OUString getDataSeriesLabel( + const rtl::Reference< ::chart::DataSeries > & xSeries, + const OUString & rLabelSequenceRole ); /** Get the label of a labeled sequence including necessary automatic generation */ diff --git a/chart2/source/model/template/ChartType.cxx b/chart2/source/model/template/ChartType.cxx index 96273874643e..588b3fa653e9 100644 --- a/chart2/source/model/template/ChartType.cxx +++ b/chart2/source/model/template/ChartType.cxx @@ -23,6 +23,7 @@ #include <CloneHelper.hxx> #include <AxisIndexDefines.hxx> #include <ModifyListenerHelper.hxx> +#include <DataSeries.hxx> #include <vcl/svapp.hxx> #include <com/sun/star/chart2/AxisType.hpp> #include <com/sun/star/container/NoSuchElementException.hpp> @@ -51,7 +52,7 @@ ChartType::ChartType( const ChartType & rOther ) : { { SolarMutexGuard g; // access to rOther.m_aDataSeries - CloneHelper::CloneRefVector<css::chart2::XDataSeries>( + CloneHelper::CloneRefVector( rOther.m_aDataSeries, m_aDataSeries); } ModifyListenerHelper::addListenerToAllElements( m_aDataSeries, m_xModifyEventForwarder ); @@ -117,7 +118,7 @@ OUString SAL_CALL ChartType::getRoleOfSequenceForSeriesLabel() } void ChartType::impl_addDataSeriesWithoutNotification( - const Reference< chart2::XDataSeries >& xDataSeries ) + const rtl::Reference< DataSeries >& xDataSeries ) { if( std::find( m_aDataSeries.begin(), m_aDataSeries.end(), xDataSeries ) != m_aDataSeries.end()) @@ -130,6 +131,13 @@ void ChartType::impl_addDataSeriesWithoutNotification( // ____ XDataSeriesContainer ____ void SAL_CALL ChartType::addDataSeries( const Reference< chart2::XDataSeries >& xDataSeries ) { + rtl::Reference<DataSeries> xTmp = dynamic_cast<DataSeries*>(xDataSeries.get()); + assert(xTmp); + addDataSeries(xTmp); +} + +void ChartType::addDataSeries( const rtl::Reference< DataSeries >& xDataSeries ) +{ SolarMutexGuard g; impl_addDataSeriesWithoutNotification( xDataSeries ); @@ -138,13 +146,19 @@ void SAL_CALL ChartType::addDataSeries( const Reference< chart2::XDataSeries >& void SAL_CALL ChartType::removeDataSeries( const Reference< chart2::XDataSeries >& xDataSeries ) { + rtl::Reference<DataSeries> xTmp = dynamic_cast<DataSeries*>(xDataSeries.get()); + assert(xTmp); + removeDataSeries(xTmp); +} + +void ChartType::removeDataSeries( const rtl::Reference< DataSeries >& xDataSeries ) +{ if( !xDataSeries.is()) throw container::NoSuchElementException(); SolarMutexGuard g; - tDataSeriesContainerType::iterator aIt( - std::find( m_aDataSeries.begin(), m_aDataSeries.end(), xDataSeries ) ); + auto aIt = std::find( m_aDataSeries.begin(), m_aDataSeries.end(), xDataSeries ); if( aIt == m_aDataSeries.end()) throw container::NoSuchElementException( @@ -160,18 +174,29 @@ Sequence< Reference< chart2::XDataSeries > > SAL_CALL ChartType::getDataSeries() { SolarMutexGuard g; - return comphelper::containerToSequence( m_aDataSeries ); + return comphelper::containerToSequence< Reference< chart2::XDataSeries > >( m_aDataSeries ); } void SAL_CALL ChartType::setDataSeries( const Sequence< Reference< chart2::XDataSeries > >& aDataSeries ) { + std::vector< rtl::Reference<DataSeries> > aTmp; + for (auto const & i : aDataSeries) + { + auto p = dynamic_cast<DataSeries*>(i.get()); + assert(p); + aTmp.push_back(p); + } + setDataSeries(aTmp); +} + +void ChartType::setDataSeries( const std::vector< rtl::Reference< DataSeries > >& aDataSeries ) +{ SolarMutexGuard g; m_bNotifyChanges = false; try { - const Sequence< Reference< chart2::XDataSeries > > aOldSeries( getDataSeries() ); - for( auto const & i : aOldSeries ) + for( auto const & i : m_aDataSeries ) ModifyListenerHelper::removeListener( i, m_xModifyEventForwarder ); m_aDataSeries.clear(); diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index bdf391bf5922..c9cb870404c0 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -18,6 +18,7 @@ */ #include <DataSeriesHelper.hxx> +#include <DataSeries.hxx> #include <DataSource.hxx> #include <ChartType.hxx> #include <unonames.hxx> @@ -376,6 +377,36 @@ OUString getDataSeriesLabel( return aResult; } +OUString getDataSeriesLabel( + const rtl::Reference< DataSeries > & xSeries, + const OUString & rLabelSequenceRole ) +{ + OUString aResult; + + if( xSeries.is()) + { + Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( + ::chart::DataSeriesHelper::getDataSequenceByRole( xSeries, rLabelSequenceRole )); + if( xLabeledSeq.is()) + aResult = getLabelForLabeledDataSequence( xLabeledSeq ); + else + { + // special case: labeled data series with only a label and no values may + // serve as label + xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( xSeries )); + if( xLabeledSeq.is()) + { + Reference< chart2::data::XDataSequence > xSeq( xLabeledSeq->getLabel()); + if( xSeq.is()) + aResult = lcl_getDataSequenceLabel( xSeq ); + } + } + + } + + return aResult; +} + void setStackModeAtSeries( const Sequence< Reference< chart2::XDataSeries > > & aSeries, const rtl::Reference< BaseCoordinateSystem > & xCorrespondingCoordinateSystem, diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 5eab49ee6d4a..0c236b1ff3d6 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -25,6 +25,7 @@ #include <ShapeFactory.hxx> #include <Diagram.hxx> #include <BaseCoordinateSystem.hxx> +#include <DataSeries.hxx> #include <CommonConverters.hxx> #include <ExplicitCategoriesProvider.hxx> @@ -38,6 +39,7 @@ #include <servicenames_charttypes.hxx> #include <NumberFormatterWrapper.hxx> #include <DataSeriesHelper.hxx> +#include <RegressionCurveModel.hxx> #include <RegressionCurveHelper.hxx> #include <VLegendSymbolFactory.hxx> #include <FormattedStringHelper.hxx> @@ -514,7 +516,7 @@ rtl::Reference<SvxShapeText> VSeriesPlotter::createDataLabel( const rtl::Referen OUString aRole; if ( m_xChartTypeModel ) aRole = m_xChartTypeModel->getRoleOfSequenceForSeriesLabel(); - const uno::Reference< XDataSeries >& xSeries( rDataSeries.getModel() ); + const rtl::Reference< DataSeries >& xSeries( rDataSeries.getModel() ); pTextList[i] = DataSeriesHelper::getDataSeriesLabel( xSeries, aRole ); break; } @@ -572,7 +574,7 @@ rtl::Reference<SvxShapeText> VSeriesPlotter::createDataLabel( const rtl::Referen OUString aRole; if ( m_xChartTypeModel ) aRole = m_xChartTypeModel->getRoleOfSequenceForSeriesLabel(); - const uno::Reference< XDataSeries >& xSeries( rDataSeries.getModel() ); + const rtl::Reference< DataSeries >& xSeries( rDataSeries.getModel() ); pTextList[1] = DataSeriesHelper::getDataSeriesLabel( xSeries, aRole ); } @@ -1294,24 +1296,23 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer { if(m_nDimension!=2) return; - uno::Reference< XRegressionCurveContainer > xContainer( rVDataSeries.getModel(), uno::UNO_QUERY ); + rtl::Reference< DataSeries > xContainer( rVDataSeries.getModel() ); if(!xContainer.is()) return; if (!m_pPosHelper) return; - uno::Sequence< uno::Reference< XRegressionCurve > > aCurveList = xContainer->getRegressionCurves(); + const std::vector< rtl::Reference< ::chart::RegressionCurveModel > > & aCurveList = xContainer->getRegressionCurves2(); - for(sal_Int32 nN=0; nN<aCurveList.getLength(); nN++) + for(sal_Int32 nN=0; nN<static_cast<sal_Int32>(aCurveList.size()); nN++) { - uno::Reference< XRegressionCurveCalculator > xCalculator( aCurveList[nN]->getCalculator() ); + const auto & rCurve = aCurveList[nN]; + uno::Reference< XRegressionCurveCalculator > xCalculator( rCurve->getCalculator() ); if( !xCalculator.is()) continue; - uno::Reference< beans::XPropertySet > xProperties( aCurveList[nN], uno::UNO_QUERY ); - - bool bAverageLine = RegressionCurveHelper::isMeanValueLine( aCurveList[nN] ); + bool bAverageLine = RegressionCurveHelper::isMeanValueLine( rCurve ); sal_Int32 aDegree = 2; sal_Int32 aPeriod = 2; @@ -1321,16 +1322,16 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer bool bForceIntercept = false; double aInterceptValue = 0.0; - if ( xProperties.is() && !bAverageLine ) + if ( !bAverageLine ) { - xProperties->getPropertyValue( "PolynomialDegree") >>= aDegree; - xProperties->getPropertyValue( "MovingAveragePeriod") >>= aPeriod; - xProperties->getPropertyValue( "MovingAverageType") >>= aMovingAverageType; - xProperties->getPropertyValue( "ExtrapolateForward") >>= aExtrapolateForward; - xProperties->getPropertyValue( "ExtrapolateBackward") >>= aExtrapolateBackward; - xProperties->getPropertyValue( "ForceIntercept") >>= bForceIntercept; + rCurve->getPropertyValue( "PolynomialDegree") >>= aDegree; + rCurve->getPropertyValue( "MovingAveragePeriod") >>= aPeriod; + rCurve->getPropertyValue( "MovingAverageType") >>= aMovingAverageType; + rCurve->getPropertyValue( "ExtrapolateForward") >>= aExtrapolateForward; + rCurve->getPropertyValue( "ExtrapolateBackward") >>= aExtrapolateBackward; + rCurve->getPropertyValue( "ForceIntercept") >>= bForceIntercept; if (bForceIntercept) - xProperties->getPropertyValue( "InterceptValue") >>= aInterceptValue; + rCurve->getPropertyValue( "InterceptValue") >>= aInterceptValue; } double fChartMinX = m_pPosHelper->getLogicMinX(); @@ -1422,7 +1423,7 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer if( aRegressionPoly.SequenceX.hasElements() && aRegressionPoly.SequenceX[0].hasElements() ) { VLineProperties aVLineProperties; - aVLineProperties.initFromPropertySet( xProperties ); + aVLineProperties.initFromPropertySet( rCurve ); //create an extra group shape for each curve for selection handling rtl::Reference<SvxShapeGroupAnyD> xRegressionGroupShapes = @@ -1434,7 +1435,7 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries const & rVDataSer } // curve equation and correlation coefficient - uno::Reference< beans::XPropertySet > xEquationProperties( aCurveList[nN]->getEquationProperties()); + uno::Reference< beans::XPropertySet > xEquationProperties( rCurve->getEquationProperties()); if( xEquationProperties.is()) { createRegressionCurveEquationShapes( @@ -2469,19 +2470,11 @@ bool lcl_HasVisibleLine( const uno::Reference< beans::XPropertySet >& xProps, bo bool lcl_HasRegressionCurves( const VDataSeries& rSeries, bool& rbHasDashedLine ) { bool bHasRegressionCurves = false; - Reference< XRegressionCurveContainer > xRegrCont( rSeries.getModel(), uno::UNO_QUERY ); - if( xRegrCont.is()) + rtl::Reference< DataSeries > xRegrCont( rSeries.getModel() ); + for( const rtl::Reference< RegressionCurveModel > & rCurve : xRegrCont->getRegressionCurves2() ) { - Sequence< Reference< XRegressionCurve > > aCurves( xRegrCont->getRegressionCurves() ); - sal_Int32 i = 0, nCount = aCurves.getLength(); - for( i=0; i<nCount; ++i ) - { - if( aCurves[i].is() ) - { - bHasRegressionCurves = true; - lcl_HasVisibleLine( uno::Reference< beans::XPropertySet >( aCurves[i], uno::UNO_QUERY ), rbHasDashedLine ); - } - } + bHasRegressionCurves = true; + lcl_HasVisibleLine( rCurve, rbHasDashedLine ); } return bHasRegressionCurves; } @@ -2743,44 +2736,41 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( if (!ChartTypeHelper::isSupportingStatisticProperties( m_xChartTypeModel, m_nDimension )) return aResult; - Reference< XRegressionCurveContainer > xRegrCont( rSeries.getModel(), uno::UNO_QUERY ); + rtl::Reference< DataSeries > xRegrCont = rSeries.getModel(); if( xRegrCont.is()) { - Sequence< Reference< XRegressionCurve > > aCurves( xRegrCont->getRegressionCurves()); - sal_Int32 i = 0, nCount = aCurves.getLength(); + const std::vector< rtl::Reference< RegressionCurveModel > > & aCurves = xRegrCont->getRegressionCurves2(); + sal_Int32 i = 0, nCount = aCurves.size(); for( i=0; i<nCount; ++i ) { - if( aCurves[i].is() ) + //label + OUString aResStr( RegressionCurveHelper::getUINameForRegressionCurve( aCurves[i] ) ); + replaceParamterInString( aResStr, "%SERIESNAME", aLabelText ); + aEntry.aLabel = FormattedStringHelper::createFormattedStringSequence( xContext, aResStr, xTextProperties ); + + // symbol + rtl::Reference<SvxShapeGroup> xSymbolGroup(ShapeFactory::createGroup2D( xTarget )); + + // create the symbol + rtl::Reference<SvxShapeGroup> xShape = VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio, + xSymbolGroup, LegendSymbolStyle::Line, + aCurves[i], + VLegendSymbolFactory::PropertyType::Line, uno::Any() ); + + // set CID to symbol for selection + if( xShape.is()) { - //label - OUString aResStr( RegressionCurveHelper::getUINameForRegressionCurve( aCurves[i] ) ); - replaceParamterInString( aResStr, "%SERIESNAME", aLabelText ); - aEntry.aLabel = FormattedStringHelper::createFormattedStringSequence( xContext, aResStr, xTextProperties ); - - // symbol - rtl::Reference<SvxShapeGroup> xSymbolGroup(ShapeFactory::createGroup2D( xTarget )); - - // create the symbol - rtl::Reference<SvxShapeGroup> xShape = VLegendSymbolFactory::createSymbol( rEntryKeyAspectRatio, - xSymbolGroup, LegendSymbolStyle::Line, - Reference< beans::XPropertySet >( aCurves[i], uno::UNO_QUERY ), - VLegendSymbolFactory::PropertyType::Line, uno::Any() ); - - // set CID to symbol for selection - if( xShape.is()) - { - aEntry.xSymbol = xSymbolGroup; - - bool bAverageLine = RegressionCurveHelper::isMeanValueLine( aCurves[i] ); - ObjectType eObjectType = bAverageLine ? OBJECTTYPE_DATA_AVERAGE_LINE : OBJECTTYPE_DATA_CURVE; - OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( eObjectType, i ) ); - aChildParticle = ObjectIdentifier::addChildParticle( aChildParticle, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) ); - OUString aCID = ObjectIdentifier::createClassifiedIdentifierForParticles( rSeries.getSeriesParticle(), aChildParticle ); - ShapeFactory::setShapeName( xShape, aCID ); - } + aEntry.xSymbol = xSymbolGroup; - aResult.push_back(aEntry); + bool bAverageLine = RegressionCurveHelper::isMeanValueLine( aCurves[i] ); + ObjectType eObjectType = bAverageLine ? OBJECTTYPE_DATA_AVERAGE_LINE : OBJECTTYPE_DATA_CURVE; + OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( eObjectType, i ) ); + aChildParticle = ObjectIdentifier::addChildParticle( aChildParticle, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) ); + OUString aCID = ObjectIdentifier::createClassifiedIdentifierForParticles( rSeries.getSeriesParticle(), aChildParticle ); + ShapeFactory::setShapeName( xShape, aCID ); } + + aResult.push_back(aEntry); } } } diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx index a2162d7bc064..bfe85435cc02 100644 --- a/chart2/source/view/inc/VDataSeries.hxx +++ b/chart2/source/view/inc/VDataSeries.hxx @@ -42,6 +42,7 @@ namespace com::sun::star::drawing { class XShapes; } namespace chart { class ChartType; +class DataSeries; class VDataSequence { @@ -61,14 +62,14 @@ public: class VDataSeries final { public: - VDataSeries( const css::uno::Reference<css::chart2::XDataSeries>& xDataSeries ); + VDataSeries( const rtl::Reference<::chart::DataSeries>& xDataSeries ); ~VDataSeries(); VDataSeries(const VDataSeries&) = delete; const VDataSeries& operator=(const VDataSeries&) = delete; - const css::uno::Reference<css::chart2::XDataSeries>& getModel() const; + const rtl::Reference<::chart::DataSeries>& getModel() const; void setCategoryXAxis(); void setXValues( const css::uno::Reference<css::chart2::data::XDataSequence>& xValues ); @@ -195,7 +196,7 @@ public: //member rtl::Reference<SvxShapeGroupAnyD> m_xBackSubGroupShape; private: //member - css::uno::Reference<css::chart2::XDataSeries> m_xDataSeries; + rtl::Reference<::chart::DataSeries> m_xDataSeries; css::uno::Reference<css::beans::XPropertySet> m_xDataSeriesProps; // cached //all points given by the model data (here are not only the visible points meant) diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 2fee4c3059be..9320dea71793 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -23,6 +23,7 @@ #include <chartview/DrawModelWrapper.hxx> #include <Diagram.hxx> #include <ChartType.hxx> +#include <DataSeries.hxx> #include <NumberFormatterWrapper.hxx> #include <VDiagram.hxx> #include "VTitle.hxx" @@ -531,12 +532,10 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( sal_Int32 zSlot=-1; sal_Int32 xSlot=-1; sal_Int32 ySlot=-1; - uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xChartType->getDataSeries() ); - for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS ) + const std::vector< rtl::Reference< DataSeries > > & aSeriesList = xChartType->getDataSeries2(); + for( sal_Int32 nS = 0; nS < static_cast<sal_Int32>(aSeriesList.size()); ++nS ) { - uno::Reference< XDataSeries > const & xDataSeries = aSeriesList[nS]; - if(!xDataSeries.is()) - continue; + rtl::Reference<DataSeries> const & xDataSeries = aSeriesList[nS]; if( !bIncludeHiddenCells && !DataSeriesHelper::hasUnhiddenData(xDataSeries) ) continue; diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 9b5813c56c4d..1f29f8802b82 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -20,6 +20,7 @@ #include <limits> #include <memory> #include <VDataSeries.hxx> +#include <DataSeries.hxx> #include <ObjectIdentifier.hxx> #include <CommonConverters.hxx> #include <LabelPositionHelper.hxx> @@ -138,7 +139,7 @@ void lcl_maybeReplaceNanWithZero( double& rfValue, sal_Int32 nMissingValueTreatm } -VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) +VDataSeries::VDataSeries( const rtl::Reference< DataSeries >& xDataSeries ) : m_nPolygonIndex(0) , m_fLogicMinX(0.0) , m_fLogicMaxX(0.0) @@ -160,12 +161,11 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) , mpOldSeries(nullptr) , mnPercent(0.0) { - m_xDataSeriesProps.set(m_xDataSeries, css::uno::UNO_QUERY); - uno::Reference<data::XDataSource> xDataSource( xDataSeries, uno::UNO_QUERY ); + m_xDataSeriesProps = m_xDataSeries; uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aDataSequences = - xDataSource->getDataSequences(); + m_xDataSeries->getDataSequences(); for(sal_Int32 nN = aDataSequences.getLength();nN--;) { @@ -227,18 +227,17 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) m_nPointCount = m_aValues_Y_Last.getLength(); } - uno::Reference<beans::XPropertySet> xProp(xDataSeries, uno::UNO_QUERY ); - if( !xProp.is()) + if( !xDataSeries.is()) return; try { //get AttributedDataPoints - xProp->getPropertyValue("AttributedDataPoints") >>= m_aAttributedDataPointIndexList; + xDataSeries->getPropertyValue("AttributedDataPoints") >>= m_aAttributedDataPointIndexList; - xProp->getPropertyValue("StackingDirection") >>= m_eStackingDirection; + xDataSeries->getPropertyValue("StackingDirection") >>= m_eStackingDirection; - xProp->getPropertyValue("AttachedAxisIndex") >>= m_nAxisIndex; + xDataSeries->getPropertyValue("AttachedAxisIndex") >>= m_nAxisIndex; if(m_nAxisIndex<0) m_nAxisIndex=0; } @@ -300,7 +299,7 @@ void VDataSeries::releaseShapes() m_nPolygonIndex = 0; } -const uno::Reference<css::chart2::XDataSeries>& VDataSeries::getModel() const +const rtl::Reference<::chart::DataSeries>& VDataSeries::getModel() const { return m_xDataSeries; } |