summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-01-19 12:36:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-01-20 06:26:48 +0000
commit4c06cfcd13195e9e996bc09dbee2dcac1c5e8ed2 (patch)
treed2582a998194884b99178a4b43f0da980b413624 /sd
parentd2cd7097ab8d8fe1a69b9f6e4a11c978b667951a (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>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/framework/factories/PresentationFactory.cxx43
-rw-r--r--sd/source/ui/framework/module/ModuleController.cxx47
-rw-r--r--sd/source/ui/inc/framework/ModuleController.hxx18
-rw-r--r--sd/source/ui/inc/framework/PresentationFactory.hxx9
-rw-r--r--sd/util/sd.component4
5 files changed, 21 insertions, 100 deletions
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"/>