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 | |
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>
22 files changed, 62 insertions, 438 deletions
diff --git a/desktop/Library_migrationoo2.mk b/desktop/Library_migrationoo2.mk index 21f5c1db175d..fdc8d8a661f5 100644 --- a/desktop/Library_migrationoo2.mk +++ b/desktop/Library_migrationoo2.mk @@ -28,7 +28,6 @@ $(eval $(call gb_Library_set_componentfile,migrationoo2,desktop/source/migration $(eval $(call gb_Library_add_exception_objects,migrationoo2,\ desktop/source/migration/services/basicmigration \ - desktop/source/migration/services/cexports \ $(if $(ENABLE_JAVA), \ desktop/source/migration/services/jvmfwk) \ desktop/source/migration/services/wordbookmigration \ diff --git a/desktop/Library_migrationoo3.mk b/desktop/Library_migrationoo3.mk index 73c38bb291f7..10e1b9013b4c 100644 --- a/desktop/Library_migrationoo3.mk +++ b/desktop/Library_migrationoo3.mk @@ -22,7 +22,6 @@ $(eval $(call gb_Library_use_libraries,migrationoo3,\ $(eval $(call gb_Library_set_componentfile,migrationoo3,desktop/source/migration/services/migrationoo3)) $(eval $(call gb_Library_add_exception_objects,migrationoo3,\ - desktop/source/migration/services/cexportsoo3 \ desktop/source/migration/services/oo3extensionmigration \ )) diff --git a/desktop/Library_spl.mk b/desktop/Library_spl.mk index 89c8e53b9e8a..c79e57b91b1d 100644 --- a/desktop/Library_spl.mk +++ b/desktop/Library_spl.mk @@ -32,7 +32,6 @@ $(eval $(call gb_Library_use_libraries,spl,\ $(eval $(call gb_Library_set_componentfile,spl,desktop/source/splash/spl)) $(eval $(call gb_Library_add_exception_objects,spl,\ - desktop/source/splash/services_spl \ desktop/source/splash/splash \ desktop/source/splash/unxsplash \ )) 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, diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx index a417d6a5d502..3380cb277103 100644 --- a/desktop/source/offacc/acceptor.cxx +++ b/desktop/source/offacc/acceptor.cxx @@ -183,21 +183,13 @@ void Acceptor::initialize( const Sequence<Any>& aArguments ) } // XServiceInfo -OUString Acceptor::impl_getImplementationName() -{ - return "com.sun.star.office.comp.Acceptor"; -} OUString Acceptor::getImplementationName() { - return Acceptor::impl_getImplementationName(); -} -Sequence<OUString> Acceptor::impl_getSupportedServiceNames() -{ - return { "com.sun.star.office.Acceptor" }; + return "com.sun.star.office.comp.Acceptor"; } Sequence<OUString> Acceptor::getSupportedServiceNames() { - return Acceptor::impl_getSupportedServiceNames(); + return { "com.sun.star.office.Acceptor" }; } sal_Bool Acceptor::supportsService(OUString const & ServiceName) @@ -205,16 +197,6 @@ sal_Bool Acceptor::supportsService(OUString const & ServiceName) return cppu::supportsService(this, ServiceName); } -// Factory -Reference< XInterface > Acceptor::impl_getInstance( const Reference< XMultiServiceFactory >& aFactory ) -{ - try { - return static_cast<cppu::OWeakObject *>( - new Acceptor(comphelper::getComponentContext(aFactory))); - } catch ( const Exception& ) { - return css::uno::Reference<css::uno::XInterface>(); - } -} // InstanceProvider AccInstanceProvider::AccInstanceProvider(const Reference<XComponentContext>& rxContext) @@ -256,41 +238,12 @@ Reference<XInterface> AccInstanceProvider::getInstance (const OUString& aName ) } -// component management stuff... - -extern "C" +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +desktop_Acceptor_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { -using namespace desktop; - -SAL_DLLPUBLIC_EXPORT void * offacc_component_getFactory(char const *pImplementationName, void *pServiceManager, void *) -{ - void* pReturn = nullptr ; - if ( pImplementationName && pServiceManager ) - { - // Define variables which are used in following macros. - Reference< XSingleServiceFactory > xFactory; - Reference< XMultiServiceFactory > xServiceManager( - static_cast< XMultiServiceFactory* >(pServiceManager)); - - if (desktop::Acceptor::impl_getImplementationName().equalsAscii( pImplementationName ) ) - { - xFactory.set( cppu::createSingleFactory( - xServiceManager, desktop::Acceptor::impl_getImplementationName(), - desktop::Acceptor::impl_getInstance, desktop::Acceptor::impl_getSupportedServiceNames()) ); - } - - // Factory is valid - service was found. - if ( xFactory.is() ) - { - xFactory->acquire(); - pReturn = xFactory.get(); - } - } - - // Return with result of this operation. - return pReturn ; + return cppu::acquire(new desktop::Acceptor(context)); } -} // extern "C" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/offacc/acceptor.hxx b/desktop/source/offacc/acceptor.hxx index a7cc9c4e961c..daa4cc95168f 100644 --- a/desktop/source/offacc/acceptor.hxx +++ b/desktop/source/offacc/acceptor.hxx @@ -69,16 +69,12 @@ public: void run(); // XService info - static OUString impl_getImplementationName(); virtual OUString SAL_CALL getImplementationName() override; - static css::uno::Sequence<OUString> impl_getSupportedServiceNames(); virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; virtual sal_Bool SAL_CALL supportsService( const OUString& aName ) override; // XInitialize virtual void SAL_CALL initialize( const css::uno::Sequence<css::uno::Any>& aArguments ) override; - - static css::uno::Reference<css::uno::XInterface> impl_getInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& aFactory ); }; class AccInstanceProvider : public ::cppu::WeakImplHelper<css::bridge::XInstanceProvider> diff --git a/desktop/source/offacc/offacc.component b/desktop/source/offacc/offacc.component index 66ba2d8e0e3b..d46f8fac7cd4 100644 --- a/desktop/source/offacc/offacc.component +++ b/desktop/source/offacc/offacc.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="offacc" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.office.comp.Acceptor"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.office.comp.Acceptor" + constructor="desktop_Acceptor_get_implementation"> <service name="com.sun.star.office.Acceptor"/> </implementation> </component> diff --git a/desktop/source/splash/services_spl.cxx b/desktop/source/splash/services_spl.cxx deleted file mode 100644 index cdb3151f230f..000000000000 --- a/desktop/source/splash/services_spl.cxx +++ /dev/null @@ -1,56 +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 <sal/config.h> - -#include <cppuhelper/factory.hxx> -#include <cppuhelper/implementationentry.hxx> -#include <sal/types.h> - -#include "splash.hxx" -#include "unxsplash.hxx" - -namespace { - -cppu::ImplementationEntry const services[] = { - { - &desktop::splash::create, - &desktop::splash::getImplementationName, - &desktop::splash::getSupportedServiceNames, - &cppu::createSingleComponentFactory, nullptr, 0 - }, - { - UnxSplash_createInstance, - UnxSplash_getImplementationName, - UnxSplash_getSupportedServiceNames, - ::cppu::createSingleComponentFactory, nullptr, 0 - }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } -}; - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * spl_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/desktop/source/splash/spl.component b/desktop/source/splash/spl.component index bc0ff98fc1fb..204dbffa8b89 100644 --- a/desktop/source/splash/spl.component +++ b/desktop/source/splash/spl.component @@ -18,11 +18,13 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="spl" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.office.comp.SplashScreen"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.office.comp.SplashScreen" + constructor="desktop_SplashScreen_get_implementation"> <service name="com.sun.star.office.SplashScreen"/> </implementation> - <implementation name="com.sun.star.office.comp.PipeSplashScreen"> + <implementation name="com.sun.star.office.comp.PipeSplashScreen" + constructor="desktop_UnxSplash_get_implementation"> <service name="com.sun.star.office.PipeSplashScreen"/> </implementation> </component> diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index b42ffe11b347..34c77e9bd827 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -18,7 +18,6 @@ */ -#include "splash.hxx" #include <sal/log.hxx> #include <vcl/bitmapex.hxx> #include <vcl/svapp.hxx> @@ -111,13 +110,13 @@ public: virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any>& aArguments ) override; virtual OUString SAL_CALL getImplementationName() override - { return desktop::splash::getImplementationName(); } + { return "com.sun.star.office.comp.SplashScreen"; } virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override { return cppu::supportsService(this, ServiceName); } virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override - { return desktop::splash::getSupportedServiceNames(); } + { return { "com.sun.star.office.SplashScreen" }; } }; SplashScreenWindow::SplashScreenWindow(SplashScreen *pSplash) @@ -626,19 +625,12 @@ osl::Mutex SplashScreen::_aMutex; } -css::uno::Reference< css::uno::XInterface > desktop::splash::create( - css::uno::Reference< css::uno::XComponentContext > const &) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +desktop_SplashScreen_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - return static_cast< cppu::OWeakObject * >(new SplashScreen); + return cppu::acquire(new SplashScreen()); } -OUString desktop::splash::getImplementationName() { - return "com.sun.star.office.comp.SplashScreen"; -} - -css::uno::Sequence< OUString > desktop::splash::getSupportedServiceNames() -{ - return { "com.sun.star.office.SplashScreen" }; -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/splash/splash.hxx b/desktop/source/splash/splash.hxx deleted file mode 100644 index 0a31258d740e..000000000000 --- a/desktop/source/splash/splash.hxx +++ /dev/null @@ -1,49 +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 . - */ - -#ifndef INCLUDED_DESKTOP_SOURCE_SPLASH_SPLASH_HXX -#define INCLUDED_DESKTOP_SOURCE_SPLASH_SPLASH_HXX - -#include <sal/config.h> - -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/uno/Sequence.hxx> - -namespace com::sun::star { - namespace uno { - class XComponentContext; - class XInterface; - } -} - -namespace desktop::splash { - -css::uno::Reference< css::uno::XInterface > -create( css::uno::Reference< css::uno::XComponentContext > const & ); - -OUString getImplementationName(); - -css::uno::Sequence< OUString > -getSupportedServiceNames(); - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/splash/unxsplash.cxx b/desktop/source/splash/unxsplash.cxx index cf1c66144ea8..efee99e46023 100644 --- a/desktop/source/splash/unxsplash.cxx +++ b/desktop/source/splash/unxsplash.cxx @@ -22,6 +22,7 @@ #include <osl/process.h> #include <cppuhelper/supportsservice.hxx> #include <sal/log.hxx> +#include <rtl/ref.hxx> using namespace com::sun::star; @@ -102,7 +103,7 @@ UnxSplashScreen::initialize( const css::uno::Sequence< css::uno::Any>& ) OUString UnxSplashScreen::getImplementationName() { - return UnxSplash_getImplementationName(); + return "com.sun.star.office.comp.PipeSplashScreen"; } sal_Bool UnxSplashScreen::supportsService(OUString const & ServiceName) @@ -112,37 +113,19 @@ sal_Bool UnxSplashScreen::supportsService(OUString const & ServiceName) css::uno::Sequence<OUString> UnxSplashScreen::getSupportedServiceNames() { - return UnxSplash_getSupportedServiceNames(); -} - + return { "com.sun.star.office.PipeSplashScreen" }; } -using namespace desktop; - -// get service instance... -static uno::Reference< uno::XInterface > m_xINSTANCE; - -uno::Reference< uno::XInterface > UnxSplash_createInstance(const uno::Reference< uno::XComponentContext > & ) -{ - static osl::Mutex s_aMutex; - if ( !m_xINSTANCE.is() ) - { - osl::MutexGuard guard( s_aMutex ); - if ( !m_xINSTANCE.is() ) - m_xINSTANCE = static_cast<cppu::OWeakObject*>(new UnxSplashScreen); - } - - return m_xINSTANCE; } -OUString UnxSplash_getImplementationName() +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +desktop_UnxSplash_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - return "com.sun.star.office.comp.PipeSplashScreen"; -} + static rtl::Reference< desktop::UnxSplashScreen > m_xINSTANCE(new desktop::UnxSplashScreen()); -uno::Sequence< OUString > UnxSplash_getSupportedServiceNames() throw() -{ - return uno::Sequence< OUString > { "com.sun.star.office.PipeSplashScreen" }; + m_xINSTANCE->acquire(); + return static_cast<cppu::OWeakObject*>(m_xINSTANCE.get()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/splash/unxsplash.hxx b/desktop/source/splash/unxsplash.hxx index baa612a0df10..fa7ce196cda4 100644 --- a/desktop/source/splash/unxsplash.hxx +++ b/desktop/source/splash/unxsplash.hxx @@ -58,11 +58,6 @@ public: } -/// @throws css::uno::Exception -css::uno::Reference< css::uno::XInterface > UnxSplash_createInstance(const css::uno::Reference< css::uno::XComponentContext > & xCtx ); -OUString UnxSplash_getImplementationName(); -css::uno::Sequence< OUString > UnxSplash_getSupportedServiceNames() throw (); - #endif // INCLUDED_DESKTOP_SOURCE_SPLASH_UNXSPLASH_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |