diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-19 15:15:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-19 20:00:25 +0100 |
commit | 2064cdb1cd908a3ee55a54f0aeb4aee15f7c12da (patch) | |
tree | 8a038421eeb3e082f3b6a0092f67c15492dc35c8 /chart2 | |
parent | b7313bc131a285056906f85b51b0c3b53b7b3560 (diff) |
use more concrete types in chart2, BaseCoordinateSystem
Change-Id: I1c246a3ea37595647ac254f492170a9e18540794
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128623
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
37 files changed, 161 insertions, 143 deletions
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx index f00c812678b4..c943bd4e085f 100644 --- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx +++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx @@ -28,6 +28,7 @@ #include <AxisHelper.hxx> #include <ChartView.hxx> #include <DiagramHelper.hxx> +#include <BaseCoordinateSystem.hxx> #include <ChartModel.hxx> diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index bc5557b61a17..44bcaa623d11 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -31,6 +31,7 @@ #include <chartview/ExplicitValueProvider.hxx> #include <chartview/DrawModelWrapper.hxx> #include "Chart2ModelContact.hxx" +#include <BaseCoordinateSystem.hxx> #include <ChartModel.hxx> diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx index 6c88024a7d08..0cf33baa5848 100644 --- a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx @@ -21,6 +21,7 @@ #include <AxisHelper.hxx> #include "Chart2ModelContact.hxx" #include <AxisIndexDefines.hxx> +#include <BaseCoordinateSystem.hxx> #include <LinePropertiesHelper.hxx> #include <UserDefinedProperties.hxx> diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx index 4e73b52bd2b7..e1261b1dd154 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx @@ -29,6 +29,7 @@ #include <ControllerLockGuard.hxx> #include <AxisHelper.hxx> #include <unonames.hxx> +#include <BaseCoordinateSystem.hxx> #include <com/sun/star/chart2/DataPointGeometry3D.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index f11d2cf856da..733cd3cbfd8b 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -30,6 +30,7 @@ #include <ChartTypeTemplate.hxx> #include <chartview/ExplicitValueProvider.hxx> #include <ExplicitCategoriesProvider.hxx> +#include <BaseCoordinateSystem.hxx> #include <ChartModel.hxx> #include <unonames.hxx> diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index 4ee9c92d6f93..b2e101ee0ef4 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -35,6 +35,7 @@ #include <CommonConverters.hxx> #include <NumberFormatterWrapper.hxx> #include <RegressionCurveHelper.hxx> +#include <BaseCoordinateSystem.hxx> #include <rtl/math.hxx> #include <rtl/ustring.hxx> #include <vcl/settings.hxx> diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index feaa93330308..a380357c12f9 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -44,6 +44,7 @@ #include <ChartModel.hxx> #include <CommonConverters.hxx> #include <RegressionCalculationHelper.hxx> +#include <BaseCoordinateSystem.hxx> #include <com/sun/star/chart2/AxisType.hpp> #include <com/sun/star/chart2/XAxis.hpp> @@ -163,7 +164,7 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel m_bHasNumberProperties = true; //is the crossing main axis a category axes?: - uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) ); + rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) ); uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) ); if( xCrossingMainAxis.is() ) { diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index 70836e572c4a..893b37564950 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -31,6 +31,7 @@ #include <ChartTypeHelper.hxx> #include <Diagram.hxx> #include <unonames.hxx> +#include <BaseCoordinateSystem.hxx> #include <memory> #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> @@ -354,7 +355,7 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI //read only item //necessary tp display the crossing value with an appropriate format - Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( + rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) ); Reference< chart2::XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) ); diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx index f4a1014743b0..b81d50e8f565 100644 --- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx @@ -27,6 +27,7 @@ #include <ChartTypeHelper.hxx> #include <DataSeriesHelper.hxx> #include <ChartModel.hxx> +#include <BaseCoordinateSystem.hxx> #include <com/sun/star/chart2/XDataSeries.hpp> diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx index b16673f97fcb..abe9ee1e257e 100644 --- a/chart2/source/inc/AxisHelper.hxx +++ b/chart2/source/inc/AxisHelper.hxx @@ -20,6 +20,7 @@ #include "charttoolsdllapi.hxx" #include <com/sun/star/chart2/ScaleData.hpp> +#include <rtl/ref.hxx> #include <vector> @@ -37,6 +38,7 @@ namespace com::sun::star::uno { class XComponentContext; } namespace chart { +class BaseCoordinateSystem; class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper { @@ -105,12 +107,12 @@ public: static bool isAxisVisible( const css::uno::Reference< css::chart2::XAxis >& xAxis ); static bool isGridVisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties ); - static css::uno::Reference< css::chart2::XCoordinateSystem > + static rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemByIndex( const css::uno::Reference< css::chart2::XDiagram >& xDiagram , sal_Int32 nIndex ); - static css::uno::Reference< css::chart2::XCoordinateSystem > + static rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemOfAxis( const css::uno::Reference< css::chart2::XAxis >& xAxis , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); diff --git a/chart2/source/model/inc/BaseCoordinateSystem.hxx b/chart2/source/inc/BaseCoordinateSystem.hxx index 1afa0e290b5d..bc8744e0538a 100644 --- a/chart2/source/model/inc/BaseCoordinateSystem.hxx +++ b/chart2/source/inc/BaseCoordinateSystem.hxx @@ -18,7 +18,7 @@ */ #pragma once -#include <OPropertySet.hxx> +#include "OPropertySet.hxx" #include <cppuhelper/basemutex.hxx> #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> @@ -26,7 +26,7 @@ #include <com/sun/star/chart2/XCoordinateSystem.hpp> #include <com/sun/star/chart2/XChartTypeContainer.hpp> #include <com/sun/star/util/XCloneable.hpp> -#include <ModifyListenerHelper.hxx> +#include "ModifyListenerHelper.hxx" #include <vector> @@ -69,7 +69,6 @@ public: /// merge XTypeProvider implementations DECLARE_XTYPEPROVIDER() -protected: // ____ XCoordinateSystem ____ virtual ::sal_Int32 SAL_CALL getDimension() override; virtual void SAL_CALL setAxisByDimension( @@ -95,6 +94,8 @@ protected: virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; +protected: + // ____ XModifyListener ____ virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx index ee443a5def25..5a17e2971d05 100644 --- a/chart2/source/inc/ChartModelHelper.hxx +++ b/chart2/source/inc/ChartModelHelper.hxx @@ -37,6 +37,7 @@ namespace com::sun::star::view { class XSelectionSupplier; } namespace chart { +class BaseCoordinateSystem; class Diagram; class OOO_DLLPUBLIC_CHARTTOOLS ChartModelHelper @@ -54,10 +55,10 @@ public: static rtl::Reference< Diagram > findDiagram( const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc ); - static css::uno::Reference< css::chart2::XCoordinateSystem > + static rtl::Reference< ::chart::BaseCoordinateSystem > getFirstCoordinateSystem( ChartModel& rModel ); - static css::uno::Reference< css::chart2::XCoordinateSystem > + static rtl::Reference< ::chart::BaseCoordinateSystem > getFirstCoordinateSystem( const css::uno::Reference< css::frame::XModel >& xModel ); SAL_DLLPRIVATE static std::vector< css::uno::Reference< css::chart2::XDataSeries > > diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx index a5d7119bff98..bda6d4f0796c 100644 --- a/chart2/source/inc/DataSeriesHelper.hxx +++ b/chart2/source/inc/DataSeriesHelper.hxx @@ -22,6 +22,7 @@ #include "charttoolsdllapi.hxx" #include <com/sun/star/uno/Reference.h> #include <rtl/ustring.hxx> +#include <rtl/ref.hxx> #include <vector> @@ -35,6 +36,7 @@ namespace com::sun::star::chart2::data { class XDataSource; } namespace com::sun::star::chart2::data { class XLabeledDataSequence; } namespace com::sun::star::uno { class Any; } namespace com::sun::star::uno { template <class E> class Sequence; } +namespace chart { class BaseCoordinateSystem; } namespace chart::DataSeriesHelper { @@ -114,7 +116,7 @@ OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getNumberFormatKeyFromAxis( sal_Int32 nAxisIndex = -1 ); OOO_DLLPUBLIC_CHARTTOOLS -css::uno::Reference< css::chart2::XCoordinateSystem > +rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemOfSeries( const css::uno::Reference< css::chart2::XDataSeries > & xSeries, const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); diff --git a/chart2/source/inc/Diagram.hxx b/chart2/source/inc/Diagram.hxx index 256a2c24ca6d..5d6dc79a1ee1 100644 --- a/chart2/source/inc/Diagram.hxx +++ b/chart2/source/inc/Diagram.hxx @@ -40,6 +40,7 @@ namespace com::sun::star::uno { class XComponentContext; } namespace chart { class Wall; +class BaseCoordinateSystem; namespace impl { @@ -137,6 +138,12 @@ public: virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + typedef + std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > + tCoordinateSystemContainerType; + + const tCoordinateSystemContainerType & getBaseCoordinateSystems() { return m_aCoordSystems; } + private: // ____ XModifyListener ____ @@ -155,10 +162,6 @@ private: css::uno::Reference< css::uno::XComponentContext > m_xContext; - typedef - std::vector< css::uno::Reference< css::chart2::XCoordinateSystem > > - tCoordinateSystemContainerType; - tCoordinateSystemContainerType m_aCoordSystems; rtl::Reference< Wall > m_xWall; diff --git a/chart2/source/model/inc/CartesianCoordinateSystem.hxx b/chart2/source/model/inc/CartesianCoordinateSystem.hxx index 34dcb03fd37c..d84f53bf5719 100644 --- a/chart2/source/model/inc/CartesianCoordinateSystem.hxx +++ b/chart2/source/model/inc/CartesianCoordinateSystem.hxx @@ -18,7 +18,7 @@ */ #pragma once -#include "BaseCoordinateSystem.hxx" +#include <BaseCoordinateSystem.hxx> namespace chart { diff --git a/chart2/source/model/inc/PolarCoordinateSystem.hxx b/chart2/source/model/inc/PolarCoordinateSystem.hxx index 0beb0ddc6de0..43eaefa5b0d6 100644 --- a/chart2/source/model/inc/PolarCoordinateSystem.hxx +++ b/chart2/source/model/inc/PolarCoordinateSystem.hxx @@ -18,7 +18,7 @@ */ #pragma once -#include "BaseCoordinateSystem.hxx" +#include <BaseCoordinateSystem.hxx> namespace chart { diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index cffa42b1aa43..458d23b6283a 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -28,6 +28,7 @@ #include <AxisHelper.hxx> #include <ThreeDHelper.hxx> #include <DiagramHelper.hxx> +#include <BaseCoordinateSystem.hxx> #include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/container/XNameAccess.hpp> diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx index 43886428c62f..91b4a6b31c7b 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -30,6 +30,7 @@ #include <CloneHelper.hxx> #include <SceneProperties.hxx> #include <unonames.hxx> +#include <BaseCoordinateSystem.hxx> #include <basegfx/numeric/ftools.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -226,27 +227,16 @@ const uno::Reference< beans::XPropertySetInfo >& StaticDiagramInfo() return xPropertySetInfo; }; -/// clones a UNO-sequence of UNO-References -typedef Reference< chart2::XCoordinateSystem > lcl_tCooSysRef; -typedef std::vector< lcl_tCooSysRef > lcl_tCooSysVector; - void lcl_CloneCoordinateSystems( - const lcl_tCooSysVector & rSource, - lcl_tCooSysVector & rDestination ) + const ::chart::Diagram::tCoordinateSystemContainerType & rSource, + ::chart::Diagram::tCoordinateSystemContainerType & rDestination ) { - for( auto const & i : rSource ) + for( rtl::Reference< ::chart::BaseCoordinateSystem > const & i : rSource ) { - lcl_tCooSysRef xClone; - css::uno::Reference< css::util::XCloneable > xCloneable( i, css::uno::UNO_QUERY ); - if( xCloneable.is()) - xClone.set( xCloneable->createClone(), css::uno::UNO_QUERY ); - - if( xClone.is()) - { - rDestination.push_back( xClone ); - } - else - rDestination.push_back( i ); + auto xClone = i->createClone(); + ::chart::BaseCoordinateSystem* pClone = dynamic_cast<::chart::BaseCoordinateSystem*>(xClone.get()); + assert(pClone); + rDestination.push_back( pClone ); } } @@ -276,7 +266,8 @@ Diagram::Diagram( const Diagram & rOther ) : m_xModifyEventForwarder( new ModifyEventForwarder() ) { lcl_CloneCoordinateSystems( rOther.m_aCoordSystems, m_aCoordSystems ); - ModifyListenerHelper::addListenerToAllElements( m_aCoordSystems, m_xModifyEventForwarder ); + for (auto & xSystem : m_aCoordSystems) + xSystem->addModifyListener(m_xModifyEventForwarder); if ( rOther.m_xWall ) m_xWall = new Wall( *rOther.m_xWall ); @@ -297,7 +288,8 @@ Diagram::~Diagram() { try { - ModifyListenerHelper::removeListenerFromAllElements( m_aCoordSystems, m_xModifyEventForwarder ); + for (auto & xSystem : m_aCoordSystems) + xSystem->removeModifyListener(m_xModifyEventForwarder); if ( m_xWall ) m_xWall->removeModifyListener( m_xModifyEventForwarder ); @@ -456,9 +448,11 @@ void SAL_CALL Diagram::setDefaultIllumination() void SAL_CALL Diagram::addCoordinateSystem( const uno::Reference< chart2::XCoordinateSystem >& aCoordSys ) { + ::chart::BaseCoordinateSystem* pCoordSys = dynamic_cast<::chart::BaseCoordinateSystem*>(aCoordSys.get()); + assert(pCoordSys); { MutexGuard aGuard( m_aMutex ); - if( std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), aCoordSys ) + if( std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), pCoordSys ) != m_aCoordSystems.end()) throw lang::IllegalArgumentException("coordsys not found", static_cast<cppu::OWeakObject*>(this), 1); @@ -467,7 +461,7 @@ void SAL_CALL Diagram::addCoordinateSystem( OSL_FAIL( "more than one coordinatesystem is not supported yet by the fileformat" ); return; } - m_aCoordSystems.push_back( aCoordSys ); + m_aCoordSystems.push_back( pCoordSys ); } ModifyListenerHelper::addListener( aCoordSys, m_xModifyEventForwarder ); fireModifyEvent(); @@ -476,10 +470,11 @@ void SAL_CALL Diagram::addCoordinateSystem( void SAL_CALL Diagram::removeCoordinateSystem( const uno::Reference< chart2::XCoordinateSystem >& aCoordSys ) { + ::chart::BaseCoordinateSystem* pCoordSys = dynamic_cast<::chart::BaseCoordinateSystem*>(aCoordSys.get()); + assert(pCoordSys); { MutexGuard aGuard( m_aMutex ); - std::vector< uno::Reference< chart2::XCoordinateSystem > >::iterator - aIt( std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), aCoordSys )); + auto aIt = std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), pCoordSys ); if( aIt == m_aCoordSystems.end()) throw container::NoSuchElementException( "The given coordinate-system is no element of the container", @@ -493,7 +488,7 @@ void SAL_CALL Diagram::removeCoordinateSystem( uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > SAL_CALL Diagram::getCoordinateSystems() { MutexGuard aGuard( m_aMutex ); - return comphelper::containerToSequence( m_aCoordSystems ); + return comphelper::containerToSequence<uno::Reference< chart2::XCoordinateSystem >>( m_aCoordSystems ); } void SAL_CALL Diagram::setCoordinateSystems( @@ -504,15 +499,19 @@ void SAL_CALL Diagram::setCoordinateSystems( if( aCoordinateSystems.hasElements() ) { OSL_ENSURE( aCoordinateSystems.getLength()<=1, "more than one coordinatesystem is not supported yet by the fileformat" ); - aNew.push_back( aCoordinateSystems[0] ); + ::chart::BaseCoordinateSystem* pCoordSys = dynamic_cast<::chart::BaseCoordinateSystem*>(aCoordinateSystems[0].get()); + assert(pCoordSys); + aNew.push_back( pCoordSys ); } { MutexGuard aGuard( m_aMutex ); std::swap( aOld, m_aCoordSystems ); m_aCoordSystems = aNew; } - ModifyListenerHelper::removeListenerFromAllElements( aOld, m_xModifyEventForwarder ); - ModifyListenerHelper::addListenerToAllElements( aNew, m_xModifyEventForwarder ); + for (auto & xSystem : aOld) + xSystem->removeModifyListener(m_xModifyEventForwarder); + for (auto & xSystem : aNew) + xSystem->addModifyListener(m_xModifyEventForwarder); fireModifyEvent(); } diff --git a/chart2/source/model/template/BubbleChartType.cxx b/chart2/source/model/template/BubbleChartType.cxx index 3373a369e956..d0fc66213a97 100644 --- a/chart2/source/model/template/BubbleChartType.cxx +++ b/chart2/source/model/template/BubbleChartType.cxx @@ -113,8 +113,8 @@ uno::Reference< util::XCloneable > SAL_CALL BubbleChartType::createClone() Reference< chart2::XCoordinateSystem > SAL_CALL BubbleChartType::createCoordinateSystem( ::sal_Int32 DimensionCount ) { - Reference< chart2::XCoordinateSystem > xResult( - new CartesianCoordinateSystem( DimensionCount )); + rtl::Reference< CartesianCoordinateSystem > xResult = + new CartesianCoordinateSystem( DimensionCount ); for( sal_Int32 i=0; i<DimensionCount; ++i ) { diff --git a/chart2/source/model/template/ChartType.cxx b/chart2/source/model/template/ChartType.cxx index f734b1b55581..b93c36806096 100644 --- a/chart2/source/model/template/ChartType.cxx +++ b/chart2/source/model/template/ChartType.cxx @@ -67,8 +67,8 @@ ChartType::~ChartType() Reference< chart2::XCoordinateSystem > SAL_CALL ChartType::createCoordinateSystem( ::sal_Int32 DimensionCount ) { - Reference< chart2::XCoordinateSystem > xResult( - new CartesianCoordinateSystem( DimensionCount )); + rtl::Reference< CartesianCoordinateSystem > xResult = + new CartesianCoordinateSystem( DimensionCount ); for( sal_Int32 i=0; i<DimensionCount; ++i ) { diff --git a/chart2/source/model/template/NetChartType.cxx b/chart2/source/model/template/NetChartType.cxx index 5305111fd5bc..8aecbec7b60c 100644 --- a/chart2/source/model/template/NetChartType.cxx +++ b/chart2/source/model/template/NetChartType.cxx @@ -55,8 +55,8 @@ Reference< XCoordinateSystem > SAL_CALL "NetChart must be two-dimensional", static_cast< ::cppu::OWeakObject* >( this ), 0 ); - Reference< XCoordinateSystem > xResult( - new PolarCoordinateSystem( DimensionCount )); + rtl::Reference< PolarCoordinateSystem > xResult = + new PolarCoordinateSystem( DimensionCount ); Reference< XAxis > xAxis( xResult->getAxisByDimension( 0, MAIN_AXIS_INDEX ) ); if( xAxis.is() ) diff --git a/chart2/source/model/template/PieChartType.cxx b/chart2/source/model/template/PieChartType.cxx index f7074afdf1bf..777fb55c316d 100644 --- a/chart2/source/model/template/PieChartType.cxx +++ b/chart2/source/model/template/PieChartType.cxx @@ -148,8 +148,8 @@ OUString SAL_CALL PieChartType::getChartType() Reference< chart2::XCoordinateSystem > SAL_CALL PieChartType::createCoordinateSystem( ::sal_Int32 DimensionCount ) { - Reference< chart2::XCoordinateSystem > xResult( - new PolarCoordinateSystem( DimensionCount )); + rtl::Reference< PolarCoordinateSystem > xResult = + new PolarCoordinateSystem( DimensionCount ); for( sal_Int32 i=0; i<DimensionCount; ++i ) { diff --git a/chart2/source/model/template/ScatterChartType.cxx b/chart2/source/model/template/ScatterChartType.cxx index dd78db8e1e6b..4693df06d674 100644 --- a/chart2/source/model/template/ScatterChartType.cxx +++ b/chart2/source/model/template/ScatterChartType.cxx @@ -158,8 +158,8 @@ uno::Reference< util::XCloneable > SAL_CALL ScatterChartType::createClone() Reference< chart2::XCoordinateSystem > SAL_CALL ScatterChartType::createCoordinateSystem( ::sal_Int32 DimensionCount ) { - Reference< chart2::XCoordinateSystem > xResult( - new CartesianCoordinateSystem( DimensionCount )); + rtl::Reference< CartesianCoordinateSystem > xResult = + new CartesianCoordinateSystem( DimensionCount ); for( sal_Int32 i=0; i<DimensionCount; ++i ) { diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 276abb5dbc47..d936cf59c92b 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -19,6 +19,7 @@ #include <AxisHelper.hxx> #include <DiagramHelper.hxx> +#include <Diagram.hxx> #include <ChartTypeHelper.hxx> #include <AxisIndexDefines.hxx> #include <LinePropertiesHelper.hxx> @@ -31,6 +32,7 @@ #include <ReferenceSizeProvider.hxx> #include <ExplicitCategoriesProvider.hxx> #include <unonames.hxx> +#include <BaseCoordinateSystem.hxx> #include <unotools/saveopt.hxx> @@ -569,15 +571,16 @@ bool AxisHelper::isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, return bRet; } -Reference< XCoordinateSystem > AxisHelper::getCoordinateSystemByIndex( +rtl::Reference< ::chart::BaseCoordinateSystem > AxisHelper::getCoordinateSystemByIndex( const Reference< XDiagram >& xDiagram, sal_Int32 nIndex ) { - Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY ); - if(!xCooSysContainer.is()) + if(!xDiagram.is()) return nullptr; - Sequence< Reference< XCoordinateSystem > > aCooSysList = xCooSysContainer->getCoordinateSystems(); - if(0<=nIndex && nIndex<aCooSysList.getLength()) - return aCooSysList[nIndex]; + ::chart::Diagram* pDiagram = dynamic_cast<::chart::Diagram*>(xDiagram.get()); + assert(pDiagram); + auto & rCooSysList = pDiagram->getBaseCoordinateSystems(); + if(0<=nIndex && nIndex < static_cast<sal_Int32>(rCooSysList.size())) + return rCooSysList[nIndex]; return nullptr; } @@ -1021,27 +1024,26 @@ bool AxisHelper::changeVisibilityOfGrids( const Reference< XDiagram >& xDiagram return bChanged; } -Reference< XCoordinateSystem > AxisHelper::getCoordinateSystemOfAxis( +rtl::Reference< BaseCoordinateSystem > AxisHelper::getCoordinateSystemOfAxis( const Reference< XAxis >& xAxis , const Reference< XDiagram >& xDiagram ) { - Reference< XCoordinateSystem > xRet; + if (!xDiagram) + return nullptr; + ::chart::Diagram* pDiagram = dynamic_cast<::chart::Diagram*>(xDiagram.get()); + assert(pDiagram); - Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY ); - if( xCooSysContainer.is() ) + rtl::Reference< BaseCoordinateSystem > xRet; + for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : pDiagram->getBaseCoordinateSystems() ) { - const Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); - for( Reference< XCoordinateSystem > const & xCooSys : aCooSysList ) - { - std::vector< Reference< XAxis > > aAllAxis( AxisHelper::getAllAxesOfCoordinateSystem( xCooSys ) ); + std::vector< Reference< XAxis > > aAllAxis( AxisHelper::getAllAxesOfCoordinateSystem( xCooSys ) ); - std::vector< Reference< XAxis > >::iterator aFound = - std::find( aAllAxis.begin(), aAllAxis.end(), xAxis ); - if( aFound != aAllAxis.end()) - { - xRet.set( xCooSys ); - break; - } + std::vector< Reference< XAxis > >::iterator aFound = + std::find( aAllAxis.begin(), aAllAxis.end(), xAxis ); + if( aFound != aAllAxis.end()) + { + xRet = xCooSys; + break; } } return xRet; diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx index 71f35969e5d0..fc442b8030e3 100644 --- a/chart2/source/tools/ChartModelHelper.cxx +++ b/chart2/source/tools/ChartModelHelper.cxx @@ -25,6 +25,7 @@ #include <RangeHighlighter.hxx> #include <InternalDataProvider.hxx> #include <ChartModel.hxx> +#include <BaseCoordinateSystem.hxx> #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/XChartDocument.hpp> @@ -107,30 +108,28 @@ rtl::Reference< Diagram > ChartModelHelper::findDiagram( const uno::Reference< c return nullptr; } -uno::Reference< XCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( ChartModel& rModel ) +rtl::Reference< BaseCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( ChartModel& rModel ) { - uno::Reference< XCoordinateSystem > XCooSys; - uno::Reference< XCoordinateSystemContainer > xCooSysCnt( rModel.getFirstDiagram(), uno::UNO_QUERY ); - if( xCooSysCnt.is() ) + rtl::Reference< Diagram > xDiagram = rModel.getFirstChartDiagram(); + if( xDiagram.is() ) { - uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() ); - if( aCooSysSeq.hasElements() ) - XCooSys = aCooSysSeq[0]; + auto& rCooSysSeq( xDiagram->getBaseCoordinateSystems() ); + if( !rCooSysSeq.empty() ) + return rCooSysSeq[0]; } - return XCooSys; + return nullptr; } -uno::Reference< XCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( const uno::Reference< frame::XModel >& xModel ) +rtl::Reference< BaseCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( const uno::Reference< frame::XModel >& xModel ) { - uno::Reference< XCoordinateSystem > XCooSys; - rtl::Reference< Diagram > xCooSysCnt( ChartModelHelper::findDiagram( xModel ), uno::UNO_QUERY ); - if( xCooSysCnt.is() ) + rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram( xModel ); + if( xDiagram.is() ) { - uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() ); - if( aCooSysSeq.hasElements() ) - XCooSys = aCooSysSeq[0]; + auto& rCooSysSeq( xDiagram->getBaseCoordinateSystems() ); + if( !rCooSysSeq.empty() ) + return rCooSysSeq[0]; } - return XCooSys; + return nullptr; } std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries( diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index af3c16190633..ed90d3a8c207 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -20,6 +20,8 @@ #include <DataSeriesHelper.hxx> #include <DataSource.hxx> #include <unonames.hxx> +#include <Diagram.hxx> +#include <BaseCoordinateSystem.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/chart2/DataPointLabel.hpp> @@ -108,18 +110,16 @@ Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel( void lcl_getCooSysAndChartTypeOfSeries( const Reference< chart2::XDataSeries > & xSeries, const Reference< chart2::XDiagram > & xDiagram, - Reference< chart2::XCoordinateSystem > & xOutCooSys, + rtl::Reference< ::chart::BaseCoordinateSystem > & xOutCooSys, Reference< chart2::XChartType > & xOutChartType ) { - Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY ); - if( !xCooSysCnt.is()) + if( !xDiagram.is()) return; + ::chart::Diagram* pDiagram = dynamic_cast<::chart::Diagram*>(xDiagram.get()); - const Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( Reference< chart2::XCoordinateSystem > const & coords : aCooSysSeq ) + for( rtl::Reference< ::chart::BaseCoordinateSystem > const & coords : pDiagram->getBaseCoordinateSystems() ) { - Reference< chart2::XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW ); - const Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes()); + const Sequence< Reference< chart2::XChartType > > aChartTypes( coords->getChartTypes()); for( Reference< chart2::XChartType > const & chartType : aChartTypes ) { Reference< chart2::XDataSeriesContainer > xSeriesCnt( chartType, uno::UNO_QUERY ); @@ -130,7 +130,7 @@ void lcl_getCooSysAndChartTypeOfSeries( { if( dataSeries == xSeries ) { - xOutCooSys.set( coords ); + xOutCooSys = coords; xOutChartType.set( chartType ); } } @@ -486,11 +486,11 @@ sal_Int32 getNumberFormatKeyFromAxis( return nResult; } -Reference< chart2::XCoordinateSystem > getCoordinateSystemOfSeries( +rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemOfSeries( const Reference< chart2::XDataSeries > & xSeries, const Reference< chart2::XDiagram > & xDiagram ) { - Reference< chart2::XCoordinateSystem > xResult; + rtl::Reference< ::chart::BaseCoordinateSystem > xResult; Reference< chart2::XChartType > xDummy; lcl_getCooSysAndChartTypeOfSeries( xSeries, xDiagram, xResult, xDummy ); @@ -502,7 +502,7 @@ Reference< chart2::XChartType > getChartTypeOfSeries( const Reference< chart2::XDiagram > & xDiagram ) { Reference< chart2::XChartType > xResult; - Reference< chart2::XCoordinateSystem > xDummy; + rtl::Reference< ::chart::BaseCoordinateSystem > xDummy; lcl_getCooSysAndChartTypeOfSeries( xSeries, xDiagram, xDummy, xResult ); return xResult; diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index d985df9dc3af..1aa9ad5cc381 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -32,6 +32,7 @@ #include <ControllerLockGuard.hxx> #include <NumberFormatterWrapper.hxx> #include <unonames.hxx> +#include <BaseCoordinateSystem.hxx> #include <com/sun/star/chart/MissingValueTreatment.hpp> #include <com/sun/star/chart/XDiagramPositioning.hpp> @@ -958,7 +959,7 @@ Sequence< OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const Sequence< OUString > DiagramHelper::getExplicitSimpleCategories( ChartModel& rModel ) { - uno::Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( rModel ) ); + rtl::Reference< BaseCoordinateSystem > xCooSys = ChartModelHelper::getFirstCoordinateSystem( rModel ); ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, rModel ); return aExplicitCategoriesProvider.getSimpleCategories(); } diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index 2f31b9d38dde..0f418198a08d 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -26,6 +26,7 @@ #include <ChartModelHelper.hxx> #include <NumberFormatterWrapper.hxx> #include <unonames.hxx> +#include <BaseCoordinateSystem.hxx> #include <com/sun/star/chart2/AxisType.hpp> #include <o3tl/safeint.hxx> @@ -173,7 +174,7 @@ void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUStr auto pOutTexts = rOutTexts.getArray(); sal_Int32 nAxisNumberFormat = 0; - Reference< XCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( rModel ) ); + rtl::Reference< BaseCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( rModel ) ); if( xCooSysModel.is() ) { Reference< chart2::XAxis > xAxis( xCooSysModel->getAxisByDimension(0,0) ); diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index c020313c6e35..4af0a42a684e 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -31,6 +31,7 @@ #include <DiagramHelper.hxx> #include <Diagram.hxx> #include <ExplicitCategoriesProvider.hxx> +#include <BaseCoordinateSystem.hxx> #include <com/sun/star/chart2/data/XDataSequence.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 65a6581da2c2..494614e0c26d 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -30,6 +30,7 @@ #include <DiagramHelper.hxx> #include <Diagram.hxx> #include <unonames.hxx> +#include <BaseCoordinateSystem.hxx> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -336,7 +337,7 @@ OUString ObjectIdentifier::createClassifiedIdentifierForObject( Reference< XAxis > xAxis( xObject, uno::UNO_QUERY ); if( xAxis.is() ) { - Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, rModel.getFirstDiagram() ) ); + rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, rModel.getFirstDiagram() ) ); OUString aCooSysParticle( createParticleForCoordinateSystem( xCooSys, rModel ) ); sal_Int32 nDimensionIndex=-1; sal_Int32 nAxisIndex=-1; diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx index 0cf62c2946be..71c280f45007 100644 --- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx @@ -20,6 +20,7 @@ #include "VCartesianCoordinateSystem.hxx" #include "VCartesianGrid.hxx" #include "VCartesianAxis.hxx" +#include <BaseCoordinateSystem.hxx> #include <AxisIndexDefines.hxx> #include <AxisHelper.hxx> #include <cppuhelper/implbase.hxx> @@ -58,7 +59,7 @@ private: //member } -VCartesianCoordinateSystem::VCartesianCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys ) +VCartesianCoordinateSystem::VCartesianCoordinateSystem( const rtl::Reference< BaseCoordinateSystem >& xCooSys ) : VCoordinateSystem(xCooSys) { } diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.hxx b/chart2/source/view/axes/VCartesianCoordinateSystem.hxx index e37fdbadf4b6..e26239225261 100644 --- a/chart2/source/view/axes/VCartesianCoordinateSystem.hxx +++ b/chart2/source/view/axes/VCartesianCoordinateSystem.hxx @@ -27,7 +27,7 @@ class VCartesianCoordinateSystem : public VCoordinateSystem { public: VCartesianCoordinateSystem() = delete; - explicit VCartesianCoordinateSystem( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys ); + explicit VCartesianCoordinateSystem( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys ); virtual ~VCartesianCoordinateSystem() override; virtual void createVAxisList( diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx index 236d5dbc2892..44f17c7d915f 100644 --- a/chart2/source/view/axes/VCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCoordinateSystem.cxx @@ -21,6 +21,7 @@ #include <VCoordinateSystem.hxx> #include "VCartesianCoordinateSystem.hxx" #include "VPolarCoordinateSystem.hxx" +#include <BaseCoordinateSystem.hxx> #include <ScaleAutomatism.hxx> #include <ShapeFactory.hxx> #include <servicenames_coosystems.hxx> @@ -46,7 +47,7 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; std::unique_ptr<VCoordinateSystem> VCoordinateSystem::createCoordinateSystem( - const Reference< XCoordinateSystem >& xCooSysModel ) + const rtl::Reference< BaseCoordinateSystem >& xCooSysModel ) { if( !xCooSysModel.is() ) return nullptr; @@ -64,7 +65,7 @@ std::unique_ptr<VCoordinateSystem> VCoordinateSystem::createCoordinateSystem( return pRet; } -VCoordinateSystem::VCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys ) +VCoordinateSystem::VCoordinateSystem( const rtl::Reference< BaseCoordinateSystem >& xCooSys ) : m_xCooSysModel(xCooSys) , m_eLeftWallPos(CuboidPlanePosition_Left) , m_eBackWallPos(CuboidPlanePosition_Back) @@ -523,11 +524,10 @@ void VCoordinateSystem::clearMinimumAndMaximumSupplierList() bool VCoordinateSystem::getPropertySwapXAndYAxis() const { - Reference<beans::XPropertySet> xProp(m_xCooSysModel, uno::UNO_QUERY ); bool bSwapXAndY = false; - if( xProp.is()) try + if( m_xCooSysModel.is()) try { - xProp->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY; + m_xCooSysModel->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY; } catch( const uno::Exception& ) { diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.cxx b/chart2/source/view/axes/VPolarCoordinateSystem.cxx index 75e7d3897ed3..5bc585097b77 100644 --- a/chart2/source/view/axes/VPolarCoordinateSystem.cxx +++ b/chart2/source/view/axes/VPolarCoordinateSystem.cxx @@ -20,6 +20,7 @@ #include "VPolarCoordinateSystem.hxx" #include "VPolarGrid.hxx" #include "VPolarAxis.hxx" +#include <BaseCoordinateSystem.hxx> #include <AxisIndexDefines.hxx> #include <AxisHelper.hxx> #include <ChartModel.hxx> @@ -31,7 +32,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; -VPolarCoordinateSystem::VPolarCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys ) +VPolarCoordinateSystem::VPolarCoordinateSystem( const rtl::Reference< BaseCoordinateSystem >& xCooSys ) : VCoordinateSystem(xCooSys) { } diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.hxx b/chart2/source/view/axes/VPolarCoordinateSystem.hxx index 1ca178bda63a..95c1094260c9 100644 --- a/chart2/source/view/axes/VPolarCoordinateSystem.hxx +++ b/chart2/source/view/axes/VPolarCoordinateSystem.hxx @@ -27,7 +27,7 @@ class VPolarCoordinateSystem : public VCoordinateSystem { public: VPolarCoordinateSystem() = delete; - explicit VPolarCoordinateSystem( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys ); + explicit VPolarCoordinateSystem( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys ); virtual ~VPolarCoordinateSystem() override; //better performance for big data diff --git a/chart2/source/view/inc/VCoordinateSystem.hxx b/chart2/source/view/inc/VCoordinateSystem.hxx index e4a3cdbcf4b5..2beac4a05631 100644 --- a/chart2/source/view/inc/VCoordinateSystem.hxx +++ b/chart2/source/view/inc/VCoordinateSystem.hxx @@ -44,6 +44,7 @@ namespace com::sun::star::lang { class XMultiServiceFactory; } namespace chart { +class BaseCoordinateSystem; class VAxisBase; @@ -52,8 +53,8 @@ class VCoordinateSystem public: virtual ~VCoordinateSystem(); - static std::unique_ptr<VCoordinateSystem> createCoordinateSystem( const css::uno::Reference< - css::chart2::XCoordinateSystem >& xCooSysModel ); + static std::unique_ptr<VCoordinateSystem> createCoordinateSystem( const rtl::Reference< + ::chart::BaseCoordinateSystem >& xCooSysModel ); /// @throws css::uno::RuntimeException void initPlottingTargets( @@ -107,7 +108,7 @@ public: void set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos ); - const css::uno::Reference< css::chart2::XCoordinateSystem >& + const rtl::Reference< ::chart::BaseCoordinateSystem >& getModel() const { return m_xCooSysModel;} /** @@ -137,8 +138,7 @@ public: void setSeriesNamesForAxis( const css::uno::Sequence< OUString >& rSeriesNames ); protected: //methods - VCoordinateSystem( const css::uno::Reference< - css::chart2::XCoordinateSystem >& xCooSys ); + VCoordinateSystem( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys ); css::uno::Reference< css::chart2::XAxis > getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const; @@ -160,7 +160,7 @@ private: //methods void impl_adjustDimensionAndIndex( sal_Int32& rDimensionIndex, sal_Int32& rAxisIndex ) const; protected: //member - css::uno::Reference< css::chart2::XCoordinateSystem > m_xCooSysModel; + rtl::Reference< ::chart::BaseCoordinateSystem > m_xCooSysModel; OUString m_aCooSysParticle; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 456be98ba8ee..e5a0bf17641a 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -21,11 +21,13 @@ #include <ChartView.hxx> #include <chartview/DrawModelWrapper.hxx> +#include <Diagram.hxx> #include <NumberFormatterWrapper.hxx> #include <VDiagram.hxx> #include "VTitle.hxx" #include "VButton.hxx" #include <ShapeFactory.hxx> +#include <BaseCoordinateSystem.hxx> #include <VCoordinateSystem.hxx> #include <VSeriesPlotter.hxx> #include <CommonConverters.hxx> @@ -377,7 +379,7 @@ std::vector< LegendEntryProvider* > SeriesPlotterContainer::getLegendEntryProvid } VCoordinateSystem* findInCooSysList( const std::vector< std::unique_ptr<VCoordinateSystem> >& rVCooSysList - , const uno::Reference< XCoordinateSystem >& xCooSys ) + , const rtl::Reference< BaseCoordinateSystem >& xCooSys ) { for(auto & pVCooSys : rVCooSysList) { @@ -400,7 +402,7 @@ VCoordinateSystem* lcl_getCooSysForPlotter( const std::vector< std::unique_ptr<V } VCoordinateSystem* addCooSysToList( std::vector< std::unique_ptr<VCoordinateSystem> >& rVCooSysList - , const uno::Reference< XCoordinateSystem >& xCooSys + , const rtl::Reference< BaseCoordinateSystem >& xCooSys , ChartModel& rChartModel ) { VCoordinateSystem* pExistingVCooSys = findInCooSysList( rVCooSysList, xCooSys ); @@ -422,7 +424,7 @@ VCoordinateSystem* addCooSysToList( std::vector< std::unique_ptr<VCoordinateSyst void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( ChartModel& rChartModel ) { - uno::Reference< XDiagram > xDiagram( rChartModel.getFirstDiagram() ); + rtl::Reference< Diagram > xDiagram = rChartModel.getFirstChartDiagram(); if( !xDiagram.is()) return; @@ -446,16 +448,15 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( sal_Int32 n3DRelativeHeight = 100; try { - uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY_THROW ); - xDiaProp->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= bSortByXValues; - xDiaProp->getPropertyValue( "ConnectBars" ) >>= bConnectBars; - xDiaProp->getPropertyValue( "GroupBarsPerAxis" ) >>= bGroupBarsPerAxis; - xDiaProp->getPropertyValue( "IncludeHiddenCells" ) >>= bIncludeHiddenCells; - xDiaProp->getPropertyValue( "StartingAngle" ) >>= nStartingAngle; + xDiagram->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= bSortByXValues; + xDiagram->getPropertyValue( "ConnectBars" ) >>= bConnectBars; + xDiagram->getPropertyValue( "GroupBarsPerAxis" ) >>= bGroupBarsPerAxis; + xDiagram->getPropertyValue( "IncludeHiddenCells" ) >>= bIncludeHiddenCells; + xDiagram->getPropertyValue( "StartingAngle" ) >>= nStartingAngle; if (nDimensionCount == 3) { - xDiaProp->getPropertyValue( "3DRelativeHeight" ) >>= n3DRelativeHeight; + xDiagram->getPropertyValue( "3DRelativeHeight" ) >>= n3DRelativeHeight; } } catch( const uno::Exception & ) @@ -469,16 +470,12 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( // - add plotter to coordinate systems //iterate through all coordinate systems - uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY ); - OSL_ASSERT( xCooSysContainer.is()); - if( !xCooSysContainer.is()) - return; uno::Reference< XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme()); - uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); + auto & rCooSysList = xDiagram->getBaseCoordinateSystems(); sal_Int32 nGlobalSeriesIndex = 0;//for automatic symbols - for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS ) + for( sal_Int32 nCS = 0; nCS < static_cast<sal_Int32>(rCooSysList.size()); ++nCS ) { - uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] ); + rtl::Reference< BaseCoordinateSystem > xCooSys( rCooSysList[nCS] ); VCoordinateSystem* pVCooSys = addCooSysToList(m_rVCooSysList,xCooSys,rChartModel); // Let's check whether the secondary Y axis is visible try @@ -494,11 +491,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( TOOLS_WARN_EXCEPTION("chart2", "" ); } //iterate through all chart types in the current coordinate system - uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY ); - OSL_ASSERT( xChartTypeContainer.is()); - if( !xChartTypeContainer.is() ) - continue; - uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() ); + uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xCooSys->getChartTypes() ); for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT ) { uno::Reference< XChartType > xChartType( aChartTypeList[nT] ); @@ -1675,7 +1668,7 @@ bool ChartView::getExplicitValuesForAxis( if(!xAxis.is()) return false; - uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(xAxis, mrChartModel.getFirstDiagram() ) ); + rtl::Reference< BaseCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemOfAxis(xAxis, mrChartModel.getFirstDiagram() ); const VCoordinateSystem* pVCooSys = findInCooSysList(m_aVCooSysList,xCooSys); if(!pVCooSys) return false; |