summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-16 10:32:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-16 15:17:15 +0200
commit0790a1445cb7e4fc004d060fa86934c747c3af41 (patch)
tree97e542a306e401d04ff722ddbb07650bff75f433 /shell
parentfa47f9781fff89698a68353f9f37ea3ac6bda43c (diff)
shell/desktop: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: Id59a5182a94f642811063a1e29730aa6c7a01f5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98879 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'shell')
-rw-r--r--shell/source/backends/desktopbe/desktopbackend.cxx37
-rw-r--r--shell/source/backends/desktopbe/desktopbe1.component5
2 files changed, 12 insertions, 30 deletions
diff --git a/shell/source/backends/desktopbe/desktopbackend.cxx b/shell/source/backends/desktopbe/desktopbackend.cxx
index 92cb062d2496..e34ad8a9d5ff 100644
--- a/shell/source/backends/desktopbe/desktopbackend.cxx
+++ b/shell/source/backends/desktopbe/desktopbackend.cxx
@@ -51,15 +51,6 @@
namespace {
-OUString getDefaultImplementationName() {
- return
- "com.sun.star.comp.configuration.backend.DesktopBackend";
-}
-
-css::uno::Sequence< OUString > getDefaultSupportedServiceNames() {
- return { "com.sun.star.configuration.backend.DesktopBackend" };
-}
-
class Default:
public cppu::WeakImplHelper<
css::lang::XServiceInfo, css::beans::XPropertySet >
@@ -73,14 +64,14 @@ private:
virtual ~Default() override {}
virtual OUString SAL_CALL getImplementationName() override
- { return getDefaultImplementationName(); }
+ { return "com.sun.star.comp.configuration.backend.DesktopBackend"; }
virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override
{ return ServiceName == getSupportedServiceNames()[0]; }
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() override
- { return getDefaultSupportedServiceNames(); }
+ { return { "com.sun.star.configuration.backend.DesktopBackend" }; }
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo() override
@@ -284,8 +275,9 @@ css::uno::Reference< css::uno::XInterface > createBackend(
}
}
-css::uno::Reference< css::uno::XInterface > createInstance(
- css::uno::Reference< css::uno::XComponentContext > const & context)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+shell_DesktopBackend_get_implementation(
+ css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
{
OUString desktop;
css::uno::Reference< css::uno::XCurrentContext > current(
@@ -299,24 +291,13 @@ css::uno::Reference< css::uno::XInterface > createInstance(
if (desktop == "PLASMA5")
backend = createBackend(context,
"com.sun.star.configuration.backend.KF5Backend");
- return backend.is()
- ? backend : static_cast< cppu::OWeakObject * >(new Default);
+ if (!backend)
+ backend = static_cast< cppu::OWeakObject * >(new Default);
+ backend->acquire();
+ return backend.get();
}
-cppu::ImplementationEntry const services[] = {
- { &createInstance, &getDefaultImplementationName,
- &getDefaultSupportedServiceNames, &cppu::createSingleComponentFactory, nullptr,
- 0 },
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-};
-
}
-extern "C" SAL_DLLPUBLIC_EXPORT void * desktopbe1_component_getFactory(
- char const * pImplName, void * pServiceManager, void * pRegistryKey)
-{
- return cppu::component_getFactoryHelper(
- pImplName, pServiceManager, pRegistryKey, services);
-}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/source/backends/desktopbe/desktopbe1.component b/shell/source/backends/desktopbe/desktopbe1.component
index 10b30a665f8d..abc47f0425ce 100644
--- a/shell/source/backends/desktopbe/desktopbe1.component
+++ b/shell/source/backends/desktopbe/desktopbe1.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="desktopbe1" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.configuration.backend.DesktopBackend">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.configuration.backend.DesktopBackend"
+ constructor="shell_DesktopBackend_get_implementation">
<service name="com.sun.star.configuration.backend.DesktopBackend"/>
</implementation>
</component>