From a2d093c06d047e9efe41c90e7269d0dd2293e9c8 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 20 Jan 2023 15:07:28 +0200 Subject: no need to load the list of impress/draw modules from config this is not something that changes Change-Id: Ie382665690a8baa31c916029de567cccdfdd0425 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145897 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sd/source/ui/framework/module/ModuleController.cxx | 81 +++++++++------------- sd/source/ui/inc/framework/ModuleController.hxx | 9 +-- 2 files changed, 37 insertions(+), 53 deletions(-) (limited to 'sd/source/ui') diff --git a/sd/source/ui/framework/module/ModuleController.cxx b/sd/source/ui/framework/module/ModuleController.cxx index a703c48ca27c..4d98bbfa38c2 100644 --- a/sd/source/ui/framework/module/ModuleController.cxx +++ b/sd/source/ui/framework/module/ModuleController.cxx @@ -37,45 +37,44 @@ using ::sd::tools::ConfigurationAccess; namespace sd::framework { -const sal_uInt32 snFactoryPropertyCount (2); - //===== ModuleController ====================================================== -Reference ModuleController::CreateInstance ( - const Reference& rxContext) +Reference ModuleController::CreateInstance() { - return new ModuleController(rxContext); + return new ModuleController(); } -ModuleController::ModuleController (const Reference& rxContext) +ModuleController::ModuleController() { - /** Load a list of URL to service mappings from the - /org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories - configuration entry. The mappings are stored in the + /** Load a list of URL to service mappings. + The mappings are stored in the mpResourceToFactoryMap member. */ - try - { - ConfigurationAccess aConfiguration ( - rxContext, - "/org.openoffice.Office.Impress/", - ConfigurationAccess::READ_ONLY); - Reference xFactories ( - aConfiguration.GetConfigurationNode("MultiPaneGUI/Framework/ResourceFactories"), - UNO_QUERY); - ::std::vector aProperties (snFactoryPropertyCount); - aProperties[0] = "ServiceName"; - aProperties[1] = "ResourceList"; - ConfigurationAccess::ForAll( - xFactories, - aProperties, - [this] (OUString const&, ::std::vector const& xs) { - return this->ProcessFactory(xs); - } ); - } - catch (Exception&) - { - DBG_UNHANDLED_EXCEPTION("sd"); - } + ProcessFactory( + "com.sun.star.drawing.framework.BasicPaneFactory", + { "private:resource/pane/CenterPane", + "private:resource/pane/LeftImpressPane", + "private:resource/pane/LeftDrawPane" }); + ProcessFactory( + "com.sun.star.drawing.framework.BasicViewFactory", + { "private:resource/view/ImpressView", + "private:resource/view/GraphicView", + "private:resource/view/OutlineView", + "private:resource/view/NotesView", + "private:resource/view/HandoutView", + "private:resource/view/SlideSorter", + "private:resource/view/PresentationView" }); + 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" }); } ModuleController::~ModuleController() noexcept @@ -90,21 +89,9 @@ void ModuleController::disposing(std::unique_lock&) mxController.clear(); } -void ModuleController::ProcessFactory (const ::std::vector& rValues) +void ModuleController::ProcessFactory (const OUString& sServiceName, ::std::vector aURLs) { - OSL_ASSERT(rValues.size() == snFactoryPropertyCount); - - // Get the service name of the factory. - OUString sServiceName; - rValues[0] >>= sServiceName; - // Get all resource URLs that are created by the factory. - Reference xResources (rValues[1], UNO_QUERY); - ::std::vector aURLs; - tools::ConfigurationAccess::FillList( - xResources, - "URL", - aURLs); SAL_INFO("sd.fwk", __func__ << ": ModuleController::adding factory " << sServiceName); @@ -197,10 +184,10 @@ void SAL_CALL ModuleController::initialize (const Sequence& aArguments) extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* com_sun_star_comp_Draw_framework_module_ModuleController_get_implementation( - css::uno::XComponentContext* context, + css::uno::XComponentContext* /*context*/, css::uno::Sequence const &) { - css::uno::Reference< css::uno::XInterface > xModCont ( sd::framework::ModuleController::CreateInstance(context) ); + css::uno::Reference< css::uno::XInterface > xModCont ( sd::framework::ModuleController::CreateInstance() ); xModCont->acquire(); return xModCont.get(); } diff --git a/sd/source/ui/inc/framework/ModuleController.hxx b/sd/source/ui/inc/framework/ModuleController.hxx index 5075e4c4710f..dd8985e175a1 100644 --- a/sd/source/ui/inc/framework/ModuleController.hxx +++ b/sd/source/ui/inc/framework/ModuleController.hxx @@ -59,9 +59,7 @@ class ModuleController final public: static css::uno::Reference< css::drawing::framework::XModuleController> - CreateInstance ( - const css::uno::Reference& - rxContext); + CreateInstance(); virtual void disposing(std::unique_lock&) override; @@ -82,14 +80,13 @@ private: std::unordered_map> maLoadedFactories; /// @throws std::exception - ModuleController ( - const css::uno::Reference& rxContext); + ModuleController(); ModuleController (const ModuleController&) = delete; virtual ~ModuleController() noexcept override; /** Called for every entry in the ResourceFactories configuration entry. */ - void ProcessFactory (const ::std::vector& rValues); + void ProcessFactory (const OUString& ServiceName, ::std::vector aURLs); /** Instantiate startup services. This method is called once when a new ModuleController object is created. -- cgit v1.2.3