diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-25 09:19:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-26 06:36:37 +0000 |
commit | fec0b1e444c416feaa416e79f0b8ece8069951e0 (patch) | |
tree | ff933149fc550e66151818c80cc6092eb03a3ce5 /sd | |
parent | 60035ea9b46f10351ef0bd56d4999bc43558dd33 (diff) |
use more concrete types in sd
Change-Id: I754847ac759fb7c946f2c021e898fc0139ca5226
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146116
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
11 files changed, 43 insertions, 35 deletions
diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx b/sd/source/ui/framework/configuration/ConfigurationController.cxx index 59fdf374a74f..7e44e9025115 100644 --- a/sd/source/ui/framework/configuration/ConfigurationController.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx @@ -20,6 +20,7 @@ #include <framework/ConfigurationController.hxx> #include <framework/Configuration.hxx> #include <framework/FrameworkHelper.hxx> +#include <DrawController.hxx> #include "ConfigurationUpdater.hxx" #include "ConfigurationControllerBroadcaster.hxx" #include "ConfigurationTracer.hxx" @@ -51,9 +52,9 @@ class ConfigurationController::Implementation public: Implementation ( ConfigurationController& rController, - const Reference<frame::XController>& rxController); + const rtl::Reference<::sd::DrawController>& rxController); - Reference<XControllerManager> mxControllerManager; + rtl::Reference<::sd::DrawController> mxControllerManager; /** The Broadcaster class implements storing and calling of listeners. */ @@ -101,7 +102,7 @@ ConfigurationController::Lock::~Lock() //===== ConfigurationController =============================================== -ConfigurationController::ConfigurationController(const css::uno::Reference<css::frame::XController>& rxController) noexcept +ConfigurationController::ConfigurationController(const rtl::Reference<::sd::DrawController>& rxController) noexcept : ConfigurationControllerInterfaceBase(m_aMutex) , mbIsDisposed(false) { @@ -500,7 +501,7 @@ void ConfigurationController::ThrowIfDisposed () const ConfigurationController::Implementation::Implementation ( ConfigurationController& rController, - const Reference<frame::XController>& rxController) + const rtl::Reference<::sd::DrawController>& rxController) : mxControllerManager(rxController, UNO_QUERY_THROW), mpBroadcaster(std::make_shared<ConfigurationControllerBroadcaster>(&rController)), mxRequestedConfiguration(new Configuration(&rController, true)), diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx index e5190fe1df00..feea95eacc13 100644 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx @@ -24,6 +24,7 @@ #include "ConfigurationControllerResourceManager.hxx" #include <framework/Configuration.hxx> #include <framework/FrameworkHelper.hxx> +#include <DrawController.hxx> #include <com/sun/star/drawing/framework/XControllerManager.hpp> #include <comphelper/scopeguard.hxx> @@ -65,7 +66,7 @@ private: ConfigurationUpdater::ConfigurationUpdater ( std::shared_ptr<ConfigurationControllerBroadcaster> pBroadcaster, std::shared_ptr<ConfigurationControllerResourceManager> pResourceManager, - const Reference<XControllerManager>& rxControllerManager) + const rtl::Reference<::sd::DrawController>& rxControllerManager) : mpBroadcaster(std::move(pBroadcaster)), mxCurrentConfiguration(Reference<XConfiguration>(new Configuration(nullptr, false))), mbUpdatePending(false), diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx index 2d981d4ad99f..0e65505fa9ef 100644 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx @@ -20,6 +20,7 @@ #pragma once #include <com/sun/star/uno/Reference.hxx> +#include <rtl/ref.hxx> #include <vcl/timer.hxx> #include <memory> #include <vector> @@ -36,6 +37,10 @@ namespace com::sun::star::drawing::framework { class XResourceId; } +namespace sd +{ +class DrawController; +} namespace sd::framework { @@ -59,10 +64,9 @@ public: /** Create a new ConfigurationUpdater object that notifies configuration changes and the start and end of updates via the given broadcaster. */ - ConfigurationUpdater( - std::shared_ptr<ConfigurationControllerBroadcaster> pBroadcaster, - std::shared_ptr<ConfigurationControllerResourceManager> pResourceManager, - const css::uno::Reference<css::drawing::framework::XControllerManager>& xControllerManager); + ConfigurationUpdater(std::shared_ptr<ConfigurationControllerBroadcaster> pBroadcaster, + std::shared_ptr<ConfigurationControllerResourceManager> pResourceManager, + const rtl::Reference<::sd::DrawController>& xControllerManager); ~ConfigurationUpdater(); /** Request an update of the current configuration so that it looks like @@ -91,7 +95,7 @@ private: /** A reference to the XControllerManager is kept so that UpdateConfiguration() has access to the other sub controllers. */ - css::uno::Reference<css::drawing::framework::XControllerManager> mxControllerManager; + rtl::Reference<::sd::DrawController> mxControllerManager; std::shared_ptr<ConfigurationControllerBroadcaster> mpBroadcaster; diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx index 4817c1360201..122d5619893f 100644 --- a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx +++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx @@ -18,6 +18,7 @@ */ #include "ResourceFactoryManager.hxx" +#include <DrawController.hxx> #include <tools/wldcrd.hxx> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -37,7 +38,7 @@ using namespace ::com::sun::star::drawing::framework; namespace sd::framework { -ResourceFactoryManager::ResourceFactoryManager (const Reference<XControllerManager>& rxManager) +ResourceFactoryManager::ResourceFactoryManager (const rtl::Reference<::sd::DrawController>& rxManager) : mxControllerManager(rxManager) { // Create the URL transformer. diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.hxx b/sd/source/ui/framework/configuration/ResourceFactoryManager.hxx index 61daf383b2f2..f28c301e5563 100644 --- a/sd/source/ui/framework/configuration/ResourceFactoryManager.hxx +++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.hxx @@ -27,11 +27,13 @@ #include <vector> #include <com/sun/star/uno/Reference.hxx> +#include <rtl/ref.hxx> #include <rtl/ustring.hxx> namespace com::sun::star::drawing::framework { class XControllerManager; } namespace com::sun::star::drawing::framework { class XResourceFactory; } namespace com::sun::star::util { class XURLTransformer; } +namespace sd { class DrawController; } namespace sd::framework { @@ -40,8 +42,7 @@ namespace sd::framework { class ResourceFactoryManager { public: - explicit ResourceFactoryManager ( - const css::uno::Reference<css::drawing::framework::XControllerManager>& rxManager); + explicit ResourceFactoryManager(const rtl::Reference<::sd::DrawController>& rxManager); ~ResourceFactoryManager(); @@ -100,7 +101,7 @@ private: FactoryPatternList; FactoryPatternList maFactoryPatternList; - css::uno::Reference<css::drawing::framework::XControllerManager> mxControllerManager; + rtl::Reference<::sd::DrawController> mxControllerManager; css::uno::Reference<css::util::XURLTransformer> mxURLTransformer; /** Look up the factory for the given URL. diff --git a/sd/source/ui/framework/module/ModuleController.cxx b/sd/source/ui/framework/module/ModuleController.cxx index ab6cc1e16703..ac1c41068b54 100644 --- a/sd/source/ui/framework/module/ModuleController.cxx +++ b/sd/source/ui/framework/module/ModuleController.cxx @@ -19,6 +19,7 @@ #include <framework/ModuleController.hxx> #include <framework/PresentationFactory.hxx> +#include <DrawController.hxx> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -37,7 +38,7 @@ using ::sd::tools::ConfigurationAccess; namespace sd::framework { -ModuleController::ModuleController(const css::uno::Reference<css::frame::XController>& rxController) +ModuleController::ModuleController(const rtl::Reference<::sd::DrawController>& rxController) { assert(rxController); @@ -117,8 +118,6 @@ void ModuleController::InstantiateStartupServices() // this scope when it does not register itself anywhere. // Typically it will add itself as ConfigurationChangeListener // at the configuration controller. - Reference<uno::XComponentContext> xContext = - ::comphelper::getProcessComponentContext(); sd::framework::PresentationFactory::install(mxController); } catch (Exception&) @@ -149,7 +148,7 @@ void SAL_CALL ModuleController::requestResource (const OUString& rsResourceURL) ::comphelper::getProcessComponentContext(); // Create the factory service. - Sequence<Any> aArguments{ Any(mxController) }; + Sequence<Any> aArguments{ Any(uno::Reference<XControllerManager>(mxController)) }; try { xFactory = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( diff --git a/sd/source/ui/framework/module/SlideSorterModule.cxx b/sd/source/ui/framework/module/SlideSorterModule.cxx index dbe30f0d3a9c..1b6bbb7f9fae 100644 --- a/sd/source/ui/framework/module/SlideSorterModule.cxx +++ b/sd/source/ui/framework/module/SlideSorterModule.cxx @@ -21,6 +21,7 @@ #include <framework/FrameworkHelper.hxx> #include <framework/ConfigurationController.hxx> +#include <DrawController.hxx> #include <com/sun/star/drawing/framework/XTabBar.hpp> #include <com/sun/star/drawing/framework/TabBarButton.hpp> #include <com/sun/star/drawing/framework/XControllerManager.hpp> @@ -46,19 +47,18 @@ namespace sd::framework { //===== SlideSorterModule ================================================== SlideSorterModule::SlideSorterModule ( - const Reference<frame::XController>& rxController, + const rtl::Reference<::sd::DrawController>& rxController, const OUString& rsLeftPaneURL) : mxResourceId(FrameworkHelper::CreateResourceId(FrameworkHelper::msSlideSorterURL, rsLeftPaneURL)), mxMainViewAnchorId(FrameworkHelper::CreateResourceId(FrameworkHelper::msCenterPaneURL)), mxViewTabBarId(FrameworkHelper::CreateResourceId( FrameworkHelper::msViewTabBarURL, FrameworkHelper::msCenterPaneURL)), - mxControllerManager(rxController,UNO_QUERY) + mxControllerManager(rxController) { - Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY); - if (xControllerManager.is()) + if (mxControllerManager.is()) { - mxConfigurationController = xControllerManager->getConfigurationController(); + mxConfigurationController = mxControllerManager->getConfigurationController(); if (mxConfigurationController.is()) { diff --git a/sd/source/ui/framework/module/SlideSorterModule.hxx b/sd/source/ui/framework/module/SlideSorterModule.hxx index bec9f5c3cad9..f56d2c8c7526 100644 --- a/sd/source/ui/framework/module/SlideSorterModule.hxx +++ b/sd/source/ui/framework/module/SlideSorterModule.hxx @@ -21,6 +21,7 @@ #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp> #include <comphelper/compbase.hxx> +#include <rtl/ref.hxx> #include <memory> #include <set> @@ -28,6 +29,7 @@ namespace com::sun::star::drawing::framework { class XConfigurationController; } namespace com::sun::star::drawing::framework { class XControllerManager; } namespace com::sun::star::drawing::framework { class XTabBar; } namespace com::sun::star::frame { class XController; } +namespace sd { class DrawController; } namespace sd::framework { @@ -49,7 +51,7 @@ class SlideSorterModule final { public: SlideSorterModule ( - const css::uno::Reference<css::frame::XController>& rxController, + const rtl::Reference<::sd::DrawController>& rxController, const OUString& rsLeftPaneURL); virtual ~SlideSorterModule() override; @@ -80,7 +82,7 @@ private: css::uno::Reference<css::drawing::framework::XResourceId> mxMainViewAnchorId; OUString msCurrentMainViewURL; css::uno::Reference<css::drawing::framework::XResourceId> mxViewTabBarId; - css::uno::Reference<css::drawing::framework::XControllerManager> mxControllerManager; + rtl::Reference<::sd::DrawController> mxControllerManager; void HandleMainViewSwitch ( const OUString& rsViewURL, diff --git a/sd/source/ui/inc/framework/ConfigurationController.hxx b/sd/source/ui/inc/framework/ConfigurationController.hxx index 0fd7c648c7fd..d56ca84770e0 100644 --- a/sd/source/ui/inc/framework/ConfigurationController.hxx +++ b/sd/source/ui/inc/framework/ConfigurationController.hxx @@ -24,6 +24,7 @@ #include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> +#include <rtl/ref.hxx> #include <memory> @@ -33,6 +34,7 @@ namespace com::sun::star::drawing::framework { class XConfigurationChangeRequest namespace com::sun::star::drawing::framework { class XResourceId; } namespace com::sun::star::drawing::framework { struct ConfigurationChangeEvent; } namespace com::sun::star::frame { class XController; } +namespace sd { class DrawController; } namespace sd::framework { @@ -51,7 +53,7 @@ class ConfigurationController public ConfigurationControllerInterfaceBase { public: - ConfigurationController(const css::uno::Reference<css::frame::XController>& rxController) noexcept; + ConfigurationController(const rtl::Reference<::sd::DrawController>& rxController) noexcept; virtual ~ConfigurationController() noexcept override; ConfigurationController(const ConfigurationController&) = delete; ConfigurationController& operator=(const ConfigurationController&) = delete; diff --git a/sd/source/ui/inc/framework/ModuleController.hxx b/sd/source/ui/inc/framework/ModuleController.hxx index 6b4763d2e5b1..ea1de664cc9f 100644 --- a/sd/source/ui/inc/framework/ModuleController.hxx +++ b/sd/source/ui/inc/framework/ModuleController.hxx @@ -23,11 +23,13 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <comphelper/compbase.hxx> #include <cppuhelper/weakref.hxx> +#include <rtl/ref.hxx> #include <unordered_map> namespace com::sun::star::frame { class XController; } namespace com::sun::star::uno { class XComponentContext; } +namespace sd { class DrawController; } namespace sd::framework { @@ -57,7 +59,7 @@ class ModuleController final { public: /// @throws std::exception - ModuleController(const css::uno::Reference<css::frame::XController>& rxController); + ModuleController(const rtl::Reference<::sd::DrawController>& rxController); virtual void disposing(std::unique_lock<std::mutex>&) override; @@ -66,8 +68,7 @@ public: virtual void SAL_CALL requestResource(const OUString& rsResourceURL) override; private: - css::uno::Reference< - css::frame::XController> mxController; + rtl::Reference<::sd::DrawController> mxController; std::unordered_map<OUString, OUString> maResourceToFactoryMap; std::unordered_map<OUString, css::uno::WeakReference<css::uno::XInterface>> maLoadedFactories; diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index 59a2159c6838..c64d72cb609c 100644 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -758,12 +758,8 @@ void DrawController::ProvideFrameworkControllers() SolarMutexGuard aGuard; try { - Reference<XController> xController (this); - const Reference<XComponentContext> xContext ( - ::comphelper::getProcessComponentContext() ); - mxConfigurationController = new sd::framework::ConfigurationController( - xController); - mxModuleController = new sd::framework::ModuleController(xController); + mxConfigurationController = new sd::framework::ConfigurationController(this); + mxModuleController = new sd::framework::ModuleController(this); } catch (const RuntimeException&) { |