[Libreoffice-commits] core.git: shell/Library_localebe.mk shell/source solenv/bin

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 15 06:47:48 UTC 2020


 shell/Library_localebe.mk                          |    1 
 shell/source/backends/localebe/localebackend.cxx   |   27 +++------
 shell/source/backends/localebe/localebackend.hxx   |   17 -----
 shell/source/backends/localebe/localebe1.component |    5 +
 shell/source/backends/localebe/localebecdef.cxx    |   63 ---------------------
 solenv/bin/native-code.py                          |    3 -
 6 files changed, 16 insertions(+), 100 deletions(-)

New commits:
commit 82c64c311973a62c0e9bd2fee47c69921182b86e
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Jul 13 20:22:04 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 15 08:46:56 2020 +0200

    shell/locale: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: Id13b26fb6f518e0586bb01c0c897c039fd3bd887
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98683
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/shell/Library_localebe.mk b/shell/Library_localebe.mk
index b8d8aba8f15c..dd598dacdbe9 100644
--- a/shell/Library_localebe.mk
+++ b/shell/Library_localebe.mk
@@ -29,7 +29,6 @@ $(eval $(call gb_Library_set_componentfile,localebe1,shell/source/backends/local
 
 $(eval $(call gb_Library_add_exception_objects,localebe1,\
     shell/source/backends/localebe/localebackend \
-    shell/source/backends/localebe/localebecdef \
 ))
 
 # vim: set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/shell/source/backends/localebe/localebackend.cxx b/shell/source/backends/localebe/localebackend.cxx
index f78c5253739b..558926d8febd 100644
--- a/shell/source/backends/localebe/localebackend.cxx
+++ b/shell/source/backends/localebe/localebackend.cxx
@@ -25,6 +25,7 @@
 
 #include "localebackend.hxx"
 #include <com/sun/star/beans/Optional.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 #include <cppuhelper/supportsservice.hxx>
 #include <rtl/character.hxx>
 #include <o3tl/char16_t2wchar_t.hxx>
@@ -245,11 +246,6 @@ LocaleBackend::~LocaleBackend()
 }
 
 
-LocaleBackend* LocaleBackend::createInstance()
-{
-    return new LocaleBackend;
-}
-
 
 css::beans::Optional<css::uno::Any> LocaleBackend::getLocale()
 {
@@ -312,19 +308,9 @@ css::uno::Any LocaleBackend::getPropertyValue(
 }
 
 
-OUString LocaleBackend::getBackendName() {
-    return "com.sun.star.comp.configuration.backend.LocaleBackend" ;
-}
-
 OUString SAL_CALL LocaleBackend::getImplementationName()
 {
-    return getBackendName() ;
-}
-
-uno::Sequence<OUString> LocaleBackend::getBackendServiceNames()
-{
-    uno::Sequence<OUString> aServiceNameList { "com.sun.star.configuration.backend.LocaleBackend" };
-    return aServiceNameList ;
+    return "com.sun.star.comp.configuration.backend.LocaleBackend" ;
 }
 
 sal_Bool SAL_CALL LocaleBackend::supportsService(const OUString& aServiceName)
@@ -334,7 +320,14 @@ sal_Bool SAL_CALL LocaleBackend::supportsService(const OUString& aServiceName)
 
 uno::Sequence<OUString> SAL_CALL LocaleBackend::getSupportedServiceNames()
 {
-    return getBackendServiceNames() ;
+    return { "com.sun.star.configuration.backend.LocaleBackend" };
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+shell_LocaleBackend_get_implementation(
+    css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
+{
+    return cppu::acquire(new LocaleBackend());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/source/backends/localebe/localebackend.hxx b/shell/source/backends/localebe/localebackend.hxx
index 53abdcb91cd0..e2e4a0b36238 100644
--- a/shell/source/backends/localebe/localebackend.hxx
+++ b/shell/source/backends/localebe/localebackend.hxx
@@ -38,8 +38,6 @@ class LocaleBackend final : public ::cppu::WeakImplHelper <
 
     public:
 
-        static LocaleBackend* createInstance();
-
         // XServiceInfo
         virtual OUString SAL_CALL
             getImplementationName(  ) override ;
@@ -50,19 +48,6 @@ class LocaleBackend final : public ::cppu::WeakImplHelper <
         virtual uno::Sequence<OUString> SAL_CALL
             getSupportedServiceNames(  ) override ;
 
-        /**
-          Provides the implementation name.
-
-          @return   implementation name
-          */
-        static OUString getBackendName() ;
-        /**
-          Provides the supported services names
-
-          @return   service names
-          */
-        static uno::Sequence<OUString> getBackendServiceNames() ;
-
         // XPropertySet
         virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
         getPropertySetInfo() override
@@ -94,7 +79,6 @@ class LocaleBackend final : public ::cppu::WeakImplHelper <
             css::uno::Reference< css::beans::XVetoableChangeListener > const &) override
         {}
 
-    private:
         /**
           Service constructor from a service factory.
 
@@ -105,6 +89,7 @@ class LocaleBackend final : public ::cppu::WeakImplHelper <
         /** Destructor */
         virtual ~LocaleBackend() override ;
 
+    private:
         // Returns the user locale
         static css::beans::Optional<css::uno::Any> getLocale();
 
diff --git a/shell/source/backends/localebe/localebe1.component b/shell/source/backends/localebe/localebe1.component
index b874527b91cb..f19a3f9e8ea2 100644
--- a/shell/source/backends/localebe/localebe1.component
+++ b/shell/source/backends/localebe/localebe1.component
@@ -18,8 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="localebe1" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.configuration.backend.LocaleBackend">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.configuration.backend.LocaleBackend"
+    constructor="shell_LocaleBackend_get_implementation">
     <service name="com.sun.star.configuration.backend.LocaleBackend"/>
   </implementation>
 </component>
diff --git a/shell/source/backends/localebe/localebecdef.cxx b/shell/source/backends/localebe/localebecdef.cxx
deleted file mode 100644
index ed6e4c98b699..000000000000
--- a/shell/source/backends/localebe/localebecdef.cxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "localebackend.hxx"
-
-#include <cppuhelper/implementationentry.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-namespace uno = com::sun::star::uno ;
-
-
-static uno::Reference<uno::XInterface> createLocaleBackend(
-    SAL_UNUSED_PARAMETER const uno::Reference<uno::XComponentContext>&){
-
-    return * LocaleBackend::createInstance();
-}
-
-
-const cppu::ImplementationEntry kImplementations_entries[] =
-{
-    {
-        createLocaleBackend,
-        LocaleBackend::getBackendName,
-        LocaleBackend::getBackendServiceNames,
-        cppu::createSingleComponentFactory,
-        nullptr,
-        0
-    },
-    { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-} ;
-
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * localebe1_component_getFactory(
-    const char *aImplementationName,
-    void *aServiceManager,
-    void *aRegistryKey) {
-
-    return cppu::component_getFactoryHelper(
-        aImplementationName,
-        aServiceManager,
-        aRegistryKey,
-        kImplementations_entries) ;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index dc90b9bc4a6e..2d0b810058c4 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -24,7 +24,6 @@ core_factory_list = [
     ("libfilterconfiglo.a", "filterconfig1_component_getFactory"),
     ("libi18npoollo.a", "i18npool_component_getFactory"),
     ("libinvocadaptlo.a", "invocadapt_component_getFactory"),
-    ("liblocalebe1lo.a", "localebe1_component_getFactory"),
     ("libpackage2.a", "package2_component_getFactory"),
     ("libsmlo.a", "sm_component_getFactory"),
     ("libsrtrs1.a", "srtrs1_component_getFactory"),
@@ -257,6 +256,8 @@ core_constructor_list = [
     "com_sun_star_comp_sfx2_AppDispatchProvider_get_implementation",
     "com_sun_star_comp_sfx2_DocumentTemplates_get_implementation",
     "com_sun_star_comp_sfx2_GlobalEventBroadcaster_get_implementation",
+# shell/source/backends/localebe/localebe1.component
+    "shell_LocaleBackend_get_implementation",
 # sot/util/sot.component
     "com_sun_star_comp_embed_OLESimpleStorage",
 # stoc/source/inspect/introspection.component


More information about the Libreoffice-commits mailing list