chart2/source/controller/dialogs/ObjectNameProvider.cxx | 2 - chart2/source/inc/DiagramHelper.hxx | 9 ++++--- chart2/source/inc/ExplicitCategoriesProvider.hxx | 9 ++++--- chart2/source/tools/AxisHelper.cxx | 2 - chart2/source/tools/ChartTypeHelper.cxx | 1 chart2/source/tools/DiagramHelper.cxx | 19 ++++++---------- chart2/source/tools/ExplicitCategoriesProvider.cxx | 10 ++++---- 7 files changed, 26 insertions(+), 26 deletions(-)
New commits: commit 0e570fafd319c6567d798ff9e5530099c53312ee Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Wed Jan 26 19:22:07 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jan 27 19:45:48 2022 +0100 use more concrete types in chart2, BaseCoordinateSystem Change-Id: I76c3c094e94a21b65034dbc80bf98e4b4e3f57af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129054 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx index 9f40c536e241..6da483d2f39e 100644 --- a/chart2/source/inc/DiagramHelper.hxx +++ b/chart2/source/inc/DiagramHelper.hxx @@ -42,6 +42,7 @@ namespace com::sun::star::util { class XNumberFormatsSupplier; } namespace chart { +class BaseCoordinateSystem; class ChartType; class ChartTypeManager; class ChartTypeTemplate; @@ -119,7 +120,7 @@ public: static StackMode getStackModeFromChartType( const rtl::Reference< ::chart::ChartType > & xChartType, bool& rbFound, bool& rbAmbiguous, - const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem + const rtl::Reference< ::chart::BaseCoordinateSystem > & xCorrespondingCoordinateSystem ); /** Returns the dimension found for all chart types in the tree. If the @@ -144,8 +145,8 @@ public: */ SAL_DLLPRIVATE static void replaceCoordinateSystem( const rtl::Reference< ::chart::Diagram > & xDiagram, - const css::uno::Reference< css::chart2::XCoordinateSystem > & xCooSysToReplace, - const css::uno::Reference< css::chart2::XCoordinateSystem > & xReplacement ); + const rtl::Reference< ::chart::BaseCoordinateSystem > & xCooSysToReplace, + const rtl::Reference< ::chart::BaseCoordinateSystem > & xReplacement ); static bool isSeriesAttachedToMainAxis( const css::uno::Reference< css::chart2::XDataSeries >& xDataSeries ); @@ -195,7 +196,7 @@ public: SAL_DLLPRIVATE static css::uno::Sequence< OUString > generateAutomaticCategoriesFromCooSys( - const css::uno::Reference< css::chart2::XCoordinateSystem > & xCooSys ); + const rtl::Reference< ::chart::BaseCoordinateSystem > & xCooSys ); static void switchToDateCategories( const rtl::Reference<::chart::ChartModel> & xChartDoc ); diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index 0942953be7ce..289d7adf150d 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -19,6 +19,7 @@ #include <ChartTypeHelper.hxx> #include <ChartType.hxx> +#include <BaseCoordinateSystem.hxx> #include <DiagramHelper.hxx> #include <servicenames_charttypes.hxx> diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 99618fdd44d2..04c049dc2228 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -325,7 +325,7 @@ StackMode DiagramHelper::getStackMode( const rtl::Reference< Diagram > & xDiagra StackMode DiagramHelper::getStackModeFromChartType( const rtl::Reference< ChartType > & xChartType, bool& rbFound, bool& rbAmbiguous, - const Reference< XCoordinateSystem > & xCorrespondingCoordinateSystem ) + const rtl::Reference< BaseCoordinateSystem > & xCorrespondingCoordinateSystem ) { StackMode eStackMode = StackMode::NONE; rbFound = false; @@ -485,8 +485,8 @@ void DiagramHelper::setDimension( void DiagramHelper::replaceCoordinateSystem( const rtl::Reference< Diagram > & xDiagram, - const Reference< XCoordinateSystem > & xCooSysToReplace, - const Reference< XCoordinateSystem > & xReplacement ) + const rtl::Reference< BaseCoordinateSystem > & xCooSysToReplace, + const rtl::Reference< BaseCoordinateSystem > & xReplacement ) { OSL_ASSERT( xDiagram.is()); if( ! xDiagram.is()) @@ -499,9 +499,7 @@ void DiagramHelper::replaceCoordinateSystem( Reference< chart2::data::XLabeledDataSequence > xCategories = DiagramHelper::getCategoriesFromDiagram( xDiagram ); // move chart types of xCooSysToReplace to xReplacement - Reference< XChartTypeContainer > xCTCntCooSys( xCooSysToReplace, uno::UNO_QUERY_THROW ); - Reference< XChartTypeContainer > xCTCntReplacement( xReplacement, uno::UNO_QUERY_THROW ); - xCTCntReplacement->setChartTypes( xCTCntCooSys->getChartTypes()); + xReplacement->setChartTypes( xCooSysToReplace->getChartTypes()); xDiagram->removeCoordinateSystem( xCooSysToReplace ); xDiagram->addCoordinateSystem( xReplacement ); @@ -863,15 +861,14 @@ static void lcl_generateAutomaticCategoriesFromChartType( } } -Sequence< OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const Reference< XCoordinateSystem > & xCooSys ) +Sequence< OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const rtl::Reference< BaseCoordinateSystem > & xCooSys ) { Sequence< OUString > aRet; - Reference< XChartTypeContainer > xTypeCntr( xCooSys, uno::UNO_QUERY ); - if( xTypeCntr.is() ) + if( xCooSys.is() ) { - const Sequence< Reference< XChartType > > aChartTypes( xTypeCntr->getChartTypes() ); - for( Reference< XChartType > const & chartType : aChartTypes ) + const std::vector< rtl::Reference< ChartType > > & aChartTypes( xCooSys->getChartTypes2() ); + for( rtl::Reference< ChartType > const & chartType : aChartTypes ) { lcl_generateAutomaticCategoriesFromChartType( aRet, chartType ); if( aRet.hasElements() ) commit 883ae88f297fc83a5a47a85dbcd1802a15e8eb3c Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Wed Jan 26 19:00:52 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jan 27 19:45:32 2022 +0100 use more concrete types in chart2, BaseCoordinateSystem Change-Id: Iacbca66dbb5cfe617c5e8ca25796a7261f1ce10d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129053 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index 5bf7efbbd144..7221030ba494 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -98,7 +98,7 @@ void lcl_addText( OUString& rOut, std::u16string_view rSeparator, std::u16string } OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal_Int32 nPointIndex, - const Reference< XCoordinateSystem >& xCooSys, + const rtl::Reference< BaseCoordinateSystem >& xCooSys, const Reference< frame::XModel >& xChartModel ) { diff --git a/chart2/source/inc/ExplicitCategoriesProvider.hxx b/chart2/source/inc/ExplicitCategoriesProvider.hxx index 63097a3aea11..e8d1ebf50664 100644 --- a/chart2/source/inc/ExplicitCategoriesProvider.hxx +++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx @@ -19,7 +19,7 @@ #pragma once #include "charttoolsdllapi.hxx" -#include <cppuhelper/weakref.hxx> +#include <unotools/weakref.hxx> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Sequence.h> @@ -33,6 +33,7 @@ namespace com::sun::star::uno { class Any; } namespace chart { +class BaseCoordinateSystem; struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory { @@ -55,7 +56,7 @@ public: class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider final { public: - ExplicitCategoriesProvider( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSysModel + ExplicitCategoriesProvider( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSysModel , ChartModel& rChartModel ); ~ExplicitCategoriesProvider(); @@ -68,7 +69,7 @@ public: const std::vector<ComplexCategory>* getCategoriesByLevel( sal_Int32 nLevel ); static OUString getCategoryByIndex( - const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSysModel + const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSysModel , ChartModel& rModel , sal_Int32 nIndex ); @@ -93,7 +94,7 @@ private: ExplicitCategoriesProvider& operator =(ExplicitCategoriesProvider const &) = delete; bool volatile m_bDirty; - css::uno::WeakReference< css::chart2::XCoordinateSystem > m_xCooSysModel; + unotools::WeakReference< ::chart::BaseCoordinateSystem > m_xCooSysModel; ChartModel& mrModel; css::uno::Reference< css::chart2::data::XLabeledDataSequence> m_xOriginalCategories; diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 595c607eda1a..9d8af98c757f 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -101,7 +101,7 @@ bool AxisHelper::isLogarithmic( const Reference< XScaling >& xScaling ) chart2::ScaleData AxisHelper::getDateCheckedScale( const Reference< chart2::XAxis >& xAxis, ChartModel& rModel ) { ScaleData aScale = xAxis->getScaleData(); - Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( &rModel ) ); + rtl::Reference< BaseCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( &rModel ) ); if( aScale.AutoDateAxis && aScale.AxisType == AxisType::CATEGORY ) { sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0; diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index 7c294acc2778..5d69decfdd03 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -46,10 +46,10 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using std::vector; -ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2::XCoordinateSystem >& xCooSysModel +ExplicitCategoriesProvider::ExplicitCategoriesProvider( const rtl::Reference< BaseCoordinateSystem >& xCooSysModel , ChartModel& rModel ) : m_bDirty(true) - , m_xCooSysModel( xCooSysModel ) + , m_xCooSysModel( xCooSysModel.get() ) , mrModel(rModel) , m_bIsExplicitCategoriesInited(false) , m_bIsDateAxis(false) @@ -481,7 +481,7 @@ void ExplicitCategoriesProvider::init() { if(m_bIsDateAxis) { - if( ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( m_xCooSysModel, 0 ), 0 ) ) + if( ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( m_xCooSysModel.get(), 0 ), 0 ) ) m_bIsDateAxis = lcl_fillDateCategories( m_xOriginalCategories->getValues(), m_aDateCategories, m_bIsAutoDate, mrModel ); else m_bIsDateAxis = false; @@ -518,7 +518,7 @@ Sequence< OUString > const & ExplicitCategoriesProvider::getSimpleCategories() } } if(!m_aExplicitCategories.hasElements()) - m_aExplicitCategories = DiagramHelper::generateAutomaticCategoriesFromCooSys( m_xCooSysModel ); + m_aExplicitCategories = DiagramHelper::generateAutomaticCategoriesFromCooSys( m_xCooSysModel.get() ); m_bIsExplicitCategoriesInited = true; } return m_aExplicitCategories; @@ -534,7 +534,7 @@ const std::vector<ComplexCategory>* ExplicitCategoriesProvider::getCategoriesByL } OUString ExplicitCategoriesProvider::getCategoryByIndex( - const Reference< XCoordinateSystem >& xCooSysModel + const rtl::Reference< BaseCoordinateSystem >& xCooSysModel , ChartModel& rModel , sal_Int32 nIndex ) {