diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-14 20:22:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-15 08:45:36 +0200 |
commit | 666e1ae80681f611aeb5aa83d43f595f7353a056 (patch) | |
tree | b21d9e705cc0294b0eb115271121b5552f77f636 /fpicker | |
parent | 3e50a3023535d4e9e365db046442df1a758e70c4 (diff) |
fpicker/office: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: Ia6e1aec18e6450de9c65ed059a25493fc54a9f75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98788
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/Library_fps_office.mk | 1 | ||||
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.cxx | 48 | ||||
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.hxx | 19 | ||||
-rw-r--r-- | fpicker/source/office/OfficeFolderPicker.cxx | 24 | ||||
-rw-r--r-- | fpicker/source/office/OfficeFolderPicker.hxx | 9 | ||||
-rw-r--r-- | fpicker/source/office/fps_office.component | 11 | ||||
-rw-r--r-- | fpicker/source/office/fps_office.cxx | 62 |
7 files changed, 25 insertions, 149 deletions
diff --git a/fpicker/Library_fps_office.mk b/fpicker/Library_fps_office.mk index 3aec0b66906e..147dceb34da2 100644 --- a/fpicker/Library_fps_office.mk +++ b/fpicker/Library_fps_office.mk @@ -51,7 +51,6 @@ $(eval $(call gb_Library_add_exception_objects,fps_office,\ fpicker/source/office/foldertree \ fpicker/source/office/fpinteraction \ fpicker/source/office/fpsmartcontent \ - fpicker/source/office/fps_office \ fpicker/source/office/iodlg \ fpicker/source/office/iodlgimp \ fpicker/source/office/OfficeControlAccess \ diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index f9e4d74d2839..dd8e0d58203d 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -1027,7 +1027,7 @@ bool SvtFilePicker::implHandleInitializationArgument( const OUString& _rName, co /* XServiceInfo */ OUString SAL_CALL SvtFilePicker::getImplementationName() { - return impl_getStaticImplementationName(); + return "com.sun.star.svtools.OfficeFilePicker"; } /* XServiceInfo */ @@ -1039,28 +1039,16 @@ sal_Bool SAL_CALL SvtFilePicker::supportsService( const OUString& sServiceName ) /* XServiceInfo */ Sequence< OUString > SAL_CALL SvtFilePicker::getSupportedServiceNames() { - return impl_getStaticSupportedServiceNames(); + return { "com.sun.star.ui.dialogs.OfficeFilePicker" }; } -/* Helper for XServiceInfo */ -Sequence< OUString > SvtFilePicker::impl_getStaticSupportedServiceNames() +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +fpicker_SvtFilePicker_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - Sequence<OUString> seqServiceNames { "com.sun.star.ui.dialogs.OfficeFilePicker" }; - return seqServiceNames ; + return cppu::acquire(new SvtFilePicker()); } -/* Helper for XServiceInfo */ -OUString SvtFilePicker::impl_getStaticImplementationName() -{ - return "com.sun.star.svtools.OfficeFilePicker"; -} - -/* Helper for registry */ -Reference< XInterface > SvtFilePicker::impl_createInstance( - const Reference< XComponentContext >& ) -{ - return Reference< XInterface >( *new SvtFilePicker ); -} // SvtRemoteFilePicker @@ -1091,7 +1079,7 @@ std::shared_ptr<SvtFileDialog_Base> SvtRemoteFilePicker::implCreateDialog(weld:: /* XServiceInfo */ OUString SAL_CALL SvtRemoteFilePicker::getImplementationName() { - return impl_getStaticImplementationName(); + return "com.sun.star.svtools.RemoteFilePicker"; } /* XServiceInfo */ @@ -1103,27 +1091,15 @@ sal_Bool SAL_CALL SvtRemoteFilePicker::supportsService( const OUString& sService /* XServiceInfo */ Sequence< OUString > SAL_CALL SvtRemoteFilePicker::getSupportedServiceNames() { - return impl_getStaticSupportedServiceNames(); -} - -/* Helper for XServiceInfo */ -Sequence< OUString > SvtRemoteFilePicker::impl_getStaticSupportedServiceNames() -{ - Sequence<OUString> seqServiceNames { "com.sun.star.ui.dialogs.RemoteFilePicker" }; - return seqServiceNames ; + return { "com.sun.star.ui.dialogs.RemoteFilePicker" }; } -/* Helper for XServiceInfo */ -OUString SvtRemoteFilePicker::impl_getStaticImplementationName() -{ - return "com.sun.star.svtools.RemoteFilePicker"; -} -/* Helper for registry */ -Reference< XInterface > SvtRemoteFilePicker::impl_createInstance( - const Reference< XComponentContext >& ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +fpicker_SvtRemoteFilePicker_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - return Reference< XInterface >( *new SvtRemoteFilePicker ); + return cppu::acquire(new SvtRemoteFilePicker()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx index 3863bf1d5168..59f1073092fd 100644 --- a/fpicker/source/office/OfficeFilePicker.hxx +++ b/fpicker/source/office/OfficeFilePicker.hxx @@ -189,16 +189,6 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - /* Helper for XServiceInfo */ - static css::uno::Sequence< OUString > - impl_getStaticSupportedServiceNames(); - static OUString impl_getStaticImplementationName(); - - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > impl_createInstance ( - const css::uno::Reference< css::uno::XComponentContext >& rxContext ); - protected: // OCommonPicker overridables @@ -246,15 +236,6 @@ public: virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - - /* Helper for XServiceInfo */ - static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames(); - static OUString impl_getStaticImplementationName(); - - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > impl_createInstance ( - const css::uno::Reference< css::uno::XComponentContext >& rxContext ); }; #endif // INCLUDED_FPICKER_SOURCE_OFFICE_OFFICEFILEPICKER_HXX diff --git a/fpicker/source/office/OfficeFolderPicker.cxx b/fpicker/source/office/OfficeFolderPicker.cxx index 8413020df96f..c941d6cb63c3 100644 --- a/fpicker/source/office/OfficeFolderPicker.cxx +++ b/fpicker/source/office/OfficeFolderPicker.cxx @@ -150,7 +150,7 @@ void SvtFolderPicker::cancel() /* XServiceInfo */ OUString SAL_CALL SvtFolderPicker::getImplementationName() { - return impl_getStaticImplementationName(); + return "com.sun.star.svtools.OfficeFolderPicker"; } /* XServiceInfo */ @@ -162,26 +162,14 @@ sal_Bool SAL_CALL SvtFolderPicker::supportsService( const OUString& sServiceName /* XServiceInfo */ Sequence< OUString > SAL_CALL SvtFolderPicker::getSupportedServiceNames() { - return impl_getStaticSupportedServiceNames(); -} - -/* Helper for XServiceInfo */ -Sequence< OUString > SvtFolderPicker::impl_getStaticSupportedServiceNames() -{ - Sequence< OUString > seqServiceNames { "com.sun.star.ui.dialogs.OfficeFolderPicker" }; - return seqServiceNames ; -} - -/* Helper for XServiceInfo */ -OUString SvtFolderPicker::impl_getStaticImplementationName() -{ - return "com.sun.star.svtools.OfficeFolderPicker"; + return { "com.sun.star.ui.dialogs.OfficeFolderPicker" }; } -/* Helper for registry */ -Reference< XInterface > SvtFolderPicker::impl_createInstance( const Reference< XComponentContext >& ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +fpicker_SvtFolderPicker_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - return Reference< XInterface >( *new SvtFolderPicker ); + return cppu::acquire(new SvtFolderPicker()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFolderPicker.hxx b/fpicker/source/office/OfficeFolderPicker.hxx index acf9bd149b5e..db55849881b2 100644 --- a/fpicker/source/office/OfficeFolderPicker.hxx +++ b/fpicker/source/office/OfficeFolderPicker.hxx @@ -80,15 +80,6 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - /* Helper for XServiceInfo */ - static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames(); - static OUString impl_getStaticImplementationName(); - - /* Helper for registry */ - /// @throws css::uno::Exception - static css::uno::Reference< css::uno::XInterface > impl_createInstance ( - const css::uno::Reference< css::uno::XComponentContext >& rxContext ); - protected: // OCommonPicker overridables diff --git a/fpicker/source/office/fps_office.component b/fpicker/source/office/fps_office.component index b76edc61b401..cdf5f82479e3 100644 --- a/fpicker/source/office/fps_office.component +++ b/fpicker/source/office/fps_office.component @@ -18,14 +18,17 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="fps_office" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.svtools.OfficeFilePicker"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.svtools.OfficeFilePicker" + constructor="fpicker_SvtFilePicker_get_implementation"> <service name="com.sun.star.ui.dialogs.OfficeFilePicker"/> </implementation> - <implementation name="com.sun.star.svtools.RemoteFilePicker"> + <implementation name="com.sun.star.svtools.RemoteFilePicker" + constructor="fpicker_SvtRemoteFilePicker_get_implementation"> <service name="com.sun.star.ui.dialogs.RemoteFilePicker"/> </implementation> - <implementation name="com.sun.star.svtools.OfficeFolderPicker"> + <implementation name="com.sun.star.svtools.OfficeFolderPicker" + constructor="fpicker_SvtFolderPicker_get_implementation"> <service name="com.sun.star.ui.dialogs.OfficeFolderPicker"/> </implementation> </component> diff --git a/fpicker/source/office/fps_office.cxx b/fpicker/source/office/fps_office.cxx deleted file mode 100644 index 335bf41e8028..000000000000 --- a/fpicker/source/office/fps_office.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 <sal/types.h> - -#include <cppuhelper/implementationentry.hxx> - -#include "OfficeFilePicker.hxx" -#include "OfficeFolderPicker.hxx" - -const cppu::ImplementationEntry g_entries[] = -{ - { - SvtRemoteFilePicker::impl_createInstance, - SvtRemoteFilePicker::impl_getStaticImplementationName, - SvtRemoteFilePicker::impl_getStaticSupportedServiceNames, - cppu::createSingleComponentFactory, nullptr, 0 - }, - { - SvtFilePicker::impl_createInstance, - SvtFilePicker::impl_getStaticImplementationName, - SvtFilePicker::impl_getStaticSupportedServiceNames, - cppu::createSingleComponentFactory, nullptr, 0 - }, - { - SvtFolderPicker::impl_createInstance, - SvtFolderPicker::impl_getStaticImplementationName, - SvtFolderPicker::impl_getStaticSupportedServiceNames, - cppu::createSingleComponentFactory, nullptr, 0 - }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } -}; - -extern "C" -{ -SAL_DLLPUBLIC_EXPORT void * fps_office_component_getFactory( - const char * pImplementationName, void * pServiceManager, void * pRegistryKey) -{ - return cppu::component_getFactoryHelper ( - pImplementationName, pServiceManager, pRegistryKey, g_entries); -} - -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |