From 3e572e8c058d202a8266aa66af3e658cd9c54db4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 16 Jul 2020 10:43:21 +0200 Subject: [PATCH] shell/kf5: create instances with uno constructors See tdf#74608 for motivation. Change-Id: I45cf95f39f5d3bcab23000422b1348c72782acc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98880 Tested-by: Jenkins Reviewed-by: Noel Grandin --- shell/source/backends/kf5be/kf5backend.cxx | 34 ++++---------------- shell/source/backends/kf5be/kf5be1.component | 5 +-- 2 files changed, 9 insertions(+), 30 deletions(-) diff --git a/shell/source/backends/kf5be/kf5backend.cxx b/shell/source/backends/kf5be/kf5backend.cxx index 44d0134d394f..9948e41a9888 100644 --- a/shell/source/backends/kf5be/kf5backend.cxx +++ b/shell/source/backends/kf5be/kf5backend.cxx @@ -50,17 +50,6 @@ namespace { -OUString getServiceImplementationName() -{ - return "com.sun.star.comp.configuration.backend.KF5Backend"; -} - -css::uno::Sequence getServiceSupportedServiceNames() -{ - OUString name("com.sun.star.configuration.backend.KF5Backend"); - return css::uno::Sequence(&name, 1); -} - class Service : public cppu::WeakImplHelper, private boost::noncopyable { @@ -72,7 +61,7 @@ private: virtual OUString SAL_CALL getImplementationName() override { - return getServiceImplementationName(); + return "com.sun.star.comp.configuration.backend.KF5Backend"; } virtual sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override @@ -82,7 +71,7 @@ private: virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override { - return getServiceSupportedServiceNames(); + return { "com.sun.star.configuration.backend.KF5Backend" }; } virtual css::uno::Reference SAL_CALL getPropertySetInfo() override @@ -252,22 +241,11 @@ css::uno::Any Service::getPropertyValue(OUString const& PropertyName) throw css::beans::UnknownPropertyException(PropertyName, static_cast(this)); } -css::uno::Reference -createInstance(css::uno::Reference const&) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +shell_kf5desktop_get_implementation(css::uno::XComponentContext*, + css::uno::Sequence const&) { - return static_cast(new Service); + return cppu::acquire(new Service()); } - -cppu::ImplementationEntry const services[] - = { { &createInstance, &getServiceImplementationName, &getServiceSupportedServiceNames, - &cppu::createSingleComponentFactory, nullptr, 0 }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; } - -extern "C" SAL_DLLPUBLIC_EXPORT void* -kf5be1_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/kf5be/kf5be1.component b/shell/source/backends/kf5be/kf5be1.component index ad217dc80e66..dd893bcb6708 100644 --- a/shell/source/backends/kf5be/kf5be1.component +++ b/shell/source/backends/kf5be/kf5be1.component @@ -18,8 +18,9 @@ --> - + xmlns="http://openoffice.org/2010/uno-components"> +