diff options
-rw-r--r-- | dbaccess/source/core/dataaccess/databasedocument.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/genericcontroller.cxx | 6 | ||||
-rw-r--r-- | framework/source/fwe/helper/titlehelper.cxx | 26 | ||||
-rw-r--r-- | framework/source/services/frame.cxx | 4 | ||||
-rw-r--r-- | include/framework/titlehelper.hxx | 30 | ||||
-rw-r--r-- | reportdesign/source/core/api/ReportDefinition.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/view/sfxbasecontroller.cxx | 6 |
8 files changed, 22 insertions, 66 deletions
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index fa8e755b799b..25be01ce1671 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -2094,10 +2094,7 @@ Reference< XTitle > const & ODatabaseDocument::impl_getTitleHelper_throw() Reference< XUntitledNumbers > xDesktop(Desktop::create(m_pImpl->m_aContext), uno::UNO_QUERY_THROW); Reference< frame::XModel > xThis (getThis(), uno::UNO_QUERY_THROW); - rtl::Reference<::framework::TitleHelper> pHelper = new ::framework::TitleHelper(m_pImpl->m_aContext); - m_xTitleHelper = pHelper; - pHelper->setOwner (xThis ); - pHelper->connectWithUntitledNumbers (xDesktop); + m_xTitleHelper = new ::framework::TitleHelper(m_pImpl->m_aContext, xThis, xDesktop); } return m_xTitleHelper; diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 7d0d326605b0..6cb392b35192 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -1057,11 +1057,7 @@ Reference< XTitle > OGenericUnoController::impl_getTitleHelper_throw() Reference< XUntitledNumbers > xUntitledProvider(getPrivateModel(), UNO_QUERY ); Reference< XController > xThis(static_cast< XController* >(this), UNO_QUERY_THROW); - rtl::Reference<::framework::TitleHelper> pHelper = new ::framework::TitleHelper( m_xContext ); - m_xTitleHelper = pHelper; - - pHelper->setOwner (xThis ); - pHelper->connectWithUntitledNumbers (xUntitledProvider); + m_xTitleHelper = new ::framework::TitleHelper( m_xContext, xThis, xUntitledProvider ); } return m_xTitleHelper; diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index a3854489d0f8..5c4d07e69caa 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -48,26 +48,21 @@ using namespace css::frame; namespace framework{ -TitleHelper::TitleHelper(const css::uno::Reference< css::uno::XComponentContext >& rxContext) +TitleHelper::TitleHelper(const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::uno::XInterface >& xOwner, + const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers) : ::cppu::BaseMutex () , m_xContext (rxContext) , m_bExternalTitle (false) , m_nLeasedNumber (css::frame::UntitledNumbersConst::INVALID_NUMBER) , m_aListener (m_aMutex) { -} - -TitleHelper::~TitleHelper() -{ -} - -void TitleHelper::setOwner(const css::uno::Reference< css::uno::XInterface >& xOwner) -{ // SYNCHRONIZED -> { osl::MutexGuard aLock(m_aMutex); m_xOwner = xOwner; + m_xUntitledNumbers = xNumbers; } // <- SYNCHRONIZED @@ -93,6 +88,10 @@ void TitleHelper::setOwner(const css::uno::Reference< css::uno::XInterface >& xO } } +TitleHelper::~TitleHelper() +{ +} + OUString SAL_CALL TitleHelper::getTitle() { // SYNCHRONIZED -> @@ -115,15 +114,6 @@ OUString SAL_CALL TitleHelper::getTitle() // <- SYNCHRONIZED } -void TitleHelper::connectWithUntitledNumbers (const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers) -{ - // SYNCHRONIZED -> - osl::MutexGuard aLock(m_aMutex); - - m_xUntitledNumbers = xNumbers; - // <- SYNCHRONIZED -} - void SAL_CALL TitleHelper::setTitle(const OUString& sTitle) { // SYNCHRONIZED -> diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index db26f59aec0b..ac9ee29c6cdf 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -817,9 +817,7 @@ void SAL_CALL XFrameImpl::initialize( const css::uno::Reference< css::awt::XWind m_pWindowCommandDispatch.reset(new WindowCommandDispatch(m_xContext, this)); // Initialize title functionality - rtl::Reference<TitleHelper> pTitleHelper = new TitleHelper( m_xContext ); - m_xTitleHelper = pTitleHelper; - pTitleHelper->setOwner(xThis); + m_xTitleHelper = new TitleHelper( m_xContext, xThis, nullptr ); } /*-**************************************************************************************************** diff --git a/include/framework/titlehelper.hxx b/include/framework/titlehelper.hxx index 474d709339e2..888a01e71fc7 100644 --- a/include/framework/titlehelper.hxx +++ b/include/framework/titlehelper.hxx @@ -62,16 +62,6 @@ class FWK_DLLPUBLIC TitleHelper final : private ::cppu::BaseMutex public: - /** @short lightweight constructor. - */ - TitleHelper(const css::uno::Reference< css::uno::XComponentContext >& rxContext); - - - /** @short free all internally used resources. - */ - virtual ~TitleHelper() override; - - /** set an outside component which uses this container and must be set as source of all broadcasted messages, exceptions. @@ -82,22 +72,16 @@ class FWK_DLLPUBLIC TitleHelper final : private ::cppu::BaseMutex @param xOwner the new owner of this collection. + @param xNumbers + provides the right string and number for an untitled component. */ - void setOwner (const css::uno::Reference< css::uno::XInterface >& xOwner); - + TitleHelper(const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const css::uno::Reference< css::uno::XInterface >& xOwner, + const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers); - /** set an outside component which provides the right string and number for - an untitled component. - - It's holded weak only so we do not need any complex dispose sessions. - - Note: Passing NULL as parameter will be allowed. It will reset the internal - member reference only. - - @param xNumbers - the right numbered collection for this helper. + /** @short free all internally used resources. */ - void connectWithUntitledNumbers (const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers); + virtual ~TitleHelper() override; /** @see XTitle */ diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 82776672d8ee..6e8c0950b72e 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -2490,10 +2490,8 @@ uno::Reference< frame::XTitle > OReportDefinition::impl_getTitleHelper_throw() uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_aProps->m_xContext); uno::Reference< frame::XModel > xThis(static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW); - rtl::Reference<::framework::TitleHelper> pHelper = new ::framework::TitleHelper( m_aProps->m_xContext ); - m_pImpl->m_xTitleHelper = pHelper; - pHelper->setOwner (xThis ); - pHelper->connectWithUntitledNumbers (uno::Reference<frame::XUntitledNumbers>(xDesktop, uno::UNO_QUERY_THROW)); + m_pImpl->m_xTitleHelper = new ::framework::TitleHelper( m_aProps->m_xContext, xThis, + uno::Reference<frame::XUntitledNumbers>(xDesktop, uno::UNO_QUERY_THROW) ); } return m_pImpl->m_xTitleHelper; 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; |