summaryrefslogtreecommitdiff
path: root/shell/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-13 20:10:05 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-14 11:01:50 +0200
commitc70e400b193f752647d31b73f484852bf1c728cb (patch)
treeb0d348071e10be43f6bf0e261eee8971c236cc90 /shell/source
parent0c53a58b2dd9bee3d4de6843966486428fdaa78f (diff)
shell/macbe1: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: Ifdb4adc5073b728cbad4da5b261aa7475e9997e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98680 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'shell/source')
-rw-r--r--shell/source/backends/macbe/macbackend.hxx18
-rw-r--r--shell/source/backends/macbe/macbackend.mm28
-rw-r--r--shell/source/backends/macbe/macbe1.component5
-rw-r--r--shell/source/backends/macbe/macbecdef.cxx62
4 files changed, 13 insertions, 100 deletions
diff --git a/shell/source/backends/macbe/macbackend.hxx b/shell/source/backends/macbe/macbackend.hxx
index b1bd910c21aa..9a19a3002120 100644
--- a/shell/source/backends/macbe/macbackend.hxx
+++ b/shell/source/backends/macbe/macbackend.hxx
@@ -36,8 +36,6 @@ class MacOSXBackend : public ::cppu::WeakImplHelper <css::beans::XPropertySet, l
public:
- static MacOSXBackend* createInstance();
-
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() override;
@@ -45,20 +43,6 @@ public:
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
@@ -90,8 +74,6 @@ public:
css::uno::Reference< css::beans::XVetoableChangeListener > const &) override
{}
-protected:
-
/**
Service constructor from a service factory.
diff --git a/shell/source/backends/macbe/macbackend.mm b/shell/source/backends/macbe/macbackend.mm
index 54bd4726c6e3..04ab5569e606 100644
--- a/shell/source/backends/macbe/macbackend.mm
+++ b/shell/source/backends/macbe/macbackend.mm
@@ -29,6 +29,7 @@
#include "macbackend.hxx"
#include <com/sun/star/beans/Optional.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
@@ -150,11 +151,6 @@ MacOSXBackend::~MacOSXBackend(void)
{
}
-MacOSXBackend* MacOSXBackend::createInstance()
-{
- return new MacOSXBackend;
-}
-
static OUString CFStringToOUString(const CFStringRef sOrig) {
CFRetain(sOrig);
@@ -373,31 +369,27 @@ css::uno::Any MacOSXBackend::getPropertyValue(
}
}
-OUString MacOSXBackend::getBackendName(void)
+OUString SAL_CALL MacOSXBackend::getImplementationName(void)
{
return "com.sun.star.comp.configuration.backend.MacOSXBackend";
}
-OUString SAL_CALL MacOSXBackend::getImplementationName(void)
+sal_Bool SAL_CALL MacOSXBackend::supportsService(const OUString& aServiceName)
{
- return getBackendName();
+ return cppu::supportsService(this, aServiceName);
}
-uno::Sequence<OUString> MacOSXBackend::getBackendServiceNames(void)
+uno::Sequence<OUString> SAL_CALL MacOSXBackend::getSupportedServiceNames(void)
{
- uno::Sequence<OUString> aServiceNameList { "com.sun.star.configuration.backend.MacOSXBackend" };
-
- return aServiceNameList;
+ return { "com.sun.star.configuration.backend.MacOSXBackend" };
}
-sal_Bool SAL_CALL MacOSXBackend::supportsService(const OUString& aServiceName)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+shell_MacOSXBackend_get_implementation(
+ css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{
- return cppu::supportsService(this, aServiceName);
+ return cppu::acquire(new MacOSXBackend());
}
-uno::Sequence<OUString> SAL_CALL MacOSXBackend::getSupportedServiceNames(void)
-{
- return getBackendServiceNames();
-}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/source/backends/macbe/macbe1.component b/shell/source/backends/macbe/macbe1.component
index 0db6d669557b..8b42dc2e446c 100644
--- a/shell/source/backends/macbe/macbe1.component
+++ b/shell/source/backends/macbe/macbe1.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="macbe1" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.configuration.backend.MacOSXBackend">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.configuration.backend.MacOSXBackend"
+ constructor="shell_MacOSXBackend_get_implementation">
<service name="com.sun.star.configuration.backend.MacOSXBackend"/>
</implementation>
</component>
diff --git a/shell/source/backends/macbe/macbecdef.cxx b/shell/source/backends/macbe/macbecdef.cxx
deleted file mode 100644
index 3e4803c48f2a..000000000000
--- a/shell/source/backends/macbe/macbecdef.cxx
+++ /dev/null
@@ -1,62 +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 "macbackend.hxx"
-#include <com/sun/star/registry/XRegistryKey.hpp>
-
-#include <cppuhelper/implementationentry.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-namespace uno = com::sun::star::uno;
-
-
-static uno::Reference<uno::XInterface> createMacOSXBackend(
- const uno::Reference<uno::XComponentContext>&)
-{
- return * MacOSXBackend::createInstance();
-}
-
-
-static const cppu::ImplementationEntry kImplementations_entries[] =
-{
- {
- createMacOSXBackend,
- MacOSXBackend::getBackendName,
- MacOSXBackend::getBackendServiceNames,
- cppu::createSingleComponentFactory,
- nullptr,
- 0
- },
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-};
-
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * macbe1_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: */