chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx | 2 chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx | 8 +- chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx | 39 +++++----- chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx | 4 - chart2/source/controller/dialogs/DialogModel.cxx | 2 chart2/source/controller/dialogs/ObjectNameProvider.cxx | 4 - chart2/source/controller/main/ChartController_Insert.cxx | 4 - chart2/source/inc/Diagram.hxx | 3 chart2/source/inc/DiagramHelper.hxx | 4 - chart2/source/model/main/Diagram.cxx | 29 ++++++- chart2/source/model/template/AreaChartTypeTemplate.cxx | 2 chart2/source/model/template/BarChartTypeTemplate.cxx | 2 chart2/source/model/template/ChartTypeTemplate.cxx | 2 chart2/source/model/template/LineChartTypeTemplate.cxx | 2 chart2/source/model/template/NetChartTypeTemplate.cxx | 2 chart2/source/model/template/PieChartTypeTemplate.cxx | 4 - chart2/source/model/template/ScatterChartTypeTemplate.cxx | 2 chart2/source/model/template/StockChartTypeTemplate.cxx | 2 chart2/source/tools/AxisHelper.cxx | 4 - chart2/source/tools/ChartModelHelper.cxx | 2 chart2/source/tools/DataSourceHelper.cxx | 6 + chart2/source/tools/DiagramHelper.cxx | 27 ------ chart2/source/tools/ReferenceSizeProvider.cxx | 4 - chart2/source/tools/RegressionCurveHelper.cxx | 3 chart2/source/tools/ThreeDHelper.cxx | 4 - chart2/source/view/main/SeriesPlotterContainer.cxx | 3 26 files changed, 84 insertions(+), 86 deletions(-)
New commits: commit fd299d209d82495eb6528fb444e0b68f41c8ae0d Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Mar 16 08:51:23 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Mar 19 12:55:30 2023 +0000 move getDataSeries inside chart2::Diagram Change-Id: Ie60d288dba9c8d006de03c80d3cfc7bf8f108782 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149085 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index 83f4bd16843d..fc7ae7c4f272 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -560,7 +560,7 @@ rtl::Reference< DataSeries > DataSeriesPointWrapper::getDataSeries() { rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); std::vector< rtl::Reference< DataSeries > > aSeriesList = - ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); if( m_nSeriesIndexInNewAPI >= 0 && o3tl::make_unsigned(m_nSeriesIndexInNewAPI) < aSeriesList.size() ) xSeries = aSeriesList[m_nSeriesIndexInNewAPI]; diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 5654ef2ec8fc..2de5055c41aa 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -447,7 +447,7 @@ sal_Int32 lcl_getNewAPIIndexForOldAPIIndex( } std::vector< rtl::Reference< ::chart::DataSeries > > aSeriesList = - ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); if( nNewAPIIndex >= static_cast<sal_Int32>(aSeriesList.size()) ) nNewAPIIndex = -1; @@ -1451,7 +1451,7 @@ bool WrappedNumberOfLinesProperty::detectInnerValue( uno::Any& rInnerValue ) con if( xDiagram.is() && xChartDoc.is() ) { std::vector< rtl::Reference< DataSeries > > aSeriesVector = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); if( !aSeriesVector.empty() ) { rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager(); @@ -1600,7 +1600,7 @@ void WrappedAttributedDataPointsProperty::setPropertyValue( const Any& rOuterVal return; std::vector< rtl::Reference< DataSeries > > aSeriesVector = - ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); sal_Int32 i = 0; for (auto const& series : aSeriesVector) { @@ -1625,7 +1625,7 @@ Any WrappedAttributedDataPointsProperty::getPropertyValue( const Reference< bean if( xDiagram ) { std::vector< rtl::Reference< DataSeries > > aSeriesVector = - ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() ); auto aResultRange = asNonConstRange(aResult); diff --git a/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx index c0fdc706c7d4..82cd43eefb17 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx @@ -60,30 +60,31 @@ public: bool detectInnerValue( PROPERTYTYPE& rValue, bool& rHasAmbiguousValue ) const { - bool bHasDetectableInnerValue = false; rHasAmbiguousValue = false; - if( m_ePropertyType == DIAGRAM && - m_spChart2ModelContact ) + if( m_ePropertyType != DIAGRAM || !m_spChart2ModelContact ) + return false; + bool bHasDetectableInnerValue = false; + rtl::Reference<Diagram> xDiagram = m_spChart2ModelContact->getDiagram(); + if (!xDiagram) + return false; + std::vector< rtl::Reference< DataSeries > > aSeriesVector = + xDiagram->getDataSeries(); + for (auto const& series : aSeriesVector) { - std::vector< rtl::Reference< DataSeries > > aSeriesVector = - ::chart::DiagramHelper::getDataSeriesFromDiagram( m_spChart2ModelContact->getDiagram() ); - for (auto const& series : aSeriesVector) + PROPERTYTYPE aCurValue = getValueFromSeries( series ); + if( !bHasDetectableInnerValue ) + rValue = aCurValue; + else { - PROPERTYTYPE aCurValue = getValueFromSeries( series ); - if( !bHasDetectableInnerValue ) - rValue = aCurValue; - else + if( rValue != aCurValue ) { - if( rValue != aCurValue ) - { - rHasAmbiguousValue = true; - break; - } - else - rValue = aCurValue; + rHasAmbiguousValue = true; + break; } - bHasDetectableInnerValue = true; + else + rValue = aCurValue; } + bHasDetectableInnerValue = true; } return bHasDetectableInnerValue; } @@ -93,7 +94,7 @@ public: m_spChart2ModelContact ) { std::vector< rtl::Reference< DataSeries > > aSeriesVector = - ::chart::DiagramHelper::getDataSeriesFromDiagram( m_spChart2ModelContact->getDiagram() ); + m_spChart2ModelContact->getDiagram()->getDataSeries(); for (auto const& series : aSeriesVector) { setValueToSeries( series, aNewValue ); diff --git a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx index 155909662386..31ae76810df8 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx @@ -136,7 +136,7 @@ css::uno::Any WrappedVolumeProperty::getPropertyValue( const css::uno::Reference if( xDiagram.is() && xChartDoc.is() ) { std::vector< rtl::Reference< DataSeries > > aSeriesVector = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); if( !aSeriesVector.empty() ) { rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager(); @@ -205,7 +205,7 @@ css::uno::Any WrappedUpDownProperty::getPropertyValue( const css::uno::Reference if( xDiagram.is() && xChartDoc.is() ) { std::vector< rtl::Reference< DataSeries > > aSeriesVector = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); if( !aSeriesVector.empty() ) { rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager(); diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index 1b0f7ed31abe..f64e328f1d28 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -718,7 +718,7 @@ void DialogModel::setData( ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram ); std::vector< rtl::Reference< DataSeries > > aSeriesToReUse = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); applyInterpretedData( xInterpreter->interpretDataSource( xDataSource, rArguments, diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index c60ff1ca364a..d70a555bb4fd 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -529,7 +529,7 @@ OUString ObjectNameProvider::getHelpText( std::u16string_view rObjectCID, const if( nIndex != -1 ) { std::vector< rtl::Reference< DataSeries > > aSeriesVector = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); sal_Int32 nSeriesIndex = -1; for( nSeriesIndex=aSeriesVector.size();nSeriesIndex--;) { @@ -743,7 +743,7 @@ OUString ObjectNameProvider::getSelectedObjectText( std::u16string_view rObjectC // replace data series index { std::vector< rtl::Reference< DataSeries > > aSeriesVector( - DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); + xDiagram->getDataSeries() ); sal_Int32 nSeriesIndex = -1; for( nSeriesIndex=aSeriesVector.size();nSeriesIndex--;) { diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 7e8d0f4bd105..8902e85fec4d 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -438,10 +438,10 @@ void ChartController::executeDispatch_InsertMenu_MeanValues() //if a series is selected insert mean value only for that series: lcl_InsertMeanValueLine( xSeries ); } - else + else if (rtl::Reference<Diagram> xDiagram = getFirstDiagram()) { std::vector< rtl::Reference< DataSeries > > aSeries = - DiagramHelper::getDataSeriesFromDiagram( getFirstDiagram()); + xDiagram->getDataSeries(); for( const auto& xSrs : aSeries ) lcl_InsertMeanValueLine( xSrs ); diff --git a/chart2/source/inc/Diagram.hxx b/chart2/source/inc/Diagram.hxx index b370d38057c4..b9e7a06b1786 100644 --- a/chart2/source/inc/Diagram.hxx +++ b/chart2/source/inc/Diagram.hxx @@ -243,6 +243,9 @@ public: rtl::Reference< ::chart::DataSeries > > > getDataSeriesGroups(); + std::vector< rtl::Reference< ::chart::DataSeries > > + getDataSeries(); + private: // ____ XModifyListener ____ virtual void SAL_CALL modified( diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx index ab88483664cb..e62c4c5dc3da 100644 --- a/chart2/source/inc/DiagramHelper.hxx +++ b/chart2/source/inc/DiagramHelper.hxx @@ -166,10 +166,6 @@ public: const rtl::Reference< ::chart::Diagram >& xDiagram, const css::uno::Reference< css::chart2::XDataSeries >& xSeries ); - static std::vector< rtl::Reference< ::chart::DataSeries > > - getDataSeriesFromDiagram( - const rtl::Reference< ::chart::Diagram > & xDiagram ); - static css::uno::Sequence< OUString > getExplicitSimpleCategories( ChartModel& rModel ); diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx index 2005eb90feda..5728b645e1e2 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -759,7 +759,7 @@ sal_Int32 Diagram::getCorrectedMissingValueTreatment( void Diagram::setGeometry3D( sal_Int32 nNewGeometry ) { std::vector< rtl::Reference< DataSeries > > aSeriesVec = - DiagramHelper::getDataSeriesFromDiagram( this ); + getDataSeries(); for (auto const& series : aSeriesVec) { @@ -774,8 +774,7 @@ sal_Int32 Diagram::getGeometry3D( bool& rbFound, bool& rbAmbiguous ) rbFound = false; rbAmbiguous = false; - std::vector< rtl::Reference< DataSeries > > aSeriesVec = - DiagramHelper::getDataSeriesFromDiagram( this ); + std::vector< rtl::Reference< DataSeries > > aSeriesVec = getDataSeries(); if( aSeriesVec.empty()) rbAmbiguous = true; @@ -1227,6 +1226,30 @@ Diagram::getDataSeriesGroups() return aResult; } +std::vector< rtl::Reference< ::chart::DataSeries > > + Diagram::getDataSeries() +{ + std::vector< rtl::Reference< DataSeries > > aResult; + try + { + for( rtl::Reference< BaseCoordinateSystem > const & coords : getBaseCoordinateSystems() ) + { + for( rtl::Reference< ChartType> const & chartType : coords->getChartTypes2() ) + { + const std::vector< rtl::Reference< DataSeries > > aSeriesSeq( chartType->getDataSeries2() ); + aResult.insert( aResult.end(), aSeriesSeq.begin(), aSeriesSeq.end() ); + } + } + } + catch( const uno::Exception & ) + { + DBG_UNHANDLED_EXCEPTION("chart2"); + } + + return aResult; +} + + } // namespace chart extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * diff --git a/chart2/source/model/template/AreaChartTypeTemplate.cxx b/chart2/source/model/template/AreaChartTypeTemplate.cxx index 6d2c35f45b51..d1f63b2ba866 100644 --- a/chart2/source/model/template/AreaChartTypeTemplate.cxx +++ b/chart2/source/model/template/AreaChartTypeTemplate.cxx @@ -188,7 +188,7 @@ void AreaChartTypeTemplate::resetStyles2( const rtl::Reference< ::chart::Diagram { ChartTypeTemplate::resetStyles2( xDiagram ); std::vector< rtl::Reference< ::chart::DataSeries > > aSeriesVec( - DiagramHelper::getDataSeriesFromDiagram( xDiagram )); + xDiagram->getDataSeries()); uno::Any aLineStyleAny( drawing::LineStyle_NONE ); for (auto const& series : aSeriesVec) { diff --git a/chart2/source/model/template/BarChartTypeTemplate.cxx b/chart2/source/model/template/BarChartTypeTemplate.cxx index 51f01db94f0b..9cadbadb8980 100644 --- a/chart2/source/model/template/BarChartTypeTemplate.cxx +++ b/chart2/source/model/template/BarChartTypeTemplate.cxx @@ -260,7 +260,7 @@ void BarChartTypeTemplate::resetStyles2( { ChartTypeTemplate::resetStyles2( xDiagram ); std::vector< rtl::Reference< DataSeries > > aSeriesVec( - DiagramHelper::getDataSeriesFromDiagram( xDiagram )); + xDiagram->getDataSeries()); uno::Any aLineStyleAny( drawing::LineStyle_NONE ); for (auto const& series : aSeriesVec) { diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index 383fcac73163..5bfbc897e10b 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -252,7 +252,7 @@ void ChartTypeTemplate::changeDiagramData( { // interpret new data and re-use existing series std::vector< rtl::Reference< DataSeries > > aFlatSeriesSeq = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); const sal_Int32 nFormerSeriesCount = aFlatSeriesSeq.size(); rtl::Reference< DataInterpreter > xInterpreter( getDataInterpreter2()); InterpretedData aData = diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx index c37e9cda2b94..6b04b3094c9c 100644 --- a/chart2/source/model/template/LineChartTypeTemplate.cxx +++ b/chart2/source/model/template/LineChartTypeTemplate.cxx @@ -181,7 +181,7 @@ bool LineChartTypeTemplate::matchesTemplate2( bool bLineFound = false; std::vector< rtl::Reference< DataSeries > > aSeriesVec = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); for (auto const& series : aSeriesVec) { diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx index 8366487cbd35..ce5813e05063 100644 --- a/chart2/source/model/template/NetChartTypeTemplate.cxx +++ b/chart2/source/model/template/NetChartTypeTemplate.cxx @@ -101,7 +101,7 @@ bool NetChartTypeTemplate::matchesTemplate2( bool bLineFound = false; std::vector< rtl::Reference< DataSeries > > aSeriesVec = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); for (auto const& series : aSeriesVec) { diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx index 44d0759f50a4..84e3f1227a07 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.cxx +++ b/chart2/source/model/template/PieChartTypeTemplate.cxx @@ -292,7 +292,7 @@ bool PieChartTypeTemplate::matchesTemplate2( sal_Int32 nOuterSeriesIndex = 0; std::vector< rtl::Reference< DataSeries > > aSeriesVec = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); //tdf#108067 The outer series is the last series in OOXML-heavy environments if( !officecfg::Office::Compatibility::View::ReverseXAxisOrientationDoughnutChart::get() ) @@ -533,7 +533,7 @@ void PieChartTypeTemplate::resetStyles2( const rtl::Reference< ::chart::Diagram // vary colors by point, // line style std::vector< rtl::Reference< DataSeries > > aSeriesVec = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); uno::Any aLineStyleAny( drawing::LineStyle_NONE ); for (auto const& series : aSeriesVec) { diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx index 2f41025f9f3b..e54d202bb1d3 100644 --- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx +++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx @@ -209,7 +209,7 @@ bool ScatterChartTypeTemplate::matchesTemplate2( bool bLineFound = false; std::vector< rtl::Reference< DataSeries > > aSeriesVec = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); for (auto const& series : aSeriesVec) { diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx index 566d008adb6b..24662ebdd57a 100644 --- a/chart2/source/model/template/StockChartTypeTemplate.cxx +++ b/chart2/source/model/template/StockChartTypeTemplate.cxx @@ -231,7 +231,7 @@ void StockChartTypeTemplate::resetStyles2( if( getDimension() == 3 ) { std::vector< rtl::Reference< DataSeries > > aSeriesVec = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); for (auto const& series : aSeriesVec) { series->setPropertyValue( "AttachedAxisIndex", uno::Any( sal_Int32(0) ) ); diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index b56f7e9b0e57..54575f97c052 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -486,7 +486,7 @@ void AxisHelper::hideAxisIfNoDataIsAttached( const rtl::Reference< Axis >& xAxis { //axis is hidden if no data is attached anymore but data is available bool bOtherSeriesAttachedToThisAxis = false; - std::vector< rtl::Reference< DataSeries > > aSeriesVector = DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + std::vector< rtl::Reference< DataSeries > > aSeriesVector = xDiagram->getDataSeries(); for (auto const& series : aSeriesVector) { rtl::Reference< Axis > xCurrentAxis = DiagramHelper::getAttachedAxis(series, xDiagram ); @@ -1126,7 +1126,7 @@ void AxisHelper::setRTLAxisLayout( const rtl::Reference< BaseCoordinateSystem >& rtl::Reference< ChartType > AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( const rtl::Reference< Diagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ) { rtl::Reference< ChartType > xChartType; - std::vector< rtl::Reference< DataSeries > > aSeriesVector = DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + std::vector< rtl::Reference< DataSeries > > aSeriesVector = xDiagram->getDataSeries(); for (auto const& series : aSeriesVector) { sal_Int32 nCurrentIndex = DataSeriesHelper::getAttachedAxisIndex(series); diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx index f1b803211543..d28f64ee7c7a 100644 --- a/chart2/source/tools/ChartModelHelper.cxx +++ b/chart2/source/tools/ChartModelHelper.cxx @@ -116,7 +116,7 @@ std::vector< rtl::Reference< DataSeries > > ChartModelHelper::getDataSeries( rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram( xChartDoc ); if( xDiagram.is()) - aResult = DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + aResult = xDiagram->getDataSeries(); return aResult; } diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx index 57fef259b1f8..83e54cb0f032 100644 --- a/chart2/source/tools/DataSourceHelper.cxx +++ b/chart2/source/tools/DataSourceHelper.cxx @@ -225,7 +225,9 @@ rtl::Reference< DataSource > DataSourceHelper::pressUsedDataIntoRectangularForma if( xCategories.is() ) aResultVector.push_back( xCategories ); - std::vector< rtl::Reference< DataSeries > > aSeriesVector = DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + std::vector< rtl::Reference< DataSeries > > aSeriesVector; + if (xDiagram) + aSeriesVector = xDiagram->getDataSeries(); uno::Reference< chart2::data::XDataSource > xSeriesSource = DataSeriesHelper::getDataSource( aSeriesVector ); const Sequence< Reference< chart2::data::XLabeledDataSequence > > aDataSequences( xSeriesSource->getDataSequences() ); @@ -258,7 +260,7 @@ uno::Sequence< OUString > DataSourceHelper::getUsedDataRanges( if( xCategories.is() ) lcl_addRanges( aResult, xCategories ); - std::vector< rtl::Reference< DataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); + std::vector< rtl::Reference< DataSeries > > aSeriesVector( xDiagram->getDataSeries() ); for (auto const& series : aSeriesVector) { lcl_addDataSourceRanges( aResult, series ); diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 4dc6c40c184c..60f1376b2f25 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -596,33 +596,6 @@ rtl::Reference< ChartType > DiagramHelper::getChartTypeOfSeries( return nullptr; } -std::vector< rtl::Reference< ::chart::DataSeries > > - DiagramHelper::getDataSeriesFromDiagram( - const rtl::Reference< Diagram > & xDiagram ) -{ - std::vector< rtl::Reference< DataSeries > > aResult; - if (!xDiagram) - return aResult; - - try - { - for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() ) - { - for( rtl::Reference< ChartType> const & chartType : coords->getChartTypes2() ) - { - const std::vector< rtl::Reference< DataSeries > > aSeriesSeq( chartType->getDataSeries2() ); - aResult.insert( aResult.end(), aSeriesSeq.begin(), aSeriesSeq.end() ); - } - } - } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } - - return aResult; -} - static void lcl_generateAutomaticCategoriesFromChartType( Sequence< OUString >& rRet, const rtl::Reference< ChartType >& xChartType ) diff --git a/chart2/source/tools/ReferenceSizeProvider.cxx b/chart2/source/tools/ReferenceSizeProvider.cxx index 40edf87d2f30..41580bdb14fe 100644 --- a/chart2/source/tools/ReferenceSizeProvider.cxx +++ b/chart2/source/tools/ReferenceSizeProvider.cxx @@ -95,7 +95,7 @@ void ReferenceSizeProvider::setValuesAtAllDataSeries() // DataSeries/Points std::vector< rtl::Reference< DataSeries > > aSeries = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); for (auto const& elem : aSeries) { @@ -253,7 +253,7 @@ ReferenceSizeProvider::AutoResizeState ReferenceSizeProvider::getAutoResizeState // DataSeries/Points std::vector< rtl::Reference< DataSeries > > aSeries = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); for (auto const& elem : aSeries) { diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 2ff161bf0cf7..7ec09089c4cb 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -36,6 +36,7 @@ #include <ChartModel.hxx> #include <ChartModelHelper.hxx> #include <DataSeries.hxx> +#include <Diagram.hxx> #include <ResId.hxx> #include <strings.hrc> #include <DiagramHelper.hxx> @@ -847,7 +848,7 @@ std::vector< rtl::Reference< RegressionCurveModel > > const rtl::Reference< Diagram > & xDiagram ) { std::vector< rtl::Reference< RegressionCurveModel > > aResult; - std::vector< rtl::Reference< DataSeries > > aSeries( DiagramHelper::getDataSeriesFromDiagram( xDiagram )); + std::vector< rtl::Reference< DataSeries > > aSeries( xDiagram->getDataSeries()); for (auto const& elem : aSeries) { for( rtl::Reference< RegressionCurveModel > const & curve : elem->getRegressionCurves2() ) diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx index 4990244ed3a8..099adeca75ea 100644 --- a/chart2/source/tools/ThreeDHelper.cxx +++ b/chart2/source/tools/ThreeDHelper.cxx @@ -1294,7 +1294,7 @@ void ThreeDHelper::getRoundedEdgesAndObjectLines( drawing::LineStyle aLineStyle( drawing::LineStyle_SOLID ); std::vector< rtl::Reference< DataSeries > > aSeriesList = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); sal_Int32 nSeriesCount = static_cast<sal_Int32>( aSeriesList.size() ); OUString aPercentDiagonalPropertyName( "PercentDiagonal" ); @@ -1393,7 +1393,7 @@ void ThreeDHelper::setRoundedEdgesAndObjectLines( uno::Any aARoundedEdges( static_cast< sal_Int16 >( nRoundedEdges )); std::vector< rtl::Reference< DataSeries > > aSeriesList = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); + xDiagram->getDataSeries(); for( auto const& xSeries : aSeriesList) { if( nRoundedEdges>=0 && nRoundedEdges<=100 ) diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx b/chart2/source/view/main/SeriesPlotterContainer.cxx index c9e0b7239aea..43a04c70e5d3 100644 --- a/chart2/source/view/main/SeriesPlotterContainer.cxx +++ b/chart2/source/view/main/SeriesPlotterContainer.cxx @@ -567,8 +567,7 @@ void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries(ChartModel& bool bSeriesAttachedToThisAxis = false; sal_Int32 nAttachedAxisIndex = -1; { - std::vector<rtl::Reference<DataSeries>> aSeriesVector - = DiagramHelper::getDataSeriesFromDiagram(xDiagram); + std::vector<rtl::Reference<DataSeries>> aSeriesVector = xDiagram->getDataSeries(); for (auto const& series : aSeriesVector) { sal_Int32 nCurrentIndex = DataSeriesHelper::getAttachedAxisIndex(series);