[Libreoffice-commits] core.git: ucb/Library_ucpdav1.mk ucb/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 22 13:54:04 UTC 2020


 ucb/Library_ucpdav1.mk                        |    1 
 ucb/source/ucp/webdav-neon/ucpdav1.component  |    5 +
 ucb/source/ucp/webdav-neon/webdavprovider.cxx |   37 +++++---------
 ucb/source/ucp/webdav-neon/webdavprovider.hxx |    7 --
 ucb/source/ucp/webdav-neon/webdavservices.cxx |   67 --------------------------
 5 files changed, 18 insertions(+), 99 deletions(-)

New commits:
commit f3f0d05f72d8dbd9717910b4d6b42c54be3e106f
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Wed Jul 22 14:04:09 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 22 15:53:23 2020 +0200

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

diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index c76489bd4847..b9e1d1037897 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -65,7 +65,6 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
 	ucb/source/ucp/webdav-neon/webdavdatasupplier \
 	ucb/source/ucp/webdav-neon/webdavprovider \
 	ucb/source/ucp/webdav-neon/webdavresultset \
-	ucb/source/ucp/webdav-neon/webdavservices \
 ))
 
 else # WITH_WEBDAV == serf
diff --git a/ucb/source/ucp/webdav-neon/ucpdav1.component b/ucb/source/ucp/webdav-neon/ucpdav1.component
index 5bebe253554e..23be195bf453 100644
--- a/ucb/source/ucp/webdav-neon/ucpdav1.component
+++ b/ucb/source/ucp/webdav-neon/ucpdav1.component
@@ -27,8 +27,9 @@
 **********************************************************************-->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="ucpdav1" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.WebDAVContentProvider">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.WebDAVContentProvider"
+    constructor="ucb_webdav_neon_ContentProvider_get_implementation">
     <service name="com.sun.star.ucb.WebDAVContentProvider"/>
   </implementation>
 </component>
diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.cxx b/ucb/source/ucp/webdav-neon/webdavprovider.cxx
index c022e0f8f531..40534e80a614 100644
--- a/ucb/source/ucp/webdav-neon/webdavprovider.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavprovider.cxx
@@ -96,38 +96,24 @@ XTYPEPROVIDER_IMPL_3( ContentProvider,
 
 // XServiceInfo methods.
 
-XSERVICEINFO_COMMOM_IMPL( ContentProvider,
-                          "com.sun.star.comp.WebDAVContentProvider" )
-/// @throws css::uno::Exception
-static css::uno::Reference< css::uno::XInterface >
-ContentProvider_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
+OUString
+ContentProvider::getImplementationName()
 {
-    css::lang::XServiceInfo* pX = new ContentProvider( ucbhelper::getComponentContext(rSMgr) );
-    return css::uno::Reference< css::uno::XInterface >::query( pX );
+    return "com.sun.star.comp.WebDAVContentProvider";
 }
 
 css::uno::Sequence< OUString >
-ContentProvider::getSupportedServiceNames_Static()
+ContentProvider::getSupportedServiceNames()
 {
-    css::uno::Sequence< OUString > aSNS { WEBDAV_CONTENT_PROVIDER_SERVICE_NAME };
-    return aSNS;
+    return { WEBDAV_CONTENT_PROVIDER_SERVICE_NAME };
 }
 
-// Service factory implementation.
-
-
-css::uno::Reference< css::lang::XSingleServiceFactory >
-ContentProvider::createServiceFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxServiceMgr )
+sal_Bool
+ContentProvider::supportsService(const OUString& s)
 {
-    return cppu::createOneInstanceFactory(
-                rxServiceMgr,
-                ContentProvider::getImplementationName_Static(),
-                ContentProvider_CreateInstance,
-                ContentProvider::getSupportedServiceNames_Static() );
+    return cppu::supportsService(this, s);
 }
 
-
-
 // XContentProvider methods.
 
 
@@ -194,4 +180,11 @@ ContentProvider::queryContent(
     return xContent;
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+ucb_webdav_neon_ContentProvider_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
+{
+    return cppu::acquire(new ContentProvider(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.hxx b/ucb/source/ucp/webdav-neon/webdavprovider.hxx
index 80556ab23447..2e30d3f0a35d 100644
--- a/ucb/source/ucp/webdav-neon/webdavprovider.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavprovider.hxx
@@ -90,13 +90,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/webdav-neon/webdavservices.cxx b/ucb/source/ucp/webdav-neon/webdavservices.cxx
deleted file mode 100644
index b299555359c4..000000000000
--- a/ucb/source/ucp/webdav-neon/webdavservices.cxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include "webdavprovider.hxx"
-
-using namespace com::sun::star;
-
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * ucpdav1_component_getFactory(
-    const char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
-{
-    void * pRet = nullptr;
-
-    uno::Reference< lang::XMultiServiceFactory > xSMgr(
-            static_cast< lang::XMultiServiceFactory * >(
-                pServiceManager ) );
-    uno::Reference< lang::XSingleServiceFactory > xFactory;
-
-
-    // WebDAV Content Provider.
-
-
-    if ( ::webdav_ucp::ContentProvider::getImplementationName_Static().
-                equalsAscii( pImplName ) )
-    {
-        xFactory = ::webdav_ucp::ContentProvider::createServiceFactory( xSMgr );
-    }
-
-
-    if ( xFactory.is() )
-    {
-        xFactory->acquire();
-        pRet = xFactory.get();
-    }
-
-    return pRet;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list