[Libreoffice-commits] core.git: 2 commits - solenv/bin ucb/Library_srtrs1.mk ucb/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 22 06:30:01 UTC 2020


 solenv/bin/native-code.py              |    3 +
 ucb/Library_srtrs1.mk                  |    1 
 ucb/source/sorter/sortdynres.cxx       |   38 ++++------------------
 ucb/source/sorter/sortdynres.hxx       |   11 ------
 ucb/source/sorter/sortmain.cxx         |   57 ---------------------------------
 ucb/source/sorter/srtrs1.component     |    5 +-
 ucb/source/ucp/cmis/cmis_provider.cxx  |   51 ++++++-----------------------
 ucb/source/ucp/cmis/cmis_provider.hxx  |    7 ----
 ucb/source/ucp/cmis/ucpcmis1.component |    5 +-
 9 files changed, 29 insertions(+), 149 deletions(-)

New commits:
commit 188540e37d33debcf1b89eb08e84547c56e19ba2
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue Jul 21 21:11:20 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 22 08:29:20 2020 +0200

    ucb/sorter: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: I6d9b20e281238038f9eed1578a64316857cf6247
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99176
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 4aa156eb4bf4..ef80e4886ed3 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -24,7 +24,6 @@ core_factory_list = [
     ("libfilterconfiglo.a", "filterconfig1_component_getFactory"),
     ("libi18npoollo.a", "i18npool_component_getFactory"),
     ("libsmlo.a", "sm_component_getFactory"),
-    ("libsrtrs1.a", "srtrs1_component_getFactory"),
     ("libucb1.a", "ucb_component_getFactory"),
     ("libucpexpand1lo.a", "ucpexpand1_component_getFactory", "#ifdef ANDROID"),
     ("libucpfile1.a", "ucpfile_component_getFactory"),
@@ -332,6 +331,8 @@ core_constructor_list = [
     "stardiv_Toolkit_VCLXPointer_get_implementation",
     "stardiv_Toolkit_VCLXPopupMenu_get_implementation",
     "stardiv_Toolkit_VCLXToolkit_get_implementation",
+# ucb/source/sorter/srtrs1.component
+    "ucb_SortedDynamicResultSetFactory_get_implementation",
 # ucb/source/tdoc/ucptdoc1.component
     "ucb_tdoc_ContentProvider_get_implementation",
     "ucb_tdoc_DocumentContentFactory_get_implementation",
diff --git a/ucb/Library_srtrs1.mk b/ucb/Library_srtrs1.mk
index 9aefed2c8aa4..6ceffd3cc685 100644
--- a/ucb/Library_srtrs1.mk
+++ b/ucb/Library_srtrs1.mk
@@ -26,7 +26,6 @@ $(eval $(call gb_Library_use_libraries,srtrs1,\
 
 $(eval $(call gb_Library_add_exception_objects,srtrs1,\
 	ucb/source/sorter/sortdynres \
-	ucb/source/sorter/sortmain \
 	ucb/source/sorter/sortresult \
 ))
 
diff --git a/ucb/source/sorter/sortdynres.cxx b/ucb/source/sorter/sortdynres.cxx
index 52229f62d7a3..cd5d5f7282b4 100644
--- a/ucb/source/sorter/sortdynres.cxx
+++ b/ucb/source/sorter/sortdynres.cxx
@@ -94,7 +94,7 @@ sal_Bool SAL_CALL SortedDynamicResultSet::supportsService( const OUString& Servi
 
 css::uno::Sequence< OUString > SAL_CALL SortedDynamicResultSet::getSupportedServiceNames()
 {
-    return { DYNAMIC_RESULTSET_SERVICE_NAME };
+    return { "com.sun.star.ucb.SortedDynamicResultSet" };
 }
 
 // XComponent methods.
@@ -418,11 +418,6 @@ SortedDynamicResultSetFactory::~SortedDynamicResultSetFactory()
 // XServiceInfo methods.
 
 OUString SAL_CALL SortedDynamicResultSetFactory::getImplementationName()
-{
-    return getImplementationName_Static();
-}
-
-OUString SortedDynamicResultSetFactory::getImplementationName_Static()
 {
     return "com.sun.star.comp.ucb.SortedDynamicResultSetFactory";
 }
@@ -434,34 +429,17 @@ sal_Bool SAL_CALL SortedDynamicResultSetFactory::supportsService( const OUString
 
 css::uno::Sequence< OUString > SAL_CALL SortedDynamicResultSetFactory::getSupportedServiceNames()
 {
-    return getSupportedServiceNames_Static();
-}
-
-/// @throws css::uno::Exception
-static css::uno::Reference< css::uno::XInterface >
-SortedDynamicResultSetFactory_CreateInstance( const css::uno::Reference<
-                                              css::lang::XMultiServiceFactory> & rSMgr )
-{
-    return static_cast<css::lang::XServiceInfo*>(
-        new SortedDynamicResultSetFactory(ucbhelper::getComponentContext(rSMgr)));
-}
-
-css::uno::Sequence< OUString > SortedDynamicResultSetFactory::getSupportedServiceNames_Static()
-{
-    css::uno::Sequence<OUString> aSNS { DYNAMIC_RESULTSET_FACTORY_NAME };
-    return aSNS;
+    return { "com.sun.star.ucb.SortedDynamicResultSetFactory" };
 }
 
 
-// Service factory implementation.
-css::uno::Reference< css::lang::XSingleServiceFactory >
-SortedDynamicResultSetFactory::createServiceFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxServiceMgr )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+ucb_SortedDynamicResultSetFactory_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
 {
-    return cppu::createOneInstanceFactory(
-                    rxServiceMgr,
-                    SortedDynamicResultSetFactory::getImplementationName_Static(),
-                    SortedDynamicResultSetFactory_CreateInstance,
-                    SortedDynamicResultSetFactory::getSupportedServiceNames_Static() );
+    static rtl::Reference<SortedDynamicResultSetFactory> g_Instance(new SortedDynamicResultSetFactory(context));
+    g_Instance->acquire();
+    return static_cast<cppu::OWeakObject*>(g_Instance.get());
 }
 
 // SortedDynamicResultSetFactory methods.
diff --git a/ucb/source/sorter/sortdynres.hxx b/ucb/source/sorter/sortdynres.hxx
index 5a1e3770b6b3..00e7720c0cc2 100644
--- a/ucb/source/sorter/sortdynres.hxx
+++ b/ucb/source/sorter/sortdynres.hxx
@@ -35,8 +35,6 @@ namespace comphelper {
     class OInterfaceContainerHelper2;
 }
 
-#define DYNAMIC_RESULTSET_SERVICE_NAME  "com.sun.star.ucb.SortedDynamicResultSet"
-#define DYNAMIC_RESULTSET_FACTORY_NAME  "com.sun.star.ucb.SortedDynamicResultSetFactory"
 
 class SortedDynamicResultSetListener;
 
@@ -155,18 +153,11 @@ public:
 
 
     // XServiceInfo
-
-    static css::uno::Reference< css::lang::XSingleServiceFactory > createServiceFactory(
-            const css::uno::Reference< css::lang::XMultiServiceFactory >& rxServiceMgr );
-
-    // XSortedDynamicResultSetFactory
-
     virtual OUString SAL_CALL getImplementationName() override;
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
-    static OUString getImplementationName_Static();
-    static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
 
+    // XSortedDynamicResultSetFactory
     virtual css::uno::Reference< css::ucb::XDynamicResultSet > SAL_CALL
     createSortedDynamicResultSet(
                 const css::uno::Reference< css::ucb::XDynamicResultSet > & Source,
diff --git a/ucb/source/sorter/sortmain.cxx b/ucb/source/sorter/sortmain.cxx
deleted file mode 100644
index 9d3706917e78..000000000000
--- a/ucb/source/sorter/sortmain.cxx
+++ /dev/null
@@ -1,57 +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 "sortdynres.hxx"
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * srtrs1_component_getFactory(
-    const char * pImplName, void * pServiceManager, void * )
-{
-    void * pRet = nullptr;
-
-    Reference< XMultiServiceFactory > xSMgr(
-            static_cast< XMultiServiceFactory * >( pServiceManager ) );
-    Reference< XSingleServiceFactory > xFactory;
-
-
-    // SortedDynamicResultSetFactory.
-
-
-    if ( SortedDynamicResultSetFactory::getImplementationName_Static().
-                equalsAscii( pImplName ) )
-    {
-        xFactory = SortedDynamicResultSetFactory::createServiceFactory( xSMgr );
-    }
-
-
-    if ( xFactory.is() )
-    {
-        xFactory->acquire();
-        pRet = xFactory.get();
-    }
-
-    return pRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/sorter/srtrs1.component b/ucb/source/sorter/srtrs1.component
index 836be559940c..d3d26136002f 100644
--- a/ucb/source/sorter/srtrs1.component
+++ b/ucb/source/sorter/srtrs1.component
@@ -18,8 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="srtrs1" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.ucb.SortedDynamicResultSetFactory">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.ucb.SortedDynamicResultSetFactory"
+    constructor="ucb_SortedDynamicResultSetFactory_get_implementation">
     <service name="com.sun.star.ucb.SortedDynamicResultSetFactory"/>
   </implementation>
 </component>
commit 925b91dacd1c14c91a8246123f285613292ec142
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Tue Jul 21 21:16:28 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 22 08:29:14 2020 +0200

    ucb/cmis: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: I5bf06ba3d9bac04d18e6b9338a20030cb4a42c89
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99177
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/ucb/source/ucp/cmis/cmis_provider.cxx b/ucb/source/ucp/cmis/cmis_provider.cxx
index d2773794eacf..6f8a6be3c0e8 100644
--- a/ucb/source/ucp/cmis/cmis_provider.cxx
+++ b/ucb/source/ucp/cmis/cmis_provider.cxx
@@ -118,55 +118,28 @@ XTYPEPROVIDER_IMPL_3( ContentProvider,
                       lang::XServiceInfo,
                       css::ucb::XContentProvider );
 
-XSERVICEINFO_COMMOM_IMPL( ContentProvider,
-                          "com.sun.star.comp.CmisContentProvider" )
-/// @throws css::uno::Exception
-static css::uno::Reference< css::uno::XInterface >
-ContentProvider_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
+sal_Bool ContentProvider::supportsService(const OUString& sServiceName)
 {
-    css::lang::XServiceInfo* pX = new ContentProvider( ucbhelper::getComponentContext(rSMgr) );
-    return css::uno::Reference< css::uno::XInterface >::query( pX );
+    return cppu::supportsService(this, sServiceName);
 }
-
-css::uno::Sequence< OUString >
-ContentProvider::getSupportedServiceNames_Static()
+OUString ContentProvider::getImplementationName()
 {
-    css::uno::Sequence< OUString > aSNS { "com.sun.star.ucb.CmisContentProvider" };
-    return aSNS;
+    return "com.sun.star.comp.CmisContentProvider";
 }
-
-css::uno::Reference< css::lang::XSingleServiceFactory >
-ContentProvider::createServiceFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxServiceMgr )
+css::uno::Sequence< OUString > ContentProvider::getSupportedServiceNames()
 {
-    return cppu::createOneInstanceFactory(
-                rxServiceMgr,
-                ContentProvider::getImplementationName_Static(),
-                ContentProvider_CreateInstance,
-                ContentProvider::getSupportedServiceNames_Static() );
+    return { "com.sun.star.ucb.CmisContentProvider" };
 }
 
-
 }
 
-extern "C" SAL_DLLPUBLIC_EXPORT void * ucpcmis1_component_getFactory( const char *pImplName,
-    void *pServiceManager, void * )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+ucb_cmis_ContentProvider_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
 {
-    void * pRet = nullptr;
-
-    uno::Reference< lang::XMultiServiceFactory > xSMgr
-        (static_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
-    uno::Reference< lang::XSingleServiceFactory > xFactory;
-
-    if ( ::cmis::ContentProvider::getImplementationName_Static().equalsAscii( pImplName ) )
-        xFactory = ::cmis::ContentProvider::createServiceFactory( xSMgr );
-
-    if ( xFactory.is() )
-    {
-        xFactory->acquire();
-        pRet = xFactory.get();
-    }
-
-    return pRet;
+    static rtl::Reference<cmis::ContentProvider> g_Instance(new cmis::ContentProvider(context));
+    g_Instance->acquire();
+    return static_cast<cppu::OWeakObject*>(g_Instance.get());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/cmis/cmis_provider.hxx b/ucb/source/ucp/cmis/cmis_provider.hxx
index 081c7f411a1f..0cc3233fb4a7 100644
--- a/ucb/source/ucp/cmis/cmis_provider.hxx
+++ b/ucb/source/ucp/cmis/cmis_provider.hxx
@@ -44,13 +44,6 @@ public:
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
 
-    static OUString getImplementationName_Static();
-    static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
-
-    static css::uno::Reference< css::lang::XSingleServiceFactory >
-    createServiceFactory( const css::uno::Reference<
-                          css::lang::XMultiServiceFactory >& rxServiceMgr );
-
     // XContentProvider
     virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
     queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
diff --git a/ucb/source/ucp/cmis/ucpcmis1.component b/ucb/source/ucp/cmis/ucpcmis1.component
index 5a32d91193a9..a1339fc20f16 100644
--- a/ucb/source/ucp/cmis/ucpcmis1.component
+++ b/ucb/source/ucp/cmis/ucpcmis1.component
@@ -8,8 +8,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="ucpcmis1" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.CmisContentProvider">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.CmisContentProvider"
+    constructor="ucb_cmis_ContentProvider_get_implementation">
     <service name="com.sun.star.ucb.CmisContentProvider"/>
   </implementation>
 </component>


More information about the Libreoffice-commits mailing list