diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-13 20:22:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-15 08:46:56 +0200 |
commit | 82c64c311973a62c0e9bd2fee47c69921182b86e (patch) | |
tree | b71827c4e3a5f0875094c48f943b26b97ec34207 /shell | |
parent | b9707b5e3a3256c8b58486e500a7270e9e7c7446 (diff) |
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@collabora.co.uk>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/Library_localebe.mk | 1 | ||||
-rw-r--r-- | shell/source/backends/localebe/localebackend.cxx | 27 | ||||
-rw-r--r-- | shell/source/backends/localebe/localebackend.hxx | 17 | ||||
-rw-r--r-- | shell/source/backends/localebe/localebe1.component | 5 | ||||
-rw-r--r-- | shell/source/backends/localebe/localebecdef.cxx | 63 |
5 files changed, 14 insertions, 99 deletions
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: */ |