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 #include -#include "BasicPaneFactory.hxx" +#include #include "ChildWindowPane.hxx" #include "FrameWindowPane.hxx" @@ -84,67 +84,23 @@ public: //===== PaneFactory =========================================================== BasicPaneFactory::BasicPaneFactory ( - const Reference& rxContext) + const Reference& rxContext, + const rtl::Reference<::sd::DrawController>& rxController) : mxComponentContext(rxContext), mpViewShellBase(nullptr), mpPaneContainer(new PaneContainer) { -} - -BasicPaneFactory::~BasicPaneFactory() -{ -} - -void BasicPaneFactory::disposing(std::unique_lock&) -{ - Reference xCC (mxConfigurationControllerWeak); - if (xCC.is()) - { - xCC->removeResourceFactoryForReference(this); - xCC->removeConfigurationChangeListener(this); - mxConfigurationControllerWeak.clear(); - } - - for (const auto& rDescriptor : *mpPaneContainer) - { - if (rDescriptor.mbIsReleased) - { - Reference xComponent (rDescriptor.mxPane, UNO_QUERY); - if (xComponent.is()) - { - xComponent->removeEventListener(this); - xComponent->dispose(); - } - } - } -} - -void SAL_CALL BasicPaneFactory::initialize (const Sequence& aArguments) -{ - if (!aArguments.hasElements()) - return; - try { - // Get the XController from the first argument. - Reference xController (aArguments[0], UNO_QUERY_THROW); - // Tunnel through the controller to obtain access to the ViewShellBase. - try - { - if (auto pController = dynamic_cast(xController.get())) - mpViewShellBase = pController->GetViewShellBase(); - } - catch(RuntimeException&) - {} + mpViewShellBase = rxController->GetViewShellBase(); - Reference xCM (xController, UNO_QUERY_THROW); - Reference xCC (xCM->getConfigurationController()); + Reference 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& aArguments) } } +BasicPaneFactory::~BasicPaneFactory() +{ +} + +void BasicPaneFactory::disposing(std::unique_lock&) +{ + Reference xCC (mxConfigurationControllerWeak); + if (xCC.is()) + { + xCC->removeResourceFactoryForReference(this); + xCC->removeConfigurationChangeListener(this); + mxConfigurationControllerWeak.clear(); + } + + for (const auto& rDescriptor : *mpPaneContainer) + { + if (rDescriptor.mbIsReleased) + { + Reference xComponent (rDescriptor.mxPane, UNO_QUERY); + if (xComponent.is()) + { + xComponent->removeEventListener(this); + xComponent->dispose(); + } + } + } +} + //===== XPaneFactory ========================================================== Reference 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 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 #include #include +#include #include #include @@ -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&) -{ - Shutdown(); -} - -void BasicToolBarFactory::Shutdown() -{ - Reference xComponent (mxConfigurationController, UNO_QUERY); - if (xComponent.is()) - xComponent->removeEventListener(static_cast(this)); - if (mxConfigurationController.is()) - { - mxConfigurationController->removeResourceFactoryForReference(this); - mxConfigurationController = nullptr; - } -} - -//----- XInitialization ------------------------------------------------------- - -void SAL_CALL BasicToolBarFactory::initialize (const Sequence& 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& aArguments) false)) { // Register the factory for its supported tool bars. - Reference 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& aArguments) } } + +BasicToolBarFactory::~BasicToolBarFactory() +{ +} + +void BasicToolBarFactory::disposing(std::unique_lock&) +{ + Shutdown(); +} + +void BasicToolBarFactory::Shutdown() +{ + Reference xComponent (mxConfigurationController, UNO_QUERY); + if (xComponent.is()) + xComponent->removeEventListener(static_cast(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 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 #include #include @@ -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()), mxLocalPane(new Pane(Reference(), 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& rxV mpViewShellContainer->erase(iViewShell); } -void SAL_CALL BasicViewFactory::initialize (const Sequence& aArguments) -{ - if (!aArguments.hasElements()) - return; - - try - { - // Get the XController from the first argument. - Reference xController (aArguments[0], UNO_QUERY_THROW); - - // Tunnel through the controller to obtain a ViewShellBase. - ::sd::DrawController* pController = dynamic_cast(xController.get()); - if (pController != nullptr) - mpBase = pController->GetViewShellBase(); - - // Register the factory for its supported views. - Reference 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::CreateView ( const Reference& 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 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 #include +#include +#include +#include #include #include #include @@ -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 aArguments{ Any(uno::Reference(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(new BasicPaneFactory(xContext, mxController)); + else if (iFactory->second == "com.sun.star.drawing.framework.BasicViewFactory") + xFactory = uno::Reference(new BasicViewFactory(mxController)); + else if (iFactory->second == "com.sun.star.drawing.framework.BasicToolBarFactory") + xFactory = uno::Reference(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 #include #include +#include #include @@ -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& rxContext); + const css::uno::Reference& rxContext, + const rtl::Reference<::sd::DrawController>& rxController); virtual ~BasicPaneFactory() override; virtual void disposing(std::unique_lock&) override; - // XInitialization - - virtual void SAL_CALL initialize( - const css::uno::Sequence& aArguments) override; - // XResourceFactory virtual css::uno::Reference 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 #include #include +#include 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&) override; @@ -59,11 +60,6 @@ public: const css::uno::Reference& rxToolBar) override; - // XInitialization - - virtual void SAL_CALL initialize( - const css::uno::Sequence& aArguments) override; - // lang::XEventListener virtual void SAL_CALL disposing ( @@ -71,7 +67,7 @@ public: private: css::uno::Reference mxConfigurationController; - css::uno::Reference 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 #include +#include #include #include @@ -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&) override; @@ -75,11 +76,6 @@ public: virtual void SAL_CALL releaseResource ( const css::uno::Reference& xView) override; - // XInitialization - - virtual void SAL_CALL initialize( - const css::uno::Sequence& aArguments) override; - private: css::uno::Reference 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"> - - - - - - - - - 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