From 91a6aeab9da5ef8f98390ce7661ee6acf0841aec Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 14 Jul 2020 18:29:22 +0200 Subject: fpicker/aqua: create instances with uno constructors See tdf#74608 for motivation. Change-Id: I23b9964daba0d39cdad4e81de7b7fbfc56589b2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98787 Tested-by: Jenkins Reviewed-by: Noel Grandin --- fpicker/source/aqua/FPServiceInfo.hxx | 33 ---------- fpicker/source/aqua/FPentry.mm | 94 ----------------------------- fpicker/source/aqua/SalAquaFilePicker.mm | 11 +++- fpicker/source/aqua/SalAquaFolderPicker.hxx | 6 +- fpicker/source/aqua/SalAquaFolderPicker.mm | 25 ++++---- fpicker/source/aqua/SalAquaPicker.mm | 1 - fpicker/source/aqua/fps_aqua.component | 8 ++- 7 files changed, 26 insertions(+), 152 deletions(-) delete mode 100644 fpicker/source/aqua/FPServiceInfo.hxx delete mode 100644 fpicker/source/aqua/FPentry.mm (limited to 'fpicker/source') diff --git a/fpicker/source/aqua/FPServiceInfo.hxx b/fpicker/source/aqua/FPServiceInfo.hxx deleted file mode 100644 index e3fe780563e0..000000000000 --- a/fpicker/source/aqua/FPServiceInfo.hxx +++ /dev/null @@ -1,33 +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_FPICKER_SOURCE_AQUA_FPSERVICEINFO_HXX -#define INCLUDED_FPICKER_SOURCE_AQUA_FPSERVICEINFO_HXX - -// the service names -#define FILE_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.AquaFilePicker" -#define FOLDER_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.AquaFolderPicker" - -// the implementation names -#define FILE_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.SalAquaFilePicker" -#define FOLDER_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.SalAquaFolderPicker" - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/FPentry.mm b/fpicker/source/aqua/FPentry.mm deleted file mode 100644 index 5cec5eab213b..000000000000 --- a/fpicker/source/aqua/FPentry.mm +++ /dev/null @@ -1,94 +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 -#include -#include - -#include "SalAquaFilePicker.hxx" -#include "SalAquaFolderPicker.hxx" - -#include "FPServiceInfo.hxx" - - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; -using namespace ::cppu; - - -static Reference< XInterface > createFileInstance( const Reference< XMultiServiceFactory >& ) -{ - return Reference< XInterface >( *new SalAquaFilePicker ); -} - -static Reference< XInterface > createFolderInstance( - const Reference< XMultiServiceFactory >& rServiceManager ) -{ - return Reference< XInterface >( - *new SalAquaFolderPicker( rServiceManager ) ); -} - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void* fps_aqua_component_getFactory( - const char* pImplName, void* pSrvManager, void* /*pRegistryKey*/ ) -{ - void* pRet = nullptr; - - if( pSrvManager ) - { - Reference< XSingleServiceFactory > xFactory; - - if (0 == rtl_str_compare(pImplName, FILE_PICKER_IMPL_NAME)) - { - Sequence aSNS { FILE_PICKER_SERVICE_NAME }; - - xFactory = createSingleFactory( - static_cast< XMultiServiceFactory* > ( pSrvManager ), - OUString::createFromAscii( pImplName ), - createFileInstance, - aSNS ); - } - else if (0 == rtl_str_compare(pImplName, FOLDER_PICKER_IMPL_NAME)) - { - Sequence aSNS { FOLDER_PICKER_SERVICE_NAME }; - - xFactory = createSingleFactory( - static_cast< XMultiServiceFactory* > ( pSrvManager ), - OUString::createFromAscii( pImplName ), - createFolderInstance, - aSNS ); - } - - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - - return pRet; -} - -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/SalAquaFilePicker.mm b/fpicker/source/aqua/SalAquaFilePicker.mm index ac54fca0cc98..b8db6d94b663 100644 --- a/fpicker/source/aqua/SalAquaFilePicker.mm +++ b/fpicker/source/aqua/SalAquaFilePicker.mm @@ -33,7 +33,6 @@ #include #include #include -#include "FPServiceInfo.hxx" #include #include @@ -477,7 +476,7 @@ void SalAquaFilePicker::disposing( const lang::EventObject& aEvent ) OUString SAL_CALL SalAquaFilePicker::getImplementationName() { - return FILE_PICKER_IMPL_NAME; + return "com.sun.star.ui.dialogs.SalAquaFilePicker"; } sal_Bool SAL_CALL SalAquaFilePicker::supportsService( const OUString& sServiceName ) @@ -582,4 +581,12 @@ void SalAquaFilePicker::filterControlChanged() controlStateChanged( evt ); } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +fpicker_SalAquaFilePicker_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence const&) +{ + return cppu::acquire(new SalAquaFilePicker()); +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/SalAquaFolderPicker.hxx b/fpicker/source/aqua/SalAquaFolderPicker.hxx index a5ea72a29435..becfb3805a18 100644 --- a/fpicker/source/aqua/SalAquaFolderPicker.hxx +++ b/fpicker/source/aqua/SalAquaFolderPicker.hxx @@ -44,7 +44,7 @@ class SalAquaFolderPicker : public: // constructor - SalAquaFolderPicker( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceMgr ); + SalAquaFolderPicker(); // XExecutableDialog functions @@ -91,10 +91,6 @@ public: private: SalAquaFolderPicker( const SalAquaFolderPicker& ) = delete; SalAquaFolderPicker& operator=( const SalAquaFolderPicker& ) = delete; - - // to instantiate own services - css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceMgr; - }; #endif // INCLUDED_FPICKER_SOURCE_AQUA_SALAQUAFOLDERPICKER_HXX diff --git a/fpicker/source/aqua/SalAquaFolderPicker.mm b/fpicker/source/aqua/SalAquaFolderPicker.mm index 3d2259cbcdbf..e86110f22203 100644 --- a/fpicker/source/aqua/SalAquaFolderPicker.mm +++ b/fpicker/source/aqua/SalAquaFolderPicker.mm @@ -26,7 +26,6 @@ #include #include #include -#include "FPServiceInfo.hxx" #include #include #include @@ -48,17 +47,7 @@ using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; -namespace -{ - // controlling event notifications - uno::Sequence FolderPicker_getSupportedServiceNames() - { - return { "com.sun.star.ui.dialogs.SystemFolderPicker", "com.sun.star.ui.dialogs.AquaFolderPicker" }; - } -} - -SalAquaFolderPicker::SalAquaFolderPicker( const uno::Reference& xServiceMgr ) : - m_xServiceMgr( xServiceMgr ) +SalAquaFolderPicker::SalAquaFolderPicker() { m_nDialogType = NAVIGATIONSERVICES_DIRECTORY; } @@ -152,7 +141,7 @@ void SAL_CALL SalAquaFolderPicker::setDescription( const OUString& rDescription OUString SAL_CALL SalAquaFolderPicker::getImplementationName() { - return FOLDER_PICKER_IMPL_NAME; + return "com.sun.star.ui.dialogs.SalAquaFolderPicker"; } sal_Bool SAL_CALL SalAquaFolderPicker::supportsService( const OUString& sServiceName ) @@ -162,7 +151,7 @@ sal_Bool SAL_CALL SalAquaFolderPicker::supportsService( const OUString& sService uno::Sequence SAL_CALL SalAquaFolderPicker::getSupportedServiceNames() { - return FolderPicker_getSupportedServiceNames(); + return { "com.sun.star.ui.dialogs.SystemFolderPicker", "com.sun.star.ui.dialogs.AquaFolderPicker" }; } // XCancellable @@ -180,4 +169,12 @@ void SAL_CALL SalAquaFolderPicker::disposing( const lang::EventObject& ) { } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +fpicker_SalAquaFolderPicker_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence const&) +{ + return cppu::acquire(new SalAquaFolderPicker()); +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/SalAquaPicker.mm b/fpicker/source/aqua/SalAquaPicker.mm index 0b235bb92dff..19b649eed472 100644 --- a/fpicker/source/aqua/SalAquaPicker.mm +++ b/fpicker/source/aqua/SalAquaPicker.mm @@ -24,7 +24,6 @@ #include #include #include -#include "FPServiceInfo.hxx" #include #include #include "SalAquaPicker.hxx" diff --git a/fpicker/source/aqua/fps_aqua.component b/fpicker/source/aqua/fps_aqua.component index 8aa06e2e6bc6..bf143911a23f 100644 --- a/fpicker/source/aqua/fps_aqua.component +++ b/fpicker/source/aqua/fps_aqua.component @@ -18,11 +18,13 @@ --> - + xmlns="http://openoffice.org/2010/uno-components"> + - + -- cgit