chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx | 21 ++++-------- sc/inc/chart2uno.hxx | 4 -- sc/source/ui/unoobj/chart2uno.cxx | 21 ++---------- 3 files changed, 13 insertions(+), 33 deletions(-)
New commits: commit 3f0be840432453f407751398ccfab62a2243fc4e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Sep 22 14:02:47 2022 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Fri Sep 23 12:37:10 2022 +0200 tdf#151091 Revert "tdf#148635 cache some chart stuff" This reverts commit fd2ca9607431fc6ca49e37ab6fef228aa72da5f9, since it causes a regression when copying a chart. Change-Id: I5d40de6f46b4b3e68531257d27f9a81540a06da4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140427 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit c3bc67bffd1e0b9bdd60ef274a6d5e59101d322d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140391 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit a93c8d4532f49ec5fde09e4886445a4855404d60) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140393 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 563982ec2af4..85df10b878e4 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -1114,8 +1114,7 @@ public: private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - mutable Any m_aOuterValue; - mutable bool m_bDetectedRangeSegmentation { false }; + mutable Any m_aOuterValue; }; } @@ -1169,19 +1168,15 @@ Any WrappedDataRowSourceProperty::getPropertyValue( const Reference< beans::XPro bool bHasCategories = true; uno::Sequence< sal_Int32 > aSequenceMapping; - if (!m_bDetectedRangeSegmentation) + if( DataSourceHelper::detectRangeSegmentation( + m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns + , bFirstCellAsLabel, bHasCategories ) ) { - if( DataSourceHelper::detectRangeSegmentation( - m_spChart2ModelContact->getDocumentModel(), aRangeString, aSequenceMapping, bUseColumns - , bFirstCellAsLabel, bHasCategories ) ) - { - css::chart::ChartDataRowSource eChartDataRowSource = css::chart::ChartDataRowSource_ROWS; - if(bUseColumns) - eChartDataRowSource = css::chart::ChartDataRowSource_COLUMNS; + css::chart::ChartDataRowSource eChartDataRowSource = css::chart::ChartDataRowSource_ROWS; + if(bUseColumns) + eChartDataRowSource = css::chart::ChartDataRowSource_COLUMNS; - m_aOuterValue <<= eChartDataRowSource; - } - m_bDetectedRangeSegmentation = true; + m_aOuterValue <<= eChartDataRowSource; } return m_aOuterValue; diff --git a/sc/inc/chart2uno.hxx b/sc/inc/chart2uno.hxx index 72a6374be739..a5e4f53b032f 100644 --- a/sc/inc/chart2uno.hxx +++ b/sc/inc/chart2uno.hxx @@ -147,10 +147,6 @@ private: ScDocument* m_pDocument; SfxItemPropertySet m_aPropSet; bool m_bIncludeHiddenCells; - css::uno::Reference< css::chart2::data::XDataSource > mxCachedDataSource; - css::uno::Sequence< css::beans::PropertyValue > maCachedArguments; - css::uno::Sequence< css::beans::PropertyValue > maCreateDataSourceArguments; - css::uno::Reference< css::chart2::data::XDataSource > mxCreatedDataSource; }; // DataSource diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 8cbdfd6c2b64..5beaf2f55ad6 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -1403,11 +1403,7 @@ ScChart2DataProvider::createDataSource( if ( ! m_pDocument ) throw uno::RuntimeException(); - // This is expensive to compute and we get called more than once, so cache - if (maCreateDataSourceArguments == aArguments) - return mxCreatedDataSource; - maCreateDataSourceArguments = aArguments; - + uno::Reference< chart2::data::XDataSource> xResult; bool bLabel = true; bool bCategories = false; bool bOrientCol = true; @@ -1494,7 +1490,7 @@ ScChart2DataProvider::createDataSource( const Chart2PositionMap* pChartMap = aChPositioner.getPositionMap(); if (!pChartMap) // No chart position map instance. Bail out. - return mxCreatedDataSource; + return xResult; rtl::Reference<ScChart2DataSource> pDS; ::std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aSeqs; @@ -1572,8 +1568,8 @@ ScChart2DataProvider::createDataSource( } } - mxCreatedDataSource.set(pDS); - return mxCreatedDataSource; + xResult.set( pDS ); + return xResult; } namespace @@ -1765,10 +1761,6 @@ std::pair<OUString, OUString> constructKey(const uno::Reference< chart2::data::X uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArguments( const uno::Reference< chart2::data::XDataSource >& xDataSource ) { - // Cache these because this is expensive to compute and we get called more than once - if (xDataSource == mxCachedDataSource) - return maCachedArguments; - ::std::vector< beans::PropertyValue > aResult; bool bRowSourceDetected = false; bool bFirstCellAsLabel = false; @@ -2034,10 +2026,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum } } - mxCachedDataSource = xDataSource; - maCachedArguments = comphelper::containerToSequence( aResult ); - - return maCachedArguments; + return comphelper::containerToSequence( aResult ); } sal_Bool SAL_CALL ScChart2DataProvider::createDataSequenceByRangeRepresentationPossible( const OUString& aRangeRepresentation )