[Libreoffice-commits] core.git: shell/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 16 13:17:54 UTC 2020


 shell/source/backends/desktopbe/desktopbackend.cxx   |   37 ++++---------------
 shell/source/backends/desktopbe/desktopbe1.component |    5 +-
 2 files changed, 12 insertions(+), 30 deletions(-)

New commits:
commit 0790a1445cb7e4fc004d060fa86934c747c3af41
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 16 10:32:00 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 16 15:17:15 2020 +0200

    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 at collabora.co.uk>

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>


More information about the Libreoffice-commits mailing list