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>
This commit is contained in:
Noel Grandin
2020-07-22 15:53:23 +02:00
committed by Noel Grandin
parent 06d64d7900
commit f3f0d05f72
5 changed files with 18 additions and 99 deletions
-1
View File
@@ -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
+3 -2
View File
@@ -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>
+15 -22
View File
@@ -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: */
@@ -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;
@@ -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: */