diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-22 14:04:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-22 15:53:23 +0200 |
commit | f3f0d05f72d8dbd9717910b4d6b42c54be3e106f (patch) | |
tree | e1110f421b310e10fb25ac32618c6e6e9f966875 /ucb/source | |
parent | 06d64d7900aeb5be315b340ec855b978dbc66410 (diff) |
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@collabora.co.uk>
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/ucp/webdav-neon/ucpdav1.component | 5 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavprovider.cxx | 37 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavprovider.hxx | 7 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavservices.cxx | 67 |
4 files changed, 18 insertions, 98 deletions
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: */ |