sd/source/ui/framework/configuration/ConfigurationController.cxx | 9 sd/source/ui/framework/configuration/ConfigurationUpdater.cxx | 3 sd/source/ui/framework/configuration/ConfigurationUpdater.hxx | 14 - sd/source/ui/framework/configuration/ResourceFactoryManager.cxx | 3 sd/source/ui/framework/configuration/ResourceFactoryManager.hxx | 7 sd/source/ui/framework/factories/BasicPaneFactory.cxx | 92 +++------- sd/source/ui/framework/factories/BasicToolBarFactory.cxx | 71 ++----- sd/source/ui/framework/factories/BasicViewFactory.cxx | 73 ++----- sd/source/ui/framework/module/ModuleController.cxx | 37 +--- sd/source/ui/framework/module/SlideSorterModule.cxx | 10 - sd/source/ui/framework/module/SlideSorterModule.hxx | 6 sd/source/ui/inc/framework/ConfigurationController.hxx | 4 sd/source/ui/inc/framework/ModuleController.hxx | 7 sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx | 12 - sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx | 12 - sd/source/ui/inc/framework/factories/BasicViewFactory.hxx | 12 - sd/source/ui/unoidl/DrawController.cxx | 8 sd/util/sd.component | 12 - solenv/bin/native-code.py | 3 solenv/clang-format/excludelist | 6 20 files changed, 155 insertions(+), 246 deletions(-)
New commits: commit bfb8706466b52298def33d47d31b6efffc3ed531 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Jan 25 10:09:55 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jan 26 06:36:45 2023 +0000 no need for sd::ModuleController to load these factories via UNO Change-Id: I2ac1d29ff9cbd5c8676dc1957a62ea02454d052e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146122 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx index 64cec425ad54..e112ac4c315a 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx @@ -20,7 +20,7 @@ #include <memory> #include <sal/config.h> -#include "BasicPaneFactory.hxx" +#include <framework/factories/BasicPaneFactory.hxx> #include "ChildWindowPane.hxx" #include "FrameWindowPane.hxx" @@ -84,67 +84,23 @@ public: //===== PaneFactory =========================================================== BasicPaneFactory::BasicPaneFactory ( - const Reference<XComponentContext>& rxContext) + const Reference<XComponentContext>& rxContext, + const rtl::Reference<::sd::DrawController>& rxController) : mxComponentContext(rxContext), mpViewShellBase(nullptr), mpPaneContainer(new PaneContainer) { -} - -BasicPaneFactory::~BasicPaneFactory() -{ -} - -void BasicPaneFactory::disposing(std::unique_lock<std::mutex>&) -{ - Reference<XConfigurationController> xCC (mxConfigurationControllerWeak); - if (xCC.is()) - { - xCC->removeResourceFactoryForReference(this); - xCC->removeConfigurationChangeListener(this); - mxConfigurationControllerWeak.clear(); - } - - for (const auto& rDescriptor : *mpPaneContainer) - { - if (rDescriptor.mbIsReleased) - { - Reference<XComponent> xComponent (rDescriptor.mxPane, UNO_QUERY); - if (xComponent.is()) - { - xComponent->removeEventListener(this); - xComponent->dispose(); - } - } - } -} - -void SAL_CALL BasicPaneFactory::initialize (const Sequence<Any>& aArguments) -{ - if (!aArguments.hasElements()) - return; - try { - // Get the XController from the first argument. - Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW); - // Tunnel through the controller to obtain access to the ViewShellBase. - try - { - if (auto pController = dynamic_cast<DrawController*>(xController.get())) - mpViewShellBase = pController->GetViewShellBase(); - } - catch(RuntimeException&) - {} + mpViewShellBase = rxController->GetViewShellBase(); - Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW); - Reference<XConfigurationController> xCC (xCM->getConfigurationController()); + Reference<XConfigurationController> xCC (rxController->getConfigurationController()); mxConfigurationControllerWeak = xCC; // Add pane factories for the two left panes (one for Impress and one for // Draw) and the center pane. - if (xController.is() && xCC.is()) + if (rxController.is() && xCC.is()) { PaneDescriptor aDescriptor; aDescriptor.msPaneURL = FrameworkHelper::msCenterPaneURL; @@ -190,6 +146,34 @@ void SAL_CALL BasicPaneFactory::initialize (const Sequence<Any>& aArguments) } } +BasicPaneFactory::~BasicPaneFactory() +{ +} + +void BasicPaneFactory::disposing(std::unique_lock<std::mutex>&) +{ + Reference<XConfigurationController> xCC (mxConfigurationControllerWeak); + if (xCC.is()) + { + xCC->removeResourceFactoryForReference(this); + xCC->removeConfigurationChangeListener(this); + mxConfigurationControllerWeak.clear(); + } + + for (const auto& rDescriptor : *mpPaneContainer) + { + if (rDescriptor.mbIsReleased) + { + Reference<XComponent> xComponent (rDescriptor.mxPane, UNO_QUERY); + if (xComponent.is()) + { + xComponent->removeEventListener(this); + xComponent->dispose(); + } + } + } +} + //===== XPaneFactory ========================================================== Reference<XResource> SAL_CALL BasicPaneFactory::createResource ( @@ -420,12 +404,4 @@ void BasicPaneFactory::ThrowIfDisposed() const } // end of namespace sd::framework -extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* -com_sun_star_comp_Draw_framework_BasicPaneFactory_get_implementation(css::uno::XComponentContext* context, - css::uno::Sequence<css::uno::Any> const &) -{ - return cppu::acquire(new sd::framework::BasicPaneFactory(context)); -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx index af79a88ea23b..0c6ac16d4a5e 100644 --- a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx +++ b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx @@ -17,10 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "BasicToolBarFactory.hxx" +#include <framework/factories/BasicToolBarFactory.hxx> #include <ViewTabBar.hxx> #include <framework/FrameworkHelper.hxx> +#include <DrawController.hxx> #include <unotools/mediadescriptor.hxx> #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -37,42 +38,11 @@ namespace sd::framework { //===== BasicToolBarFactory =================================================== -BasicToolBarFactory::BasicToolBarFactory () +BasicToolBarFactory::BasicToolBarFactory(const rtl::Reference<::sd::DrawController>& rxController) { -} - -BasicToolBarFactory::~BasicToolBarFactory() -{ -} - -void BasicToolBarFactory::disposing(std::unique_lock<std::mutex>&) -{ - Shutdown(); -} - -void BasicToolBarFactory::Shutdown() -{ - Reference<lang::XComponent> xComponent (mxConfigurationController, UNO_QUERY); - if (xComponent.is()) - xComponent->removeEventListener(static_cast<lang::XEventListener*>(this)); - if (mxConfigurationController.is()) - { - mxConfigurationController->removeResourceFactoryForReference(this); - mxConfigurationController = nullptr; - } -} - -//----- XInitialization ------------------------------------------------------- - -void SAL_CALL BasicToolBarFactory::initialize (const Sequence<Any>& aArguments) -{ - if (!aArguments.hasElements()) - return; - try { - // Get the XController from the first argument. - mxController.set(aArguments[0], UNO_QUERY_THROW); + mxController = rxController; utl::MediaDescriptor aDescriptor (mxController->getModel()->getArgs()); if ( ! aDescriptor.getUnpackedValueOrDefault( @@ -80,8 +50,7 @@ void SAL_CALL BasicToolBarFactory::initialize (const Sequence<Any>& aArguments) false)) { // Register the factory for its supported tool bars. - Reference<XControllerManager> xControllerManager(mxController, UNO_QUERY_THROW); - mxConfigurationController = xControllerManager->getConfigurationController(); + mxConfigurationController = mxController->getConfigurationController(); if (mxConfigurationController.is()) { mxConfigurationController->addResourceFactory( @@ -106,6 +75,28 @@ void SAL_CALL BasicToolBarFactory::initialize (const Sequence<Any>& aArguments) } } + +BasicToolBarFactory::~BasicToolBarFactory() +{ +} + +void BasicToolBarFactory::disposing(std::unique_lock<std::mutex>&) +{ + Shutdown(); +} + +void BasicToolBarFactory::Shutdown() +{ + Reference<lang::XComponent> xComponent (mxConfigurationController, UNO_QUERY); + if (xComponent.is()) + xComponent->removeEventListener(static_cast<lang::XEventListener*>(this)); + if (mxConfigurationController.is()) + { + mxConfigurationController->removeResourceFactoryForReference(this); + mxConfigurationController = nullptr; + } +} + //----- lang::XEventListener -------------------------------------------------- void SAL_CALL BasicToolBarFactory::disposing ( @@ -150,12 +141,4 @@ void BasicToolBarFactory::ThrowIfDisposed() const } // end of namespace sd::framework -extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* -com_sun_star_comp_Draw_framework_BasicToolBarFactory_get_implementation(css::uno::XComponentContext*, - css::uno::Sequence<css::uno::Any> const &) -{ - return cppu::acquire(new sd::framework::BasicToolBarFactory); -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 6a6b8065e180..30f642d9533b 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "BasicViewFactory.hxx" +#include <framework/factories/BasicViewFactory.hxx> #include <framework/ViewShellWrapper.hxx> #include <framework/FrameworkHelper.hxx> @@ -82,7 +82,7 @@ public: //===== ViewFactory =========================================================== -BasicViewFactory::BasicViewFactory () +BasicViewFactory::BasicViewFactory (const rtl::Reference<::sd::DrawController>& rxController) : mpViewShellContainer(new ViewShellContainer()), mpBase(nullptr), mpFrameView(nullptr), @@ -90,6 +90,30 @@ BasicViewFactory::BasicViewFactory () mpViewCache(std::make_shared<ViewCache>()), mxLocalPane(new Pane(Reference<XResourceId>(), mpWindow.get())) { + try + { + // Tunnel through the controller to obtain a ViewShellBase. + mpBase = rxController->GetViewShellBase(); + + // Register the factory for its supported views. + mxConfigurationController = rxController->getConfigurationController(); + if ( ! mxConfigurationController.is()) + throw RuntimeException(); + mxConfigurationController->addResourceFactory(FrameworkHelper::msImpressViewURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msDrawViewURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msOutlineViewURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this); + mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this); + } + catch (RuntimeException&) + { + mpBase = nullptr; + if (mxConfigurationController.is()) + mxConfigurationController->removeResourceFactoryForReference(this); + throw; + } } BasicViewFactory::~BasicViewFactory() @@ -226,43 +250,6 @@ void SAL_CALL BasicViewFactory::releaseResource (const Reference<XResource>& rxV mpViewShellContainer->erase(iViewShell); } -void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments) -{ - if (!aArguments.hasElements()) - return; - - try - { - // Get the XController from the first argument. - Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW); - - // Tunnel through the controller to obtain a ViewShellBase. - ::sd::DrawController* pController = dynamic_cast<sd::DrawController*>(xController.get()); - if (pController != nullptr) - mpBase = pController->GetViewShellBase(); - - // Register the factory for its supported views. - Reference<XControllerManager> xCM (xController,UNO_QUERY_THROW); - mxConfigurationController = xCM->getConfigurationController(); - if ( ! mxConfigurationController.is()) - throw RuntimeException(); - mxConfigurationController->addResourceFactory(FrameworkHelper::msImpressViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msDrawViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msOutlineViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this); - } - catch (RuntimeException&) - { - mpBase = nullptr; - if (mxConfigurationController.is()) - mxConfigurationController->removeResourceFactoryForReference(this); - throw; - } -} - std::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::CreateView ( const Reference<XResourceId>& rxViewId, SfxViewFrame& rFrame, @@ -505,12 +492,4 @@ void BasicViewFactory::ActivateCenterView ( } // end of namespace sd::framework -extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* -com_sun_star_comp_Draw_framework_BasicViewFactory_get_implementation(css::uno::XComponentContext*, - css::uno::Sequence<css::uno::Any> const &) -{ - return cppu::acquire(new sd::framework::BasicViewFactory); -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/framework/module/ModuleController.cxx b/sd/source/ui/framework/module/ModuleController.cxx index ac1c41068b54..1e35e835183b 100644 --- a/sd/source/ui/framework/module/ModuleController.cxx +++ b/sd/source/ui/framework/module/ModuleController.cxx @@ -19,6 +19,9 @@ #include <framework/ModuleController.hxx> #include <framework/PresentationFactory.hxx> +#include <framework/factories/BasicPaneFactory.hxx> +#include <framework/factories/BasicViewFactory.hxx> +#include <framework/factories/BasicToolBarFactory.hxx> #include <DrawController.hxx> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -63,15 +66,6 @@ ModuleController::ModuleController(const rtl::Reference<::sd::DrawController>& r ProcessFactory( "com.sun.star.drawing.framework.BasicToolBarFactory", { "private:resource/toolbar/ViewTabBar" }); - ProcessFactory( - "com.sun.star.comp.Draw.framework.TaskPanelFactory", - { "private:resource/toolpanel/AllMasterPages", - "private:resource/toolpanel/RecentMasterPages", - "private:resource/toolpanel/UsedMasterPages", - "private:resource/toolpanel/Layouts", - "private:resource/toolpanel/TableDesign", - "private:resource/toolpanel/CustomAnimations", - "private:resource/toolpanel/SlideTransitions" }); try { @@ -148,18 +142,14 @@ void SAL_CALL ModuleController::requestResource (const OUString& rsResourceURL) ::comphelper::getProcessComponentContext(); // Create the factory service. - Sequence<Any> aArguments{ Any(uno::Reference<XControllerManager>(mxController)) }; - try - { - xFactory = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( - iFactory->second, - aArguments, - xContext); - } - catch (const Exception&) - { - TOOLS_WARN_EXCEPTION("sd.fwk", "caught exception while creating factory"); - } + if (iFactory->second == "com.sun.star.drawing.framework.BasicPaneFactory") + xFactory = uno::Reference<css::drawing::framework::XResourceFactory>(new BasicPaneFactory(xContext, mxController)); + else if (iFactory->second == "com.sun.star.drawing.framework.BasicViewFactory") + xFactory = uno::Reference<css::drawing::framework::XResourceFactory>(new BasicViewFactory(mxController)); + else if (iFactory->second == "com.sun.star.drawing.framework.BasicToolBarFactory") + xFactory = uno::Reference<css::drawing::framework::XResourceFactory>(new BasicToolBarFactory(mxController)); + else + throw RuntimeException("unknown factory"); // Remember that this factory has been instanced. maLoadedFactories[iFactory->second] = xFactory; diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.hxx b/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx similarity index 96% rename from sd/source/ui/framework/factories/BasicPaneFactory.hxx rename to sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx index 317776e48c28..fb839cc5d20c 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.hxx +++ b/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <comphelper/compbase.hxx> #include <cppuhelper/weakref.hxx> +#include <rtl/ref.hxx> #include <memory> @@ -31,14 +32,13 @@ namespace com::sun::star::drawing::framework { class XConfigurationController; } namespace com::sun::star::uno { class XComponentContext; } namespace sd { - +class DrawController; class ViewShellBase; } namespace sd::framework { typedef comphelper::WeakComponentImplHelper < - css::lang::XInitialization, css::drawing::framework::XResourceFactory, css::drawing::framework::XConfigurationChangeListener > BasicPaneFactoryInterfaceBase; @@ -56,16 +56,12 @@ class BasicPaneFactory { public: explicit BasicPaneFactory ( - const css::uno::Reference<css::uno::XComponentContext>& rxContext); + const css::uno::Reference<css::uno::XComponentContext>& rxContext, + const rtl::Reference<::sd::DrawController>& rxController); virtual ~BasicPaneFactory() override; virtual void disposing(std::unique_lock<std::mutex>&) override; - // XInitialization - - virtual void SAL_CALL initialize( - const css::uno::Sequence<css::uno::Any>& aArguments) override; - // XResourceFactory virtual css::uno::Reference<css::drawing::framework::XResource> diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.hxx b/sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx similarity index 91% rename from sd/source/ui/framework/factories/BasicToolBarFactory.hxx rename to sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx index fdaf92788b6d..5cea4335b10f 100644 --- a/sd/source/ui/framework/factories/BasicToolBarFactory.hxx +++ b/sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx @@ -22,16 +22,17 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/drawing/framework/XResourceFactory.hpp> #include <comphelper/compbase.hxx> +#include <rtl/ref.hxx> namespace com::sun::star::frame { class XController; } namespace com::sun::star::drawing::framework { class XResourceId; } namespace com::sun::star::drawing::framework { class XConfigurationController; } +namespace sd { class DrawController; } namespace sd::framework { typedef comphelper::WeakComponentImplHelper < css::drawing::framework::XResourceFactory, - css::lang::XInitialization, css::lang::XEventListener > BasicToolBarFactoryInterfaceBase; @@ -42,7 +43,7 @@ class BasicToolBarFactory : public BasicToolBarFactoryInterfaceBase { public: - BasicToolBarFactory (); + BasicToolBarFactory (const rtl::Reference<::sd::DrawController>& rxController); virtual ~BasicToolBarFactory() override; virtual void disposing(std::unique_lock<std::mutex>&) override; @@ -59,11 +60,6 @@ public: const css::uno::Reference<css::drawing::framework::XResource>& rxToolBar) override; - // XInitialization - - virtual void SAL_CALL initialize( - const css::uno::Sequence<css::uno::Any>& aArguments) override; - // lang::XEventListener virtual void SAL_CALL disposing ( @@ -71,7 +67,7 @@ public: private: css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController; - css::uno::Reference<css::frame::XController> mxController; + rtl::Reference<::sd::DrawController> mxController; void Shutdown(); diff --git a/sd/source/ui/framework/factories/BasicViewFactory.hxx b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx similarity index 94% rename from sd/source/ui/framework/factories/BasicViewFactory.hxx rename to sd/source/ui/inc/framework/factories/BasicViewFactory.hxx index ccd5cbbda9f9..1f24e38f5191 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.hxx +++ b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <comphelper/compbase.hxx> +#include <rtl/ref.hxx> #include <vcl/vclptr.hxx> #include <memory> @@ -31,6 +32,7 @@ namespace com::sun::star::drawing::framework { class XConfigurationController; } namespace com::sun::star::drawing::framework { class XPane; } namespace sd { +class DrawController; class ViewShell; class ViewShellBase; class FrameView; @@ -41,8 +43,7 @@ namespace vcl { class Window; } namespace sd::framework { typedef comphelper::WeakComponentImplHelper < - css::drawing::framework::XResourceFactory, - css::lang::XInitialization + css::drawing::framework::XResourceFactory > BasicViewFactoryInterfaceBase; /** Factory for the frequently used standard views of the drawing framework: @@ -61,7 +62,7 @@ class BasicViewFactory : public BasicViewFactoryInterfaceBase { public: - BasicViewFactory (); + BasicViewFactory(const rtl::Reference<::sd::DrawController>& rxController); virtual ~BasicViewFactory() override; virtual void disposing(std::unique_lock<std::mutex>&) override; @@ -75,11 +76,6 @@ public: virtual void SAL_CALL releaseResource ( const css::uno::Reference<css::drawing::framework::XResource>& xView) override; - // XInitialization - - virtual void SAL_CALL initialize( - const css::uno::Sequence<css::uno::Any>& aArguments) override; - private: css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController; diff --git a/sd/util/sd.component b/sd/util/sd.component index be3f2710f683..65e92cd69c6c 100644 --- a/sd/util/sd.component +++ b/sd/util/sd.component @@ -45,18 +45,6 @@ constructor="com_sun_star_comp_Draw_SlideRenderer_get_implementation"> <service name="com.sun.star.drawing.SlideRenderer"/> </implementation> - <implementation name="com.sun.star.comp.Draw.framework.BasicPaneFactory" - constructor="com_sun_star_comp_Draw_framework_BasicPaneFactory_get_implementation"> - <service name="com.sun.star.drawing.framework.BasicPaneFactory"/> - </implementation> - <implementation name="com.sun.star.comp.Draw.framework.BasicToolBarFactory" - constructor="com_sun_star_comp_Draw_framework_BasicToolBarFactory_get_implementation"> - <service name="com.sun.star.drawing.framework.BasicToolBarFactory"/> - </implementation> - <implementation name="com.sun.star.comp.Draw.framework.BasicViewFactory" - constructor="com_sun_star_comp_Draw_framework_BasicViewFactory_get_implementation"> - <service name="com.sun.star.drawing.framework.BasicViewFactory"/> - </implementation> <implementation name="com.sun.star.comp.Draw.framework.ResourceId" constructor="com_sun_star_comp_Draw_framework_ResourceID_get_implementation"> <service name="com.sun.star.drawing.framework.ResourceId"/> diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index c06f274fae47..6869bdbf805e 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -700,9 +700,6 @@ draw_constructor_list = [ "com_sun_star_comp_sd_SlideLayoutController_get_implementation", "com_sun_star_comp_sd_DisplayModeController_get_implementation", "RandomAnimationNode_get_implementation", - "com_sun_star_comp_Draw_framework_BasicPaneFactory_get_implementation", - "com_sun_star_comp_Draw_framework_BasicToolBarFactory_get_implementation", - "com_sun_star_comp_Draw_framework_BasicViewFactory_get_implementation", "com_sun_star_comp_Draw_framework_ResourceID_get_implementation", "org_openoffice_comp_Draw_framework_PanelFactory_get_implementation", "css_comp_Impress_oox_PowerPointExport", diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 9a63a43bc958..463edff70ee9 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -9690,11 +9690,8 @@ sd/source/ui/framework/configuration/ResourceFactoryManager.hxx sd/source/ui/framework/configuration/ResourceId.cxx sd/source/ui/framework/configuration/UpdateRequest.hxx sd/source/ui/framework/factories/BasicPaneFactory.cxx -sd/source/ui/framework/factories/BasicPaneFactory.hxx sd/source/ui/framework/factories/BasicToolBarFactory.cxx -sd/source/ui/framework/factories/BasicToolBarFactory.hxx sd/source/ui/framework/factories/BasicViewFactory.cxx -sd/source/ui/framework/factories/BasicViewFactory.hxx sd/source/ui/framework/factories/ChildWindowPane.cxx sd/source/ui/framework/factories/ChildWindowPane.hxx sd/source/ui/framework/factories/FullScreenPane.cxx @@ -9829,6 +9826,9 @@ sd/source/ui/inc/framework/Pane.hxx sd/source/ui/inc/framework/PresentationFactory.hxx sd/source/ui/inc/framework/ResourceId.hxx sd/source/ui/inc/framework/ViewShellWrapper.hxx +sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx +sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx +sd/source/ui/inc/framework/factories/BasicViewFactory.hxx sd/source/ui/inc/fuarea.hxx sd/source/ui/inc/fubullet.hxx sd/source/ui/inc/fuchar.hxx commit fec0b1e444c416feaa416e79f0b8ece8069951e0 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Jan 25 09:19:17 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jan 26 06:36:37 2023 +0000 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.gran...@collabora.co.uk> 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&) {