diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-31 16:08:53 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-11-05 16:43:14 +0100 |
commit | 8ec2fed7c88674258ce716e69ae31d8f9be7223c (patch) | |
tree | e6d6a9657a247bb787fb2bc17688cef456efa288 /ucbhelper | |
parent | 1dedb15b17a8e8bf04f248809ef48db663034254 (diff) |
fdo#46808, use service constructor for ucb::Store
Change-Id: I62719ef9d58215e287af3e1be52404993722ec67
Diffstat (limited to 'ucbhelper')
-rw-r--r-- | ucbhelper/inc/ucbhelper/macros.hxx | 13 | ||||
-rw-r--r-- | ucbhelper/inc/ucbhelper/providerhelper.hxx | 5 | ||||
-rw-r--r-- | ucbhelper/source/provider/providerhelper.cxx | 30 |
3 files changed, 25 insertions, 23 deletions
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 <com/sun/star/beans/XPropertyAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/ucb/Store.hpp> #include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp> #include <com/sun/star/ucb/XPropertySetRegistry.hpp> @@ -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; |