diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-22 12:22:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-22 19:58:38 +0000 |
commit | 6f59baf135f42f9c281148184b1b1f16e3902442 (patch) | |
tree | a852f1c3d1ac40af472671f3aa798b9b05ae162e /chart2/source/model/main | |
parent | f6da444a9e2b239d8905d6cdb845c7be8d8ce66f (diff) |
use more concrete type in chart2
Change-Id: If67a4f0fe75554e14c3030c68374607b76d5b840
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149336
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/model/main')
-rw-r--r-- | chart2/source/model/main/Axis.cxx | 19 | ||||
-rw-r--r-- | chart2/source/model/main/ChartModel.cxx | 21 |
2 files changed, 35 insertions, 5 deletions
diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx index 0f8715011b92..f00455f51c4f 100644 --- a/chart2/source/model/main/Axis.cxx +++ b/chart2/source/model/main/Axis.cxx @@ -27,6 +27,7 @@ #include <AxisHelper.hxx> #include <EventListenerHelper.hxx> #include <ModifyListenerHelper.hxx> +#include <Title.hxx> #include <unonames.hxx> #include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp> @@ -356,7 +357,8 @@ Axis::Axis( const Axis & rOther ) : lcl_CloneSubGrids( rOther.m_aSubGridProperties, m_aSubGridProperties ); ModifyListenerHelper::addListenerToAllSequenceElements( m_aSubGridProperties, m_xModifyEventForwarder ); - m_xTitle.set( CloneHelper::CreateRefClone< chart2::XTitle >()( rOther.m_xTitle )); + if ( rOther.m_xTitle ) + m_xTitle = new Title( *rOther.m_xTitle ); if( m_xTitle.is()) ModifyListenerHelper::addListener( m_xTitle, m_xModifyEventForwarder ); } @@ -494,10 +496,23 @@ Reference< chart2::XTitle > SAL_CALL Axis::getTitleObject() return m_xTitle; } +rtl::Reference< Title > Axis::getTitleObject2() const +{ + MutexGuard aGuard( m_aMutex ); + return m_xTitle; +} + void SAL_CALL Axis::setTitleObject( const Reference< chart2::XTitle >& xNewTitle ) { + rtl::Reference<Title> xTitle = dynamic_cast<Title*>(xNewTitle.get()); + assert(!xNewTitle || xTitle); + setTitleObject(xTitle); +} + +void Axis::setTitleObject( const rtl::Reference< Title >& xNewTitle ) +{ Reference< util::XModifyListener > xModifyEventForwarder; - Reference< chart2::XTitle > xOldTitle; + rtl::Reference< Title > xOldTitle; { MutexGuard aGuard( m_aMutex ); xOldTitle = m_xTitle; diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 56a143548ab3..b56dc1d74981 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -151,7 +151,9 @@ ChartModel::ChartModel( const ChartModel & rOther ) m_xOldModelAgg->setDelegator( *this ); Reference< util::XModifyListener > xListener; - Reference< chart2::XTitle > xNewTitle = CreateRefClone< chart2::XTitle >()( rOther.m_xTitle ); + rtl::Reference< Title > xNewTitle; + if ( rOther.m_xTitle ) + xNewTitle = new Title(*rOther.m_xTitle); rtl::Reference< ::chart::Diagram > xNewDiagram; if (rOther.m_xDiagram.is()) xNewDiagram = new ::chart::Diagram( *rOther.m_xDiagram ); @@ -540,7 +542,7 @@ void SAL_CALL ChartModel::dispose() m_xOwnNumberFormatsSupplier.clear(); m_xChartTypeManager.clear(); m_xDiagram.clear(); - DisposeHelper::DisposeAndClear( m_xTitle ); + m_xTitle.clear(); m_xPageBackground.clear(); m_xXMLNamespaceMap.clear(); @@ -928,7 +930,20 @@ uno::Reference< chart2::XTitle > SAL_CALL ChartModel::getTitleObject() return m_xTitle; } -void SAL_CALL ChartModel::setTitleObject( const uno::Reference< chart2::XTitle >& xTitle ) +rtl::Reference< Title > ChartModel::getTitleObject2() const +{ + MutexGuard aGuard( m_aModelMutex ); + return m_xTitle; +} + +void SAL_CALL ChartModel::setTitleObject( const uno::Reference< chart2::XTitle >& xNewTitle ) +{ + rtl::Reference<Title> xTitle = dynamic_cast<Title*>(xNewTitle.get()); + assert(!xNewTitle || xTitle); + setTitleObject(xTitle); +} + +void ChartModel::setTitleObject( const rtl::Reference< Title >& xTitle ) { { MutexGuard aGuard( m_aModelMutex ); |