From 47c05f54ca3e74f0fe308ba559aa5929532d095e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 22 Jul 2020 13:47:57 +0200 Subject: ucb/file: create instances with uno constructors See tdf#74608 for motivation. Change-Id: I1650f042a87d7351a126c0701cce8b2e12829461 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99221 Tested-by: Jenkins Reviewed-by: Noel Grandin --- ucb/source/ucp/file/filtask.cxx | 13 -------- ucb/source/ucp/file/filtask.hxx | 4 --- ucb/source/ucp/file/prov.cxx | 59 +++++----------------------------- ucb/source/ucp/file/prov.hxx | 8 ----- ucb/source/ucp/file/ucpfile1.component | 5 +-- 5 files changed, 11 insertions(+), 78 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx index b03f758ab038..658b47e2a9ed 100644 --- a/ucb/source/ucp/file/filtask.cxx +++ b/ucb/source/ucp/file/filtask.cxx @@ -2943,17 +2943,4 @@ TaskManager::getScheme( OUString& Scheme ) Scheme = "file"; } -OUString -TaskManager::getImplementationName_static() -{ - return "com.sun.star.comp.ucb.FileProvider"; -} - - -uno::Sequence< OUString > -TaskManager::getSupportedServiceNames_static() -{ - return { "com.sun.star.ucb.FileContentProvider" }; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/file/filtask.hxx b/ucb/source/ucp/file/filtask.hxx index f0c20a74e2a5..65bf19ae3e5d 100644 --- a/ucb/source/ucp/file/filtask.hxx +++ b/ucb/source/ucp/file/filtask.hxx @@ -642,10 +642,6 @@ namespace fileaccess // Methods for "writeComponentInfo" and "createComponentFactory" static void getScheme( OUString& Scheme ); - - static OUString getImplementationName_static(); - - static css::uno::Sequence< OUString > getSupportedServiceNames_static(); }; } // end namespace TaskHandling diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx index 182713f76704..6cf0ace2daf2 100644 --- a/ucb/source/ucp/file/prov.cxx +++ b/ucb/source/ucp/file/prov.cxx @@ -48,35 +48,6 @@ using namespace com::sun::star::container; #endif -extern "C" SAL_DLLPUBLIC_EXPORT void * ucpfile_component_getFactory( - const char * pImplName, void * pServiceManager, void * ) -{ - void * pRet = nullptr; - - Reference< XMultiServiceFactory > xSMgr( - static_cast< XMultiServiceFactory * >( pServiceManager ) ); - Reference< XSingleServiceFactory > xFactory; - - - // File Content Provider. - - - if ( fileaccess::TaskManager::getImplementationName_static(). - equalsAscii( pImplName ) ) - { - xFactory = FileProvider::createServiceFactory( xSMgr ); - } - - - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - - return pRet; -} - /****************************************************************************/ /* */ /* */ @@ -121,7 +92,7 @@ FileProvider::initialize( OUString SAL_CALL FileProvider::getImplementationName() { - return fileaccess::TaskManager::getImplementationName_static(); + return "com.sun.star.comp.ucb.FileProvider"; } sal_Bool SAL_CALL FileProvider::supportsService(const OUString& ServiceName ) @@ -132,29 +103,9 @@ sal_Bool SAL_CALL FileProvider::supportsService(const OUString& ServiceName ) Sequence< OUString > SAL_CALL FileProvider::getSupportedServiceNames() { - return fileaccess::TaskManager::getSupportedServiceNames_static(); -} - -Reference< XSingleServiceFactory > -FileProvider::createServiceFactory( - const Reference< XMultiServiceFactory >& rxServiceMgr ) -{ - return cppu::createSingleFactory( - rxServiceMgr, - fileaccess::TaskManager::getImplementationName_static(), - FileProvider::CreateInstance, - fileaccess::TaskManager::getSupportedServiceNames_static() ); + return { "com.sun.star.ucb.FileContentProvider" }; } -Reference< XInterface > SAL_CALL -FileProvider::CreateInstance( - const Reference< XMultiServiceFactory >& xMultiServiceFactory ) -{ - XServiceInfo* xP = new FileProvider(comphelper::getComponentContext(xMultiServiceFactory)); - return Reference< XInterface >::query( xP ); -} - - // XContent @@ -493,4 +444,10 @@ OUString SAL_CALL FileProvider::getSystemPathFromFileURL( const OUString& URL ) return aSystemPath; } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +ucb_file_FileProvider_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence const&) +{ + return cppu::acquire(new FileProvider(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/file/prov.hxx b/ucb/source/ucp/file/prov.hxx index 845ab416d8bc..640bf1e9c1d7 100644 --- a/ucb/source/ucp/file/prov.hxx +++ b/ucb/source/ucp/file/prov.hxx @@ -69,14 +69,6 @@ namespace fileaccess { getSupportedServiceNames() override; - static css::uno::Reference< css::lang::XSingleServiceFactory > - createServiceFactory( - const css::uno::Reference< css::lang::XMultiServiceFactory >& rxServiceMgr ); - - static css::uno::Reference< css::uno::XInterface > SAL_CALL - CreateInstance( - const css::uno::Reference< css::lang::XMultiServiceFactory >& xMultiServiceFactory ); - // XInitialization virtual void SAL_CALL initialize( diff --git a/ucb/source/ucp/file/ucpfile1.component b/ucb/source/ucp/file/ucpfile1.component index 53ebf6a0c0de..5a2efaf3308a 100644 --- a/ucb/source/ucp/file/ucpfile1.component +++ b/ucb/source/ucp/file/ucpfile1.component @@ -18,8 +18,9 @@ --> - + xmlns="http://openoffice.org/2010/uno-components"> + -- cgit