summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-21 21:16:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-22 08:29:14 +0200
commit925b91dacd1c14c91a8246123f285613292ec142 (patch)
tree7449f3f879e6c0ee1601434ceb3d48a74678812f /ucb
parent0936710f750a24e732072484dd8576883fa9bedf (diff)
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@collabora.co.uk>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/cmis/cmis_provider.cxx51
-rw-r--r--ucb/source/ucp/cmis/cmis_provider.hxx7
-rw-r--r--ucb/source/ucp/cmis/ucpcmis1.component5
3 files changed, 15 insertions, 48 deletions
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>