diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-19 12:36:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-20 06:26:48 +0000 |
commit | 4c06cfcd13195e9e996bc09dbee2dcac1c5e8ed2 (patch) | |
tree | d2582a998194884b99178a4b43f0da980b413624 | |
parent | d2cd7097ab8d8fe1a69b9f6e4a11c978b667951a (diff) |
[API CHANGE] no need to load PresentationFactoryProvider via UNO and/or config
there is no benefit to having this constructed in such a convoluted
manner
Change-Id: Ib02b4bfe689326784bd8233003d10960700811d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145778
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/Impress.xcu | 7 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Impress.xcs | 9 | ||||
-rw-r--r-- | sd/source/ui/framework/factories/PresentationFactory.cxx | 43 | ||||
-rw-r--r-- | sd/source/ui/framework/module/ModuleController.cxx | 47 | ||||
-rw-r--r-- | sd/source/ui/inc/framework/ModuleController.hxx | 18 | ||||
-rw-r--r-- | sd/source/ui/inc/framework/PresentationFactory.hxx | 9 | ||||
-rw-r--r-- | sd/util/sd.component | 4 | ||||
-rwxr-xr-x | solenv/bin/native-code.py | 1 |
8 files changed, 21 insertions, 117 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/Impress.xcu b/officecfg/registry/data/org/openoffice/Office/Impress.xcu index 112a89e8521f..37ebdf4d005f 100644 --- a/officecfg/registry/data/org/openoffice/Office/Impress.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Impress.xcu @@ -181,13 +181,6 @@ </node> </node> </node> - <node oor:name="StartupServices"> - <node oor:name="S0" oor:op="replace"> - <prop oor:name="ServiceName"> - <value>com.sun.star.drawing.framework.PresentationFactoryProvider</value> - </prop> - </node> - </node> </node> </node> <node oor:name="Misc"> diff --git a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs index fefd4ba2f6bf..e650c48e9766 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs @@ -1319,15 +1319,6 @@ <label>Multi Pane Framework Resource Factories</label> </info> </set> - <set oor:name="StartupServices" oor:node-type="StartupService"> - <info> - <desc> - Set of services that are instantiated every time the - framework of a Draw or Impress document is initialized. - </desc> - <label>Multi Pane Framework Startup Services</label> - </info> - </set> </group> <group oor:name="SlideSorterBar"> <info> diff --git a/sd/source/ui/framework/factories/PresentationFactory.cxx b/sd/source/ui/framework/factories/PresentationFactory.cxx index 73c2d4bdb732..6603f5db5159 100644 --- a/sd/source/ui/framework/factories/PresentationFactory.cxx +++ b/sd/source/ui/framework/factories/PresentationFactory.cxx @@ -39,20 +39,6 @@ namespace sd::framework { namespace { -typedef comphelper::WeakComponentImplHelper<lang::XInitialization> PresentationFactoryProviderInterfaceBase; - -class PresentationFactoryProvider - : public PresentationFactoryProviderInterfaceBase -{ -public: - PresentationFactoryProvider (); - - // XInitialization - - virtual void SAL_CALL initialize( - const css::uno::Sequence<css::uno::Any>& aArguments) override; -}; - typedef comphelper::WeakComponentImplHelper<XView> PresentationViewInterfaceBase; /** The PresentationView is not an actual view, it is a marker whose @@ -143,32 +129,19 @@ void PresentationFactory::ThrowIfDisposed() const } } -namespace { - //===== PresentationFactoryProvider =========================================== -PresentationFactoryProvider::PresentationFactoryProvider () -{ -} - -// XInitialization - -void SAL_CALL PresentationFactoryProvider::initialize( - const Sequence<Any>& aArguments) +PresentationFactoryProvider::PresentationFactoryProvider (const Reference<frame::XController>& rxController) { - if (!aArguments.hasElements()) - return; - try { // Get the XController from the first argument. - Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW); - Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW); + Reference<XControllerManager> xCM (rxController, UNO_QUERY_THROW); Reference<XConfigurationController> xCC (xCM->getConfigurationController()); if (xCC.is()) xCC->addResourceFactory( gsPresentationViewURL, - new PresentationFactory(xController)); + new PresentationFactory(rxController)); } catch (RuntimeException&) { @@ -176,17 +149,7 @@ void SAL_CALL PresentationFactoryProvider::initialize( } } -} // end of anonymous namespace. - } // end of namespace sd::framework -extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* -com_sun_star_comp_Draw_framework_PresentationFactoryProvider_get_implementation(css::uno::XComponentContext*, - css::uno::Sequence<css::uno::Any> const &) -{ - return cppu::acquire(new sd::framework::PresentationFactoryProvider); -} - - /* 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 fdcdd06386fb..066f25ba70e1 100644 --- a/sd/source/ui/framework/module/ModuleController.cxx +++ b/sd/source/ui/framework/module/ModuleController.cxx @@ -18,6 +18,7 @@ */ #include <framework/ModuleController.hxx> +#include <framework/PresentationFactory.hxx> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -26,6 +27,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/diagnose_ex.hxx> +#include <rtl/ref.hxx> #include <sal/log.hxx> using namespace ::com::sun::star; @@ -36,7 +38,6 @@ using ::sd::tools::ConfigurationAccess; namespace sd::framework { const sal_uInt32 snFactoryPropertyCount (2); -const sal_uInt32 snStartupPropertyCount (1); //===== ModuleController ====================================================== Reference<XModuleController> ModuleController::CreateInstance ( @@ -119,54 +120,18 @@ void ModuleController::InstantiateStartupServices() { try { - tools::ConfigurationAccess aConfiguration ( - "/org.openoffice.Office.Impress/", - tools::ConfigurationAccess::READ_ONLY); - Reference<container::XNameAccess> xFactories ( - aConfiguration.GetConfigurationNode("MultiPaneGUI/Framework/StartupServices"), - UNO_QUERY); - ::std::vector<OUString> aProperties (snStartupPropertyCount); - aProperties[0] = "ServiceName"; - tools::ConfigurationAccess::ForAll( - xFactories, - aProperties, - [this] (OUString const&, ::std::vector<Any> const& xs) { - return this->ProcessStartupService(xs); - } ); - } - catch (Exception&) - { - SAL_WARN("sd.fwk", "ERROR in ModuleController::InstantiateStartupServices"); - } -} - -void ModuleController::ProcessStartupService (const ::std::vector<Any>& rValues) -{ - OSL_ASSERT(rValues.size() == snStartupPropertyCount); - - try - { - // Get the service name of the startup service. - OUString sServiceName; - rValues[0] >>= sServiceName; - // Instantiate service. - Reference<uno::XComponentContext> xContext = - ::comphelper::getProcessComponentContext(); - - // Create the startup service. - Sequence<Any> aArguments{ Any(mxController) }; // Note that when the new object will be destroyed at the end of // this scope when it does not register itself anywhere. // Typically it will add itself as ConfigurationChangeListener // at the configuration controller. - xContext->getServiceManager()->createInstanceWithArgumentsAndContext(sServiceName, aArguments, xContext); - - SAL_INFO("sd.fwk", __func__ << ": ModuleController::created startup service " << sServiceName); + Reference<uno::XComponentContext> xContext = + ::comphelper::getProcessComponentContext(); + rtl::Reference<::sd::framework::PresentationFactoryProvider> x = new sd::framework::PresentationFactoryProvider(mxController); } catch (Exception&) { - SAL_WARN("sd.fwk", "ERROR in ModuleController::ProcessStartupServices"); + SAL_WARN("sd.fwk", "ERROR in ModuleController::InstantiateStartupServices"); } } diff --git a/sd/source/ui/inc/framework/ModuleController.hxx b/sd/source/ui/inc/framework/ModuleController.hxx index 4efc6cc153d1..5075e4c4710f 100644 --- a/sd/source/ui/inc/framework/ModuleController.hxx +++ b/sd/source/ui/inc/framework/ModuleController.hxx @@ -48,9 +48,8 @@ typedef comphelper::WeakComponentImplHelper < resource and instantiates this service. The service is expected to register on its creation a factory for the resource in question. - 2. The ModuleController reads on its creation - org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices - configuration data and instantiates all listed services. These services + 2. The ModuleController instantiates PresentationFactoryProvider. + This service can then register as listeners at the ConfigurationController or do whatever they like. */ @@ -92,21 +91,10 @@ private: */ void ProcessFactory (const ::std::vector<css::uno::Any>& rValues); - /** Instantiate all startup services that are found in the - /org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices - configuration entry. This method is called once when a new + /** Instantiate startup services. This method is called once when a new ModuleController object is created. */ void InstantiateStartupServices(); - - /** Called for one entry in the StartupServices configuration list this - method instantiates the service described by the entry. It does not - hold references to the new object so that the object will be - destroyed on function exit when it does not register itself - somewhere. It typically will register as - XConfigurationChangeListener at the configuration controller. - */ - void ProcessStartupService (const ::std::vector<css::uno::Any>& rValues); }; } // end of namespace sd::framework diff --git a/sd/source/ui/inc/framework/PresentationFactory.hxx b/sd/source/ui/inc/framework/PresentationFactory.hxx index 897825c8acfb..bf3523c4bcb3 100644 --- a/sd/source/ui/inc/framework/PresentationFactory.hxx +++ b/sd/source/ui/inc/framework/PresentationFactory.hxx @@ -72,6 +72,15 @@ private: void ThrowIfDisposed() const; }; +typedef comphelper::WeakComponentImplHelper<> PresentationFactoryProviderInterfaceBase; + +class PresentationFactoryProvider + : public PresentationFactoryProviderInterfaceBase +{ +public: + PresentationFactoryProvider(const css::uno::Reference<css::frame::XController>& rxController); +}; + } // end of namespace sd::framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/util/sd.component b/sd/util/sd.component index fbe77785eb15..77731ac018ea 100644 --- a/sd/util/sd.component +++ b/sd/util/sd.component @@ -65,10 +65,6 @@ 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.PresentationFactoryProvider" - constructor="com_sun_star_comp_Draw_framework_PresentationFactoryProvider_get_implementation"> - <service name="com.sun.star.drawing.framework.PresentationFactoryProvider"/> - </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 7bb33ebe6f0f..1e394a6f7a74 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -706,7 +706,6 @@ draw_constructor_list = [ "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_PresentationFactoryProvider_get_implementation", "com_sun_star_comp_Draw_framework_ResourceID_get_implementation", "com_sun_star_comp_Draw_framework_configuration_ConfigurationController_get_implementation", "com_sun_star_comp_Draw_framework_module_ModuleController_get_implementation", |