From 8ce81efa73f93afdf46f9586b7b6cecf36cf6914 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 29 Oct 2021 12:25:39 +0200 Subject: simplify framework::TitleHelper Every callsite (bar one) calls setOwner and connectWithUntitledNumbers after construction, so just pass them in the constructor. And for that lone callsite we can just nullptr as an argument. Change-Id: If838e068bb59a407225d853a0f67983be400f2f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124426 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sfx2/source/doc/sfxbasemodel.cxx | 5 +---- sfx2/source/view/sfxbasecontroller.cxx | 6 +----- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index e0fdd4caab63..6918f0ddf142 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3922,10 +3922,7 @@ Reference< frame::XTitle > SfxBaseModel::impl_getTitleHelper () Reference< frame::XUntitledNumbers > xDesktop( frame::Desktop::create(xContext), UNO_QUERY_THROW); Reference< frame::XModel > xThis (static_cast< frame::XModel* >(this), UNO_QUERY_THROW); - rtl::Reference<::framework::TitleHelper> pHelper = new ::framework::TitleHelper(xContext); - m_pData->m_xTitleHelper = pHelper; - pHelper->setOwner (xThis ); - pHelper->connectWithUntitledNumbers (xDesktop); + m_pData->m_xTitleHelper = new ::framework::TitleHelper(xContext, xThis, xDesktop); } return m_pData->m_xTitleHelper; diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 354f4b3ad96e..279797646018 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1427,11 +1427,7 @@ Reference< frame::XTitle > SfxBaseController::impl_getTitleHelper () Reference< frame::XUntitledNumbers > xUntitledProvider(xModel , uno::UNO_QUERY ); Reference< frame::XController > xThis (static_cast< frame::XController* >(this), uno::UNO_QUERY_THROW); - rtl::Reference<::framework::TitleHelper> pHelper = new ::framework::TitleHelper(::comphelper::getProcessComponentContext()); - m_pData->m_xTitleHelper = pHelper; - - pHelper->setOwner (xThis ); - pHelper->connectWithUntitledNumbers (xUntitledProvider); + m_pData->m_xTitleHelper = new ::framework::TitleHelper(::comphelper::getProcessComponentContext(), xThis, xUntitledProvider); } return m_pData->m_xTitleHelper; -- cgit