diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-08 21:12:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-09 09:25:57 +0200 |
commit | 799e4577dac5d63e249792e2e330f72e9477be0d (patch) | |
tree | f42d6da700b2963ef6ebb796b38d82bfca760a4f /desktop/source/migration | |
parent | 7272a2edf113f29edeb8987ce649f85b776d9d23 (diff) |
desktop: create instances with uno constructors
See tdf#74608 for motivation
Change-Id: Id332d79c29c8e5f668663070d83aba596f017908
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98390
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop/source/migration')
10 files changed, 33 insertions, 223 deletions
diff --git a/desktop/source/migration/services/basicmigration.cxx b/desktop/source/migration/services/basicmigration.cxx index bec200e21a6b..165c73cd3894 100644 --- a/desktop/source/migration/services/basicmigration.cxx +++ b/desktop/source/migration/services/basicmigration.cxx @@ -37,22 +37,6 @@ namespace migration #define sTargetUserBasic "/user/__basic_80" - // component operations - - - OUString BasicMigration_getImplementationName() - { - return "com.sun.star.comp.desktop.migration.Basic"; - } - - - Sequence< OUString > BasicMigration_getSupportedServiceNames() - { - Sequence< OUString > aNames { "com.sun.star.migration.Basic" }; - return aNames; - } - - // BasicMigration @@ -148,7 +132,7 @@ namespace migration OUString BasicMigration::getImplementationName() { - return BasicMigration_getImplementationName(); + return "com.sun.star.comp.desktop.migration.Basic"; } @@ -160,7 +144,7 @@ namespace migration Sequence< OUString > BasicMigration::getSupportedServiceNames() { - return BasicMigration_getSupportedServiceNames(); + return { "com.sun.star.migration.Basic" }; } @@ -203,17 +187,15 @@ namespace migration } - // component operations - - - Reference< XInterface > BasicMigration_create( - Reference< XComponentContext > const & ) - { - return static_cast< lang::XTypeProvider * >( new BasicMigration() ); - } +} // namespace migration +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +desktop_BasicMigration_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new migration::BasicMigration()); +} -} // namespace migration /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/basicmigration.hxx b/desktop/source/migration/services/basicmigration.hxx index 88f668581664..80438223dba4 100644 --- a/desktop/source/migration/services/basicmigration.hxx +++ b/desktop/source/migration/services/basicmigration.hxx @@ -34,16 +34,6 @@ class INetURLObject; namespace migration { - - - OUString BasicMigration_getImplementationName(); - css::uno::Sequence< OUString > BasicMigration_getSupportedServiceNames(); - css::uno::Reference< css::uno::XInterface > BasicMigration_create( - css::uno::Reference< css::uno::XComponentContext > const & xContext ); - - - - typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo, css::lang::XInitialization, diff --git a/desktop/source/migration/services/cexports.cxx b/desktop/source/migration/services/cexports.cxx deleted file mode 100644 index 6f0e50d9a732..000000000000 --- a/desktop/source/migration/services/cexports.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 <cppuhelper/implementationentry.hxx> -#include "basicmigration.hxx" -#include "wordbookmigration.hxx" - - -extern "C" -{ - -::cppu::ImplementationEntry const oo2_entries [] = -{ - { - migration::BasicMigration_create, migration::BasicMigration_getImplementationName, - migration::BasicMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, - nullptr, 0 - }, - { - migration::WordbookMigration_create, migration::WordbookMigration_getImplementationName, - migration::WordbookMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, - nullptr, 0 - }, - // Extension migration was disabled by Oracle / OpenOffice.org -#if 0 - { - migration::ExtensionMigration_create, migration::ExtensionMigration_getImplementationName, - migration::ExtensionMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, - 0, 0 - }, -#endif - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } -}; - - -SAL_DLLPUBLIC_EXPORT void * migrationoo2_component_getFactory( - const char * pImplName, void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, oo2_entries ); -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/cexportsoo3.cxx b/desktop/source/migration/services/cexportsoo3.cxx deleted file mode 100644 index d2a82c1a8e90..000000000000 --- a/desktop/source/migration/services/cexportsoo3.cxx +++ /dev/null @@ -1,47 +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 <cppuhelper/implementationentry.hxx> -#include "oo3extensionmigration.hxx" - -extern "C" -{ - -::cppu::ImplementationEntry const oo3_entries [] = -{ - { - migration::OO3ExtensionMigration_create, migration::OO3ExtensionMigration_getImplementationName, - migration::OO3ExtensionMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, - nullptr, 0 - }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } -}; - - -SAL_DLLPUBLIC_EXPORT void * migrationoo3_component_getFactory( - const char * pImplName, void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, oo3_entries ); -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/migrationoo2.component b/desktop/source/migration/services/migrationoo2.component index cadfb6a342b7..25502356655d 100644 --- a/desktop/source/migration/services/migrationoo2.component +++ b/desktop/source/migration/services/migrationoo2.component @@ -18,11 +18,13 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="migrationoo2" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.desktop.migration.Basic"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.desktop.migration.Basic" + constructor="desktop_BasicMigration_get_implementation"> <service name="com.sun.star.migration.Basic"/> </implementation> - <implementation name="com.sun.star.comp.desktop.migration.Wordbooks"> + <implementation name="com.sun.star.comp.desktop.migration.Wordbooks" + constructor="desktop_WordbookMigration_get_implementation"> <service name="com.sun.star.migration.Wordbooks"/> </implementation> </component> diff --git a/desktop/source/migration/services/migrationoo3.component b/desktop/source/migration/services/migrationoo3.component index 1ff56cd68724..74432e586d16 100644 --- a/desktop/source/migration/services/migrationoo3.component +++ b/desktop/source/migration/services/migrationoo3.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="migrationoo3" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.desktop.migration.OOo3Extensions"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.desktop.migration.OOo3Extensions" + constructor="desktop_OO3ExtensionMigration_get_implementation"> <service name="com.sun.star.migration.Extensions"/> </implementation> </component> diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index aec9fe05105e..f8691360f9ff 100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -45,21 +45,6 @@ using namespace ::com::sun::star::uno; namespace migration { -// component operations - - -OUString OO3ExtensionMigration_getImplementationName() -{ - return "com.sun.star.comp.desktop.migration.OOo3Extensions"; -} - - -Sequence< OUString > OO3ExtensionMigration_getSupportedServiceNames() -{ - return { "com.sun.star.migration.Extensions" }; -} - - // ExtensionMigration @@ -276,7 +261,7 @@ void OO3ExtensionMigration::migrateExtension( const OUString& sSourceDir ) OUString OO3ExtensionMigration::getImplementationName() { - return OO3ExtensionMigration_getImplementationName(); + return "com.sun.star.comp.desktop.migration.OOo3Extensions"; } @@ -288,7 +273,7 @@ sal_Bool OO3ExtensionMigration::supportsService(OUString const & ServiceName) Sequence< OUString > OO3ExtensionMigration::getSupportedServiceNames() { - return OO3ExtensionMigration_getSupportedServiceNames(); + return { "com.sun.star.migration.Extensions" }; } @@ -412,17 +397,15 @@ void TmpRepositoryCommandEnv::pop() } -// component operations +} // namespace migration -Reference< XInterface > OO3ExtensionMigration_create( - Reference< XComponentContext > const & ctx ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +desktop_OO3ExtensionMigration_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { - return static_cast< lang::XTypeProvider * >( new OO3ExtensionMigration( - ctx) ); + return cppu::acquire(new migration::OO3ExtensionMigration(context)); } -} // namespace migration - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx index 089c343aa0d6..bb0600208475 100644 --- a/desktop/source/migration/services/oo3extensionmigration.hxx +++ b/desktop/source/migration/services/oo3extensionmigration.hxx @@ -40,14 +40,6 @@ class INetURLObject; namespace migration { - OUString OO3ExtensionMigration_getImplementationName(); - css::uno::Sequence< OUString > OO3ExtensionMigration_getSupportedServiceNames(); - css::uno::Reference< css::uno::XInterface > OO3ExtensionMigration_create( - css::uno::Reference< css::uno::XComponentContext > const & xContext ); - - - - typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo, css::lang::XInitialization, diff --git a/desktop/source/migration/services/wordbookmigration.cxx b/desktop/source/migration/services/wordbookmigration.cxx index 354643e8ef17..2e963c096ae5 100644 --- a/desktop/source/migration/services/wordbookmigration.cxx +++ b/desktop/source/migration/services/wordbookmigration.cxx @@ -31,24 +31,6 @@ using namespace ::com::sun::star::uno; namespace migration { - // component operations - - - OUString WordbookMigration_getImplementationName() - { - return "com.sun.star.comp.desktop.migration.Wordbooks"; - } - - - Sequence< OUString > WordbookMigration_getSupportedServiceNames() - { - return { "com.sun.star.migration.Wordbooks" }; - } - - - // WordbookMigration - - WordbookMigration::WordbookMigration() { } @@ -181,7 +163,7 @@ static bool IsUserWordbook( const OUString& rFile ) OUString WordbookMigration::getImplementationName() { - return WordbookMigration_getImplementationName(); + return "com.sun.star.comp.desktop.migration.Wordbooks"; } @@ -193,7 +175,7 @@ static bool IsUserWordbook( const OUString& rFile ) Sequence< OUString > WordbookMigration::getSupportedServiceNames() { - return WordbookMigration_getSupportedServiceNames(); + return { "com.sun.star.migration.Wordbooks" }; } @@ -235,18 +217,14 @@ static bool IsUserWordbook( const OUString& rFile ) return Any(); } - - // component operations - - - Reference< XInterface > WordbookMigration_create( - Reference< XComponentContext > const & ) - { - return static_cast< lang::XTypeProvider * >( new WordbookMigration() ); - } - - } // namespace migration +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +desktop_WordbookMigration_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new migration::WordbookMigration()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/migration/services/wordbookmigration.hxx b/desktop/source/migration/services/wordbookmigration.hxx index 6da5526d8a58..b6a7f2d79798 100644 --- a/desktop/source/migration/services/wordbookmigration.hxx +++ b/desktop/source/migration/services/wordbookmigration.hxx @@ -35,15 +35,6 @@ class INetURLObject; namespace migration { - - OUString WordbookMigration_getImplementationName(); - css::uno::Sequence< OUString > WordbookMigration_getSupportedServiceNames(); - css::uno::Reference< css::uno::XInterface > WordbookMigration_create( - css::uno::Reference< css::uno::XComponentContext > const & xContext ); - - - - typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo, css::lang::XInitialization, |