diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-23 15:43:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-24 17:28:57 +0000 |
commit | e011ac1c14656df67dbb46e54402afa64ff47303 (patch) | |
tree | 2f022485d3c1c0b5130da64cfdd34aa612ea8461 | |
parent | 0bb90afaeb193181d7b98b79e962549d8a1dd85a (diff) |
[API CHANGE] remove service sd::framework::ModuleController
It makes no sense to be constructed externally.
Change-Id: I7e756e225e7b6e1785194b2f73edd5a7d65ec0e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146056
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | offapi/UnoApi_offapi.mk | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/drawing/framework/ModuleController.idl | 41 | ||||
-rw-r--r-- | sd/source/ui/framework/module/ModuleController.cxx | 46 | ||||
-rw-r--r-- | sd/source/ui/inc/DrawController.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/inc/framework/ModuleController.hxx | 15 | ||||
-rw-r--r-- | sd/source/ui/unoidl/DrawController.cxx | 11 | ||||
-rw-r--r-- | sd/util/sd.component | 4 | ||||
-rwxr-xr-x | solenv/bin/native-code.py | 1 |
8 files changed, 20 insertions, 103 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 0f3a4a371a73..bdc6f53a1087 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -148,7 +148,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/drawing/framework BasicPaneFactory \ BasicToolBarFactory \ BasicViewFactory \ - ModuleController \ ResourceId \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/embed,\ diff --git a/offapi/com/sun/star/drawing/framework/ModuleController.idl b/offapi/com/sun/star/drawing/framework/ModuleController.idl deleted file mode 100644 index 2828ef92de93..000000000000 --- a/offapi/com/sun/star/drawing/framework/ModuleController.idl +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -module com { module sun { module star { module drawing { module framework { - -/** See XModuleController for a description of the module - controller. - - <p>See ConfigurationController for a comment why this - service may be removed in the future.</p> - - <p>The ModuleController object for an application can be - obtained via the XControllerManager interface. -*/ -service ModuleController : XModuleController -{ - /** Create a new instance of a ModuleController as sub - controller of the given XController object. - */ - create ([in] ::com::sun::star::frame::XController xController); -}; - -}; }; }; }; }; // ::com::sun::star::drawing::framework - -/* 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 4d98bbfa38c2..ab6cc1e16703 100644 --- a/sd/source/ui/framework/module/ModuleController.cxx +++ b/sd/source/ui/framework/module/ModuleController.cxx @@ -37,14 +37,10 @@ using ::sd::tools::ConfigurationAccess; namespace sd::framework { -//===== ModuleController ====================================================== -Reference<XModuleController> ModuleController::CreateInstance() +ModuleController::ModuleController(const css::uno::Reference<css::frame::XController>& rxController) { - return new ModuleController(); -} + assert(rxController); -ModuleController::ModuleController() -{ /** Load a list of URL to service mappings. The mappings are stored in the mpResourceToFactoryMap member. @@ -75,6 +71,15 @@ ModuleController::ModuleController() "private:resource/toolpanel/TableDesign", "private:resource/toolpanel/CustomAnimations", "private:resource/toolpanel/SlideTransitions" }); + + try + { + mxController = rxController; + + InstantiateStartupServices(); + } + catch (RuntimeException&) + {} } ModuleController::~ModuleController() noexcept @@ -161,36 +166,7 @@ void SAL_CALL ModuleController::requestResource (const OUString& rsResourceURL) maLoadedFactories[iFactory->second] = xFactory; } -//----- XInitialization ------------------------------------------------------- - -void SAL_CALL ModuleController::initialize (const Sequence<Any>& aArguments) -{ - if (aArguments.hasElements()) - { - try - { - // Get the XController from the first argument. - mxController.set(aArguments[0], UNO_QUERY_THROW); - - InstantiateStartupServices(); - } - catch (RuntimeException&) - {} - } -} - } // end of namespace sd::framework -extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* -com_sun_star_comp_Draw_framework_module_ModuleController_get_implementation( - css::uno::XComponentContext* /*context*/, - css::uno::Sequence<css::uno::Any> const &) -{ - css::uno::Reference< css::uno::XInterface > xModCont ( sd::framework::ModuleController::CreateInstance() ); - xModCont->acquire(); - return xModCont.get(); -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/DrawController.hxx b/sd/source/ui/inc/DrawController.hxx index 1031d8185c89..bae71ee0f00e 100644 --- a/sd/source/ui/inc/DrawController.hxx +++ b/sd/source/ui/inc/DrawController.hxx @@ -40,6 +40,7 @@ namespace com::sun::star::drawing::framework { class XModuleController; } namespace com::sun::star::drawing { class XLayer; } namespace osl { class Mutex; } namespace sd::framework { class ConfigurationController; } +namespace sd::framework { class ModuleController; } class SdPage; namespace sd { @@ -297,8 +298,7 @@ private: css::uno::Reference<css::drawing::XDrawSubController> mxSubController; rtl::Reference<sd::framework::ConfigurationController> mxConfigurationController; - css::uno::Reference< - css::drawing::framework::XModuleController> mxModuleController; + rtl::Reference<sd::framework::ModuleController> mxModuleController; /** Send an event to all relevant property listeners that a property has changed its value. The fire() method of the diff --git a/sd/source/ui/inc/framework/ModuleController.hxx b/sd/source/ui/inc/framework/ModuleController.hxx index dd8985e175a1..6b4763d2e5b1 100644 --- a/sd/source/ui/inc/framework/ModuleController.hxx +++ b/sd/source/ui/inc/framework/ModuleController.hxx @@ -32,8 +32,7 @@ namespace com::sun::star::uno { class XComponentContext; } namespace sd::framework { typedef comphelper::WeakComponentImplHelper < - css::drawing::framework::XModuleController, - css::lang::XInitialization + css::drawing::framework::XModuleController > ModuleControllerInterfaceBase; /** The ModuleController has two tasks: @@ -57,9 +56,8 @@ class ModuleController final : public ModuleControllerInterfaceBase { public: - static css::uno::Reference< - css::drawing::framework::XModuleController> - CreateInstance(); + /// @throws std::exception + ModuleController(const css::uno::Reference<css::frame::XController>& rxController); virtual void disposing(std::unique_lock<std::mutex>&) override; @@ -67,11 +65,6 @@ public: virtual void SAL_CALL requestResource(const OUString& rsResourceURL) override; - // XInitialization - - virtual void SAL_CALL initialize( - const css::uno::Sequence<css::uno::Any>& aArguments) override; - private: css::uno::Reference< css::frame::XController> mxController; @@ -79,8 +72,6 @@ private: std::unordered_map<OUString, OUString> maResourceToFactoryMap; std::unordered_map<OUString, css::uno::WeakReference<css::uno::XInterface>> maLoadedFactories; - /// @throws std::exception - ModuleController(); ModuleController (const ModuleController&) = delete; virtual ~ModuleController() noexcept override; diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index 457231e6e537..59a2159c6838 100644 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -26,6 +26,7 @@ #include <FormShellManager.hxx> #include <Window.hxx> #include <framework/ConfigurationController.hxx> +#include <framework/ModuleController.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/sequence.hxx> @@ -34,7 +35,6 @@ #include <cppuhelper/typeprovider.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/drawing/framework/ModuleController.hpp> #include <com/sun/star/drawing/XDrawSubController.hpp> #include <com/sun/star/drawing/XLayer.hpp> @@ -763,9 +763,7 @@ void DrawController::ProvideFrameworkControllers() ::comphelper::getProcessComponentContext() ); mxConfigurationController = new sd::framework::ConfigurationController( xController); - mxModuleController = ModuleController::create( - xContext, - xController); + mxModuleController = new sd::framework::ModuleController(xController); } catch (const RuntimeException&) { @@ -776,9 +774,8 @@ void DrawController::ProvideFrameworkControllers() void DrawController::DisposeFrameworkControllers() { - Reference<XComponent> xComponent (mxModuleController, UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); + if (mxModuleController.is()) + mxModuleController->dispose(); if (mxConfigurationController.is()) mxConfigurationController->dispose(); diff --git a/sd/util/sd.component b/sd/util/sd.component index 012eab8ed233..be3f2710f683 100644 --- a/sd/util/sd.component +++ b/sd/util/sd.component @@ -65,10 +65,6 @@ constructor="org_openoffice_comp_Draw_framework_PanelFactory_get_implementation"> <service name="com.sun.star.drawing.framework.PanelFactory"/> </implementation> - <implementation name="com.sun.star.comp.Draw.framework.module.ModuleController" - constructor="com_sun_star_comp_Draw_framework_module_ModuleController_get_implementation"> - <service name="com.sun.star.drawing.framework.ModuleController"/> - </implementation> <implementation name="com.sun.star.comp.draw.SdHtmlOptionsDialog" constructor="com_sun_star_comp_draw_SdHtmlOptionsDialog_get_implementation"> <service name="com.sun.star.ui.dialog.FilterOptionsDialog"/> diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 03ec10d7baf3..c06f274fae47 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -704,7 +704,6 @@ draw_constructor_list = [ "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", - "com_sun_star_comp_Draw_framework_module_ModuleController_get_implementation", "org_openoffice_comp_Draw_framework_PanelFactory_get_implementation", "css_comp_Impress_oox_PowerPointExport", # sd/util/sdd.component |