[Libreoffice-commits] core.git: fpicker/Library_fps_aqua.mk fpicker/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 15 06:46:56 UTC 2020


 fpicker/Library_fps_aqua.mk                 |    1 
 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 +-
 8 files changed, 26 insertions(+), 153 deletions(-)

New commits:
commit 91a6aeab9da5ef8f98390ce7661ee6acf0841aec
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue Jul 14 18:29:22 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 15 08:45:58 2020 +0200

    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 <noel.grandin at collabora.co.uk>

diff --git a/fpicker/Library_fps_aqua.mk b/fpicker/Library_fps_aqua.mk
index 5a2c6e13cfc8..1c382e9638f5 100644
--- a/fpicker/Library_fps_aqua.mk
+++ b/fpicker/Library_fps_aqua.mk
@@ -40,7 +40,6 @@ $(eval $(call gb_Library_add_objcxxobjects,fps_aqua,\
 	fpicker/source/aqua/CFStringUtilities \
 	fpicker/source/aqua/ControlHelper \
 	fpicker/source/aqua/FilterHelper \
-	fpicker/source/aqua/FPentry \
 	fpicker/source/aqua/NSString_OOoAdditions \
 	fpicker/source/aqua/NSURL_OOoAdditions \
 	fpicker/source/aqua/resourceprovider \
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 <cppuhelper/factory.hxx>
-#include <com/sun/star/container/XSet.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-#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<OUString> 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<OUString> 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 <com/sun/star/ui/dialogs/TemplateDescription.hpp>
 #include <com/sun/star/ui/dialogs/ControlActions.hpp>
 #include <com/sun/star/uno/Any.hxx>
-#include "FPServiceInfo.hxx"
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 
@@ -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<css::uno::Any> 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 <cppuhelper/supportsservice.hxx>
 #include <osl/diagnose.h>
 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include "FPServiceInfo.hxx"
 #include <osl/mutex.hxx>
 #include <sal/log.hxx>
 #include <vcl/svapp.hxx>
@@ -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<OUString> FolderPicker_getSupportedServiceNames()
-    {
-        return { "com.sun.star.ui.dialogs.SystemFolderPicker", "com.sun.star.ui.dialogs.AquaFolderPicker" };
-    }
-}
-
-SalAquaFolderPicker::SalAquaFolderPicker( const uno::Reference<lang::XMultiServiceFactory>& 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<OUString> 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<css::uno::Any> 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 <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <cppuhelper/interfacecontainer.h>
 #include <osl/diagnose.h>
-#include "FPServiceInfo.hxx"
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 #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 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="fps_aqua" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.ui.dialogs.SalAquaFilePicker">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.ui.dialogs.SalAquaFilePicker"
+    constructor="fpicker_SalAquaFilePicker_get_implementation">
     <service name="com.sun.star.ui.dialogs.AquaFilePicker"/>
   </implementation>
-  <implementation name="com.sun.star.ui.dialogs.SalAquaFolderPicker">
+  <implementation name="com.sun.star.ui.dialogs.SalAquaFolderPicker"
+    constructor="fpicker_SalAquaFolderPicker_get_implementation">
     <service name="com.sun.star.ui.dialogs.AquaFolderPicker"/>
   </implementation>
 </component>


More information about the Libreoffice-commits mailing list