From 8ec2fed7c88674258ce716e69ae31d8f9be7223c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 31 Oct 2012 16:08:53 +0200 Subject: fdo#46808, use service constructor for ucb::Store Change-Id: I62719ef9d58215e287af3e1be52404993722ec67 --- ucbhelper/inc/ucbhelper/macros.hxx | 13 ++++++++++++ ucbhelper/inc/ucbhelper/providerhelper.hxx | 5 ++--- ucbhelper/source/provider/providerhelper.cxx | 30 ++++++++++------------------ 3 files changed, 25 insertions(+), 23 deletions(-) (limited to 'ucbhelper') diff --git a/ucbhelper/inc/ucbhelper/macros.hxx b/ucbhelper/inc/ucbhelper/macros.hxx index 924989ae6d0f..93f562f7fabb 100644 --- a/ucbhelper/inc/ucbhelper/macros.hxx +++ b/ucbhelper/inc/ucbhelper/macros.hxx @@ -742,6 +742,19 @@ Class::getSupportedServiceNames_Static() \ return aSNS; \ } +// 1 service name +#define XSERVICEINFO_IMPL_1_CTX( Class, ImplName, Service1 ) \ +XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \ +XSERVICEINFO_CREATE_INSTANCE_IMPL_CTX( Class ) \ + \ +com::sun::star::uno::Sequence< rtl::OUString > \ +Class::getSupportedServiceNames_Static() \ +{ \ + com::sun::star::uno::Sequence< rtl::OUString > aSNS( 1 ); \ + aSNS.getArray()[ 0 ] = Service1; \ + return aSNS; \ +} + #endif /* !_UCBHELPER_MACROS_HXX */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucbhelper/inc/ucbhelper/providerhelper.hxx b/ucbhelper/inc/ucbhelper/providerhelper.hxx index 60028c3f1ead..24f63ebeef7e 100644 --- a/ucbhelper/inc/ucbhelper/providerhelper.hxx +++ b/ucbhelper/inc/ucbhelper/providerhelper.hxx @@ -76,8 +76,7 @@ class UCBHELPER_DLLPUBLIC ContentProviderImplHelper : public cppu::OWeakObject, protected: osl::Mutex m_aMutex; - ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; private: UCBHELPER_DLLPRIVATE void removeContent( ContentImplHelper* pContent ); @@ -140,7 +139,7 @@ public: ContentProviderImplHelper( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& rXSMgr ); + ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~ContentProviderImplHelper(); ////////////////////////////////////////////////////////////////////// diff --git a/ucbhelper/source/provider/providerhelper.cxx b/ucbhelper/source/provider/providerhelper.cxx index 71395b532041..5407df04d39c 100644 --- a/ucbhelper/source/provider/providerhelper.cxx +++ b/ucbhelper/source/provider/providerhelper.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -102,9 +103,9 @@ struct ContentProviderImplHelper_Impl namespace ucbhelper { ContentProviderImplHelper::ContentProviderImplHelper( - const uno::Reference< lang::XMultiServiceFactory >& rXSMgr ) + const uno::Reference< uno::XComponentContext >& rxContext ) : m_pImpl( new ucbhelper_impl::ContentProviderImplHelper_Impl ), - m_xSMgr( rXSMgr ) + m_xContext( rxContext ) { } @@ -313,26 +314,15 @@ ContentProviderImplHelper::getAdditionalPropertySetRegistry() if ( !m_pImpl->m_xPropertySetRegistry.is() ) { uno::Reference< com::sun::star::ucb::XPropertySetRegistryFactory > - xRegFac( - m_xSMgr->createInstance( - rtl::OUString( - "com.sun.star.ucb.Store" ) ), - uno::UNO_QUERY ); + xRegFac = com::sun::star::ucb::Store::create( m_xContext ); - OSL_ENSURE( xRegFac.is(), - "ContentProviderImplHelper::getAdditionalPropertySet - " - "No UCB-Store service!" ); + // Open/create a registry. + m_pImpl->m_xPropertySetRegistry + = xRegFac->createPropertySetRegistry( rtl::OUString() ); - if ( xRegFac.is() ) - { - // Open/create a registry. - m_pImpl->m_xPropertySetRegistry - = xRegFac->createPropertySetRegistry( rtl::OUString() ); - - OSL_ENSURE( m_pImpl->m_xPropertySetRegistry.is(), - "ContentProviderImplHelper::getAdditionalPropertySet - " - "Error opening registry!" ); - } + OSL_ENSURE( m_pImpl->m_xPropertySetRegistry.is(), + "ContentProviderImplHelper::getAdditionalPropertySet - " + "Error opening registry!" ); } return m_pImpl->m_xPropertySetRegistry; -- cgit v1.2.3