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 /ucb/source | |
parent | 1dedb15b17a8e8bf04f248809ef48db663034254 (diff) |
fdo#46808, use service constructor for ucb::Store
Change-Id: I62719ef9d58215e287af3e1be52404993722ec67
Diffstat (limited to 'ucb/source')
21 files changed, 78 insertions, 88 deletions
diff --git a/ucb/source/ucp/cmis/cmis_provider.cxx b/ucb/source/ucp/cmis/cmis_provider.cxx index 271cd5bb50a7..b7febb5382dd 100644 --- a/ucb/source/ucp/cmis/cmis_provider.cxx +++ b/ucb/source/ucp/cmis/cmis_provider.cxx @@ -28,6 +28,7 @@ #include <stdio.h> +#include <comphelper/processfactory.hxx> #include <ucbhelper/contentidentifier.hxx> #include <ucbhelper/contenthelper.hxx> #include <com/sun/star/ucb/ContentCreationException.hpp> @@ -59,12 +60,12 @@ ContentProvider::queryContent( URL aUrl( Identifier->getContentIdentifier( ) ); if ( aUrl.getRepositoryId( ).isEmpty( ) ) { - xContent = new RepoContent( m_xSMgr, this, Identifier ); + xContent = new RepoContent( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), this, Identifier ); registerNewContent( xContent ); } else { - xContent = new Content( m_xSMgr, this, Identifier ); + xContent = new Content( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), this, Identifier ); registerNewContent( xContent ); } } @@ -96,8 +97,8 @@ void ContentProvider::registerSession( const rtl::OUString& sBindingUrl, libcmis } ContentProvider::ContentProvider( - const uno::Reference< lang::XMultiServiceFactory >& rSMgr ) -: ::ucbhelper::ContentProviderImplHelper( rSMgr ) + const uno::Reference< uno::XComponentContext >& rxContext ) +: ::ucbhelper::ContentProviderImplHelper( rxContext ) { } @@ -115,7 +116,7 @@ XTYPEPROVIDER_IMPL_3( ContentProvider, lang::XServiceInfo, com::sun::star::ucb::XContentProvider ); -XSERVICEINFO_IMPL_1( ContentProvider, +XSERVICEINFO_IMPL_1_CTX( ContentProvider, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.CmisContentProvider" )), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( diff --git a/ucb/source/ucp/cmis/cmis_provider.hxx b/ucb/source/ucp/cmis/cmis_provider.hxx index 2ade10052725..75d7de7e1d53 100644 --- a/ucb/source/ucp/cmis/cmis_provider.hxx +++ b/ucb/source/ucp/cmis/cmis_provider.hxx @@ -43,7 +43,7 @@ private: public: ContentProvider( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& rSMgr ); + ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~ContentProvider(); // XInterface diff --git a/ucb/source/ucp/ext/ucpext_provider.cxx b/ucb/source/ucp/ext/ucpext_provider.cxx index 95120c3f877c..18e0e3230022 100644 --- a/ucb/source/ucp/ext/ucpext_provider.cxx +++ b/ucb/source/ucp/ext/ucpext_provider.cxx @@ -54,8 +54,8 @@ namespace ucb { namespace ucp { namespace ext //= ContentProvider //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - ContentProvider::ContentProvider( const Reference< XMultiServiceFactory >& i_rServiceManager ) - :ContentProvider_Base( i_rServiceManager ) + ContentProvider::ContentProvider( const Reference< XComponentContext >& rxContext ) + :ContentProvider_Base( rxContext ) { } @@ -94,8 +94,7 @@ namespace ucb { namespace ucp { namespace ext //------------------------------------------------------------------------------------------------------------------ Reference< XInterface > ContentProvider::Create( const Reference< XComponentContext >& i_rContext ) { - const ::comphelper::ComponentContext aContext( i_rContext ); - return *( new ContentProvider( aContext.getLegacyServiceFactory() ) ); + return *( new ContentProvider( i_rContext ) ); } //------------------------------------------------------------------------------------------------------------------ @@ -173,7 +172,7 @@ namespace ucb { namespace ucp { namespace ext } } } - const Reference< XContentIdentifier > xNormalizedIdentifier( new ::ucbhelper::ContentIdentifier( m_xSMgr, aComposer.makeStringAndClear() ) ); + const Reference< XContentIdentifier > xNormalizedIdentifier( new ::ucbhelper::ContentIdentifier( Reference<XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW), aComposer.makeStringAndClear() ) ); ::osl::MutexGuard aGuard( m_aMutex ); @@ -183,7 +182,7 @@ namespace ucb { namespace ucp { namespace ext return xContent; // create a new content - xContent = new Content( m_xSMgr, this, xNormalizedIdentifier ); + xContent = new Content( Reference<XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW), this, xNormalizedIdentifier ); if ( !xContent->getIdentifier().is() ) throw IllegalIdentifierException(); diff --git a/ucb/source/ucp/ext/ucpext_provider.hxx b/ucb/source/ucp/ext/ucpext_provider.hxx index 4157c35c9d57..88c7f58325fa 100644 --- a/ucb/source/ucp/ext/ucpext_provider.hxx +++ b/ucb/source/ucp/ext/ucpext_provider.hxx @@ -34,7 +34,7 @@ namespace ucb { namespace ucp { namespace ext class ContentProvider : public ContentProvider_Base { public: - ContentProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rServiceManager ); + ContentProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~ContentProvider(); // XServiceInfo diff --git a/ucb/source/ucp/file/filrow.cxx b/ucb/source/ucp/file/filrow.cxx index 1c48f0a2ce7b..8342985c45cb 100644 --- a/ucb/source/ucp/file/filrow.cxx +++ b/ucb/source/ucp/file/filrow.cxx @@ -43,8 +43,7 @@ sal_Bool convert( shell* pShell, { if( ! xConverter.is() ) { - xConverter = uno::Reference< script::XTypeConverter >( - script::Converter::create(comphelper::getComponentContext(pShell->m_xMultiServiceFactory)) ); + xConverter = script::Converter::create(pShell->m_xContext); } try diff --git a/ucb/source/ucp/file/filrset.cxx b/ucb/source/ucp/file/filrset.cxx index eb5a0cef86d9..d343b1c5d802 100644 --- a/ucb/source/ucp/file/filrset.cxx +++ b/ucb/source/ucp/file/filrset.cxx @@ -705,8 +705,7 @@ XResultSet_impl::connectToCache( ucb::ServiceNotFoundException, uno::RuntimeException ) { - uno::Reference< lang::XMultiServiceFactory > mxSMgr - = m_pMyShell->m_xMultiServiceFactory; + uno::Reference< lang::XMultiServiceFactory > mxSMgr(m_pMyShell->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW); if( m_xListener.is() ) throw ucb::ListenerAlreadySetException( ::rtl::OUString( OSL_LOG_PREFIX ), uno::Reference< uno::XInterface >() ); @@ -773,7 +772,7 @@ XResultSet_impl::getMetaData( ::ucbhelper::ResultSetMetaData* p = new ::ucbhelper::ResultSetMetaData( - m_pMyShell->m_xMultiServiceFactory, + uno::Reference<lang::XMultiServiceFactory>(m_pMyShell->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), m_sProperty, aColumnData ); return uno::Reference< sdbc::XResultSetMetaData >( p ); @@ -782,7 +781,7 @@ XResultSet_impl::getMetaData( ::ucbhelper::ResultSetMetaData* p = new ::ucbhelper::ResultSetMetaData( - m_pMyShell->m_xMultiServiceFactory, m_sProperty ); + uno::Reference<lang::XMultiServiceFactory>(m_pMyShell->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), m_sProperty ); return uno::Reference< sdbc::XResultSetMetaData >( p ); } diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx index d1468453ab76..4e4b6cf832e0 100644 --- a/ucb/source/ucp/file/prov.cxx +++ b/ucb/source/ucp/file/prov.cxx @@ -20,6 +20,7 @@ #include <osl/security.hxx> #include <osl/file.hxx> #include <osl/socket.h> +#include <comphelper/processfactory.hxx> #include <cppuhelper/factory.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/ucb/FileSystemNotation.hpp> @@ -80,8 +81,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucpfile_component_getFactory( -FileProvider::FileProvider( const Reference< XMultiServiceFactory >& xMultiServiceFactory ) - : m_xMultiServiceFactory( xMultiServiceFactory ), +FileProvider::FileProvider( const Reference< XComponentContext >& rxContext ) + : m_xContext( rxContext ), m_pMyShell( 0 ) { } @@ -139,7 +140,7 @@ FileProvider::queryInterface( void SAL_CALL FileProvider::init() { if( ! m_pMyShell ) - m_pMyShell = new shell( m_xMultiServiceFactory, this, sal_True ); + m_pMyShell = new shell( m_xContext, this, sal_True ); } @@ -153,9 +154,9 @@ FileProvider::initialize( if( aArguments.getLength() > 0 && (aArguments[0] >>= config) && config.compareToAscii("NoConfig") == 0 ) - m_pMyShell = new shell( m_xMultiServiceFactory, this, sal_False ); + m_pMyShell = new shell( m_xContext, this, sal_False ); else - m_pMyShell = new shell( m_xMultiServiceFactory, this, sal_True ); + m_pMyShell = new shell( m_xContext, this, sal_True ); } } @@ -244,7 +245,7 @@ Reference< XInterface > SAL_CALL FileProvider::CreateInstance( const Reference< XMultiServiceFactory >& xMultiServiceFactory ) { - XServiceInfo* xP = (XServiceInfo*) new FileProvider( xMultiServiceFactory ); + XServiceInfo* xP = (XServiceInfo*) new FileProvider( comphelper::getComponentContext(xMultiServiceFactory) ); return Reference< XInterface >::query( xP ); } diff --git a/ucb/source/ucp/file/prov.hxx b/ucb/source/ucp/file/prov.hxx index 221eff60709c..c6336e735918 100644 --- a/ucb/source/ucp/file/prov.hxx +++ b/ucb/source/ucp/file/prov.hxx @@ -60,7 +60,7 @@ namespace fileaccess { friend class BaseContent; public: - FileProvider( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF ); + FileProvider( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); ~FileProvider(); // XInterface @@ -211,7 +211,7 @@ namespace fileaccess { void SAL_CALL init(); // Members - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMultiServiceFactory; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; void SAL_CALL initProperties( void ); osl::Mutex m_aMutex; diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx index 3410248d4e58..348810e37857 100644 --- a/ucb/source/ucp/file/shell.cxx +++ b/ucb/source/ucp/file/shell.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> #include <com/sun/star/ucb/InsertCommandArgument.hpp> #include <com/sun/star/ucb/NameClash.hpp> +#include <com/sun/star/ucb/Store.hpp> #include <com/sun/star/ucb/XContentIdentifier.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/ucb/XContentAccess.hpp> @@ -146,12 +147,12 @@ shell::MyProperty::~MyProperty() #include "filinl.hxx" -shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceFactory, +shell::shell( const uno::Reference< uno::XComponentContext >& rxContext, FileProvider* pProvider, sal_Bool bWithConfig ) : TaskManager(), m_bWithConfig( bWithConfig ), m_pProvider( pProvider ), - m_xMultiServiceFactory( xMultiServiceFactory ), + m_xContext( rxContext ), Title( "Title" ), CasePreservingURL( "CasePreservingURL" ), IsDocument( "IsDocument" ), @@ -386,15 +387,9 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF if(m_bWithConfig) { - rtl::OUString Store("com.sun.star.ucb.Store"); - uno::Reference< XPropertySetRegistryFactory > xRegFac( - m_xMultiServiceFactory->createInstance( Store ), - uno::UNO_QUERY ); - if ( xRegFac.is() ) - { - // Open/create a registry - m_xFileRegistry = xRegFac->createPropertySetRegistry( rtl::OUString() ); - } + uno::Reference< XPropertySetRegistryFactory > xRegFac = ucb::Store::create( m_xContext ); + // Open/create a registry + m_xFileRegistry = xRegFac->createPropertySetRegistry( rtl::OUString() ); } } diff --git a/ucb/source/ucp/file/shell.hxx b/ucb/source/ucp/file/shell.hxx index 1d3892d0002d..5a9503efa991 100644 --- a/ucb/source/ucp/file/shell.hxx +++ b/ucb/source/ucp/file/shell.hxx @@ -48,6 +48,7 @@ #include <com/sun/star/ucb/NumberedSortingInfo.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/ucb/XContentProvider.hpp> #include <com/sun/star/ucb/XDynamicResultSet.hpp> #include <com/sun/star/beans/XPropertyContainer.hpp> @@ -159,7 +160,7 @@ namespace fileaccess { public: // MethodenDefinitionen - shell( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMultiServiceFactory, + shell( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, FileProvider* pProvider,sal_Bool bWithConfig ); virtual ~shell(); @@ -401,7 +402,7 @@ namespace fileaccess { sal_Bool m_bWithConfig; FileProvider* m_pProvider; - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMultiServiceFactory; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; com::sun::star::uno::Reference< com::sun::star::ucb::XPropertySetRegistry > m_xFileRegistry; private: diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx index ee57e6d263c9..0f961ecaac8e 100644 --- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx +++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx @@ -50,8 +50,8 @@ using namespace com::sun::star::beans; //========================================================================= FTPContentProvider::FTPContentProvider( - const Reference< XMultiServiceFactory >& rSMgr) -: ::ucbhelper::ContentProviderImplHelper(rSMgr), + const Reference< XComponentContext >& rxContext) +: ::ucbhelper::ContentProviderImplHelper(rxContext), m_ftpLoaderThread(0), m_pProxyDecider(0) { @@ -93,7 +93,7 @@ XTYPEPROVIDER_IMPL_3(FTPContentProvider, // //========================================================================= -XSERVICEINFO_IMPL_1( +XSERVICEINFO_IMPL_1_CTX( FTPContentProvider, rtl::OUString("com.sun.star.comp.FTPContentProvider"), rtl::OUString(FTP_CONTENT_PROVIDER_SERVICE_NAME)); @@ -154,7 +154,7 @@ FTPContentProvider::queryContent( aURL.host(), aURL.port().toInt32())) { - xContent = new FTPContent(m_xSMgr,this,xCanonicId,aURL); + xContent = new FTPContent( Reference<XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW), this,xCanonicId,aURL); registerNewContent(xContent); } else { @@ -178,7 +178,7 @@ FTPContentProvider::queryContent( void FTPContentProvider::init() { m_ftpLoaderThread = new FTPLoaderThread(); - m_pProxyDecider = new ucbhelper::InternetProxyDecider(comphelper::getComponentContext(m_xSMgr)); + m_pProxyDecider = new ucbhelper::InternetProxyDecider( m_xContext ); } @@ -250,10 +250,7 @@ FTPContentProvider::getHttpProvider() throw(RuntimeException) { // used for access to ftp-proxy - return - UniversalContentBroker::create( - comphelper::getComponentContext(m_xSMgr))-> - queryContentProvider("http:"); + return UniversalContentBroker::create( m_xContext )->queryContentProvider("http:"); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.hxx b/ucb/source/ucp/ftp/ftpcontentprovider.hxx index ce8abdb95e38..5f47640a146b 100644 --- a/ucb/source/ucp/ftp/ftpcontentprovider.hxx +++ b/ucb/source/ucp/ftp/ftpcontentprovider.hxx @@ -55,8 +55,7 @@ namespace ftp { public: FTPContentProvider( - const com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory>& xMSF ); + const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); ~FTPContentProvider(); diff --git a/ucb/source/ucp/gvfs/gvfs_provider.cxx b/ucb/source/ucp/gvfs/gvfs_provider.cxx index cefb6867ac28..8a372ebf713d 100644 --- a/ucb/source/ucp/gvfs/gvfs_provider.cxx +++ b/ucb/source/ucp/gvfs/gvfs_provider.cxx @@ -18,6 +18,7 @@ */ +#include <comphelper/processfactory.hxx> #include <ucbhelper/contentidentifier.hxx> #include <libgnomevfs/gnome-vfs-init.h> #include "gvfs_provider.hxx" @@ -35,8 +36,8 @@ using namespace gvfs; //========================================================================= ContentProvider::ContentProvider( - const uno::Reference< lang::XMultiServiceFactory >& rSMgr ) -: ::ucbhelper::ContentProviderImplHelper( rSMgr ) + const uno::Reference< uno::XComponentContext >& rxContext ) +: ::ucbhelper::ContentProviderImplHelper( rxContext ) { } // sdafas @@ -74,7 +75,7 @@ XTYPEPROVIDER_IMPL_3( ContentProvider, // //========================================================================= -XSERVICEINFO_IMPL_1( ContentProvider, +XSERVICEINFO_IMPL_1_CTX( ContentProvider, rtl::OUString( "com.sun.star.comp.GnomeVFSContentProvider" ), rtl::OUString( "com.sun.star.ucb.GnomeVFSContentProvider" ) ); //========================================================================= @@ -114,7 +115,7 @@ ContentProvider::queryContent( try { - xContent = new ::gvfs::Content(m_xSMgr, this, Identifier ); + xContent = new ::gvfs::Content(uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), this, Identifier ); registerNewContent( xContent ); } catch ( com::sun::star::ucb::ContentCreationException const & ) diff --git a/ucb/source/ucp/gvfs/gvfs_provider.hxx b/ucb/source/ucp/gvfs/gvfs_provider.hxx index c3381c5bbd1a..8ff142c3c916 100644 --- a/ucb/source/ucp/gvfs/gvfs_provider.hxx +++ b/ucb/source/ucp/gvfs/gvfs_provider.hxx @@ -29,7 +29,7 @@ class ContentProvider : public ::ucbhelper::ContentProviderImplHelper { public: ContentProvider( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& rSMgr ); + ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~ContentProvider(); // XInterface diff --git a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx index ba11dff28586..73c1be518cc5 100644 --- a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx +++ b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx @@ -49,8 +49,8 @@ using namespace hierarchy_ucp; //========================================================================= HierarchyContentProvider::HierarchyContentProvider( - const uno::Reference< lang::XMultiServiceFactory >& rXSMgr ) -: ::ucbhelper::ContentProviderImplHelper( rXSMgr ) + const uno::Reference< uno::XComponentContext >& rxContext ) +: ::ucbhelper::ContentProviderImplHelper( rxContext ) { } @@ -90,7 +90,7 @@ XTYPEPROVIDER_IMPL_4( HierarchyContentProvider, // //========================================================================= -XSERVICEINFO_IMPL_1( HierarchyContentProvider, +XSERVICEINFO_IMPL_1_CTX( HierarchyContentProvider, rtl::OUString( "com.sun.star.comp.ucb.HierarchyContentProvider" ), rtl::OUString( HIERARCHY_CONTENT_PROVIDER_SERVICE_NAME ) ); @@ -120,7 +120,7 @@ HierarchyContentProvider::queryContent( // Encode URL and create new Id. This may "correct" user-typed-in URL's. uno::Reference< ucb::XContentIdentifier > xCanonicId - = new ::ucbhelper::ContentIdentifier( m_xSMgr, + = new ::ucbhelper::ContentIdentifier( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), ::ucb_impl::urihelper::encodeURI( aUri.getUri() ) ); osl::MutexGuard aGuard( m_aMutex ); @@ -132,7 +132,7 @@ HierarchyContentProvider::queryContent( return xContent; // Create a new content. - xContent = HierarchyContent::create( m_xSMgr, this, xCanonicId ); + xContent = HierarchyContent::create( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), this, xCanonicId ); registerNewContent( xContent ); if ( xContent.is() && !xContent->getIdentifier().is() ) @@ -176,7 +176,7 @@ HierarchyContentProvider::getConfigProvider( ConfigProviderMapEntry aEntry; aEntry.xConfigProvider = uno::Reference< lang::XMultiServiceFactory >( - m_xSMgr->createInstance( rServiceSpecifier ), + m_xContext->getServiceManager()->createInstanceWithContext(rServiceSpecifier, m_xContext), uno::UNO_QUERY ); if ( aEntry.xConfigProvider.is() ) @@ -268,12 +268,9 @@ HierarchyContentProvider::getOfficeInstallationDirectories() osl::MutexGuard aGuard( m_aMutex ); if ( !m_xOfficeInstDirs.is() ) { - OSL_ENSURE( m_xSMgr.is(), "No service manager!" ); + OSL_ENSURE( m_xContext.is(), "No service manager!" ); - uno::Reference< uno::XComponentContext > xCtx( - comphelper::getComponentContext( m_xSMgr ) ); - - xCtx->getValueByName( + m_xContext->getValueByName( rtl::OUString( "/singletons/com.sun.star.util.theOfficeInstallationDirectories" ) ) >>= m_xOfficeInstDirs; diff --git a/ucb/source/ucp/hierarchy/hierarchyprovider.hxx b/ucb/source/ucp/hierarchy/hierarchyprovider.hxx index 8c44691806ae..e8e2a5d8f4ab 100644 --- a/ucb/source/ucp/hierarchy/hierarchyprovider.hxx +++ b/ucb/source/ucp/hierarchy/hierarchyprovider.hxx @@ -101,7 +101,7 @@ class HierarchyContentProvider : public ::ucbhelper::ContentProviderImplHelper, public: HierarchyContentProvider( const com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory >& rXSMgr ); + com::sun::star::uno::XComponentContext >& rxContext ); virtual ~HierarchyContentProvider(); // XInterface diff --git a/ucb/source/ucp/package/pkgprovider.cxx b/ucb/source/ucp/package/pkgprovider.cxx index 0f1cf5f6f3d8..15bd2912d058 100644 --- a/ucb/source/ucp/package/pkgprovider.cxx +++ b/ucb/source/ucp/package/pkgprovider.cxx @@ -26,6 +26,7 @@ #include <boost/unordered_map.hpp> #include <osl/diagnose.h> +#include <comphelper/processfactory.hxx> #include <cppuhelper/weak.hxx> #include <ucbhelper/contentidentifier.hxx> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> @@ -130,8 +131,8 @@ using namespace package_ucp; //========================================================================= ContentProvider::ContentProvider( - const uno::Reference< lang::XMultiServiceFactory >& rSMgr ) -: ::ucbhelper::ContentProviderImplHelper( rSMgr ), + const uno::Reference< uno::XComponentContext >& rxContext ) +: ::ucbhelper::ContentProviderImplHelper( rxContext ), m_pPackages( 0 ) { } @@ -171,7 +172,7 @@ XTYPEPROVIDER_IMPL_3( ContentProvider, // //========================================================================= -XSERVICEINFO_IMPL_1( ContentProvider, +XSERVICEINFO_IMPL_1_CTX( ContentProvider, rtl::OUString( "com.sun.star.comp.ucb.PackageContentProvider" ), rtl::OUString( PACKAGE_CONTENT_PROVIDER_SERVICE_NAME ) ); @@ -204,7 +205,7 @@ uno::Reference< ucb::XContent > SAL_CALL ContentProvider::queryContent( // Create a new identifier for the mormalized URL returned by // PackageUri::getUri(). uno::Reference< ucb::XContentIdentifier > xId - = new ::ucbhelper::ContentIdentifier( m_xSMgr, aUri.getUri() ); + = new ::ucbhelper::ContentIdentifier( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), aUri.getUri() ); osl::MutexGuard aGuard( m_aMutex ); @@ -216,7 +217,7 @@ uno::Reference< ucb::XContent > SAL_CALL ContentProvider::queryContent( // Create a new content. - xContent = Content::create( m_xSMgr, this, Identifier ); // not xId!!! + xContent = Content::create( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), this, Identifier ); // not xId!!! registerNewContent( xContent ); if ( xContent.is() && !xContent->getIdentifier().is() ) @@ -263,9 +264,8 @@ ContentProvider::createPackage( const rtl::OUString & rName, const rtl::OUString aArguments[ 0 ] <<= rURL; uno::Reference< uno::XInterface > xIfc - = m_xSMgr->createInstanceWithArguments( - rtl::OUString( "com.sun.star.packages.comp.ZipPackage" ), - aArguments ); + = m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.packages.comp.ZipPackage", + aArguments, m_xContext ); if ( xIfc.is() ) { diff --git a/ucb/source/ucp/package/pkgprovider.hxx b/ucb/source/ucp/package/pkgprovider.hxx index 09a1ba2cdd9a..2f19adfbda09 100644 --- a/ucb/source/ucp/package/pkgprovider.hxx +++ b/ucb/source/ucp/package/pkgprovider.hxx @@ -57,7 +57,7 @@ class ContentProvider : public ::ucbhelper::ContentProviderImplHelper public: ContentProvider( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& rSMgr ); + ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~ContentProvider(); // XInterface diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx index dbf8b65eaad0..b1b9385d2090 100644 --- a/ucb/source/ucp/tdoc/tdoc_provider.cxx +++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx @@ -51,7 +51,7 @@ using namespace tdoc_ucp; ContentProvider::ContentProvider( const uno::Reference< lang::XMultiServiceFactory >& xSMgr ) -: ::ucbhelper::ContentProviderImplHelper( xSMgr ), +: ::ucbhelper::ContentProviderImplHelper( comphelper::getComponentContext(xSMgr) ), m_xDocsMgr( new OfficeDocumentsManager( comphelper::getComponentContext(xSMgr), this ) ), m_xStgElemFac( new StorageElementFactory( xSMgr, m_xDocsMgr ) ) { @@ -130,7 +130,7 @@ ContentProvider::queryContent( // Normalize URI. uno::Reference< ucb::XContentIdentifier > xCanonicId - = new ::ucbhelper::ContentIdentifier( m_xSMgr, aUri.getUri() ); + = new ::ucbhelper::ContentIdentifier( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), aUri.getUri() ); osl::MutexGuard aGuard( m_aMutex ); @@ -141,7 +141,7 @@ ContentProvider::queryContent( if ( !xContent.is() ) { // Create a new content. - xContent = Content::create( m_xSMgr, this, xCanonicId ); + xContent = Content::create( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), this, xCanonicId ); registerNewContent( xContent ); } @@ -172,7 +172,7 @@ ContentProvider::createDocumentContent( uno::Reference< ucb::XContentIdentifier > xId = new ::ucbhelper::ContentIdentifier( - m_xSMgr, aBuffer.makeStringAndClear() ); + uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), aBuffer.makeStringAndClear() ); osl::MutexGuard aGuard( m_aMutex ); @@ -183,7 +183,7 @@ ContentProvider::createDocumentContent( if ( !xContent.is() ) { // Create a new content. - xContent = Content::create( m_xSMgr, this, xId ); + xContent = Content::create( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), this, xId ); } if ( xContent.is() ) diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.cxx b/ucb/source/ucp/webdav-neon/webdavprovider.cxx index fd7371d7428d..f3985121488e 100644 --- a/ucb/source/ucp/webdav-neon/webdavprovider.cxx +++ b/ucb/source/ucp/webdav-neon/webdavprovider.cxx @@ -32,6 +32,7 @@ ************************************************************************** *************************************************************************/ +#include <comphelper/processfactory.hxx> #include <ucbhelper/contentidentifier.hxx> #include "webdavprovider.hxx" #include "webdavcontent.hxx" @@ -50,8 +51,8 @@ using namespace webdav_ucp; //========================================================================= ContentProvider::ContentProvider( - const uno::Reference< lang::XMultiServiceFactory >& rSMgr ) -: ::ucbhelper::ContentProviderImplHelper( rSMgr ), + const uno::Reference< uno::XComponentContext >& rxContext ) +: ::ucbhelper::ContentProviderImplHelper( rxContext ), m_xDAVSessionFactory( new DAVSessionFactory() ), m_pProps( 0 ) { @@ -92,7 +93,7 @@ XTYPEPROVIDER_IMPL_3( ContentProvider, // //========================================================================= -XSERVICEINFO_IMPL_1( ContentProvider, +XSERVICEINFO_IMPL_1_CTX( ContentProvider, rtl::OUString( "com.sun.star.comp.WebDAVContentProvider" ), rtl::OUString( WEBDAV_CONTENT_PROVIDER_SERVICE_NAME ) ); @@ -180,7 +181,7 @@ ContentProvider::queryContent( } if ( bNewId ) - xCanonicId = new ::ucbhelper::ContentIdentifier( m_xSMgr, aURL ); + xCanonicId = new ::ucbhelper::ContentIdentifier( uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), aURL ); else xCanonicId = Identifier; @@ -197,7 +198,7 @@ ContentProvider::queryContent( try { xContent = new ::webdav_ucp::Content( - m_xSMgr, this, xCanonicId, m_xDAVSessionFactory ); + uno::Reference<lang::XMultiServiceFactory>(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW), this, xCanonicId, m_xDAVSessionFactory ); registerNewContent( xContent ); } catch ( ucb::ContentCreationException const & ) diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.hxx b/ucb/source/ucp/webdav-neon/webdavprovider.hxx index 6001a1c6b655..3793868d2b45 100644 --- a/ucb/source/ucp/webdav-neon/webdavprovider.hxx +++ b/ucb/source/ucp/webdav-neon/webdavprovider.hxx @@ -84,7 +84,7 @@ class ContentProvider : public ::ucbhelper::ContentProviderImplHelper public: ContentProvider( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& rSMgr ); + ::com::sun::star::uno::XComponentContext >& rxContext ); virtual ~ContentProvider(); // XInterface |