chart2/inc/ChartView.hxx | 4 - chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx | 7 ++ chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx | 26 ++++------ chart2/source/model/main/ChartModel.cxx | 2 4 files changed, 20 insertions(+), 19 deletions(-)
New commits: commit 399e92ddb7be6280465ddf5e6337f4831e152d97 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Jan 20 20:58:30 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Jan 21 09:10:10 2022 +0100 fix ChartDocumentWrapper::createInstance which I broke in commit fe37aa64ff79abcd3aeedeb03d8d74798225a367 Date: Sat Jan 15 13:45:44 2022 +0200 use more concrete types in chart2, ChartView by copying behaviour from the wrong construction site. And then in commit c592574948b0a28bac965b508bc260aaa6c365d3 Date: Sun Jan 16 12:25:49 2022 +0200 use more concrete types in chart2, ChartView I spread the error further by using the incorrect behaviour I had introduced in the first commit in Chart2ModelContact::getChartView() Change-Id: I4b004b8893fa51b8968328b6a8b6ffde081f1269 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128705 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index 46dd1da17975..228d24bc19fe 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -82,7 +82,7 @@ struct TimeBasedInfo * The View is not responsible to handle single user events (that is instead * done by the ChartWindow). */ -class ChartView final : public ::cppu::WeakImplHelper< +class OOO_DLLPUBLIC_CHARTVIEW ChartView final : public ::cppu::WeakImplHelper< css::lang::XInitialization ,css::lang::XServiceInfo ,css::datatransfer::XTransferable @@ -114,7 +114,7 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; // ___lang::XInitialization___ - virtual OOO_DLLPUBLIC_CHARTVIEW void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; // ___ExplicitValueProvider___ virtual bool getExplicitValuesForAxis( diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx index c943bd4e085f..78eccbeed65a 100644 --- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx +++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx @@ -107,7 +107,12 @@ rtl::Reference< ::chart::ChartView > const & Chart2ModelContact::getChartView() // get the chart view rtl::Reference<ChartModel> xChartModel( m_xChartModel ); if( xChartModel ) - m_xChartView = xChartModel->getChartView(); // will create if necessary + { + auto xInstance = xChartModel->createInstance( CHART_VIEW_SERVICE_NAME ); + auto pChartView = dynamic_cast<ChartView*>(xInstance.get()); + assert(!xInstance || pChartView); + m_xChartView = pChartView; + } } return m_xChartView; } diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index 44bcaa623d11..c440692e95f3 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -1231,22 +1231,20 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( { if( !m_xChartView.is() ) { - rtl::Reference<ChartModel> pModel = m_spChart2ModelContact->getDocumentModel(); - ChartView* pChartView = pModel->getChartView(); - if(pChartView) + rtl::Reference<::chart::ChartModel> pChartModel = new ::chart::ChartModel(m_spChart2ModelContact->m_xContext); + rtl::Reference<ChartView> xChartView = new ::chart::ChartView(m_spChart2ModelContact->m_xContext, *pChartModel); + + try { - try - { - m_xChartView = pChartView; + m_xChartView = xChartView; - Sequence< Any > aArguments{ Any(Reference<frame::XModel>(this)), - Any(true) }; // bRefreshAddIn - pChartView->initialize(aArguments); - } - catch (const uno::Exception&) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } + Sequence< Any > aArguments{ Any(Reference<frame::XModel>(this)), + Any(true) }; // bRefreshAddIn + xChartView->initialize(aArguments); + } + catch (const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION("chart2"); } } xResult.set( static_cast<cppu::OWeakObject*>(m_xChartView.get()) ); diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 95aaf733233c..b05db28661dd 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -193,8 +193,6 @@ void SAL_CALL ChartModel::initialize( const Sequence< Any >& /*rArguments*/ ) ChartView* ChartModel::getChartView() const { - if(!mxChartView.is()) - mxChartView = new ChartView( m_xContext, const_cast<ChartModel&>(*this)); return mxChartView.get(); }