summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-12-03 16:33:30 +0200
committerNoel Grandin <noel@peralex.com>2012-12-10 08:05:53 +0200
commit24f0aa76c005d1506a6d13945c39dafc6e9b8d91 (patch)
treede84b05444d3436ed107bc4fb7d3522284e69529 /ucb
parentb9a4a0b9658015a0d55c42de1f5e56941e20d268 (diff)
fdo#46808, use service constructor for embed::StorageFactory
Change-Id: I26cd1cf86118122f392f16801a646df753a7df26
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/tdoc/tdoc_provider.cxx10
-rw-r--r--ucb/source/ucp/tdoc/tdoc_provider.hxx2
-rw-r--r--ucb/source/ucp/tdoc/tdoc_storage.cxx24
-rw-r--r--ucb/source/ucp/tdoc/tdoc_storage.hxx4
4 files changed, 17 insertions, 23 deletions
diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx
index d5fbb0b6ea2a..7a9c223a04c5 100644
--- a/ucb/source/ucp/tdoc/tdoc_provider.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx
@@ -50,10 +50,10 @@ using namespace tdoc_ucp;
//=========================================================================
ContentProvider::ContentProvider(
- const uno::Reference< lang::XMultiServiceFactory >& xSMgr )
-: ::ucbhelper::ContentProviderImplHelper( comphelper::getComponentContext(xSMgr) ),
- m_xDocsMgr( new OfficeDocumentsManager( comphelper::getComponentContext(xSMgr), this ) ),
- m_xStgElemFac( new StorageElementFactory( xSMgr, m_xDocsMgr ) )
+ const uno::Reference< uno::XComponentContext >& rxContext )
+: ::ucbhelper::ContentProviderImplHelper( rxContext ),
+ m_xDocsMgr( new OfficeDocumentsManager( rxContext, this ) ),
+ m_xStgElemFac( new StorageElementFactory( rxContext, m_xDocsMgr ) )
{
}
@@ -95,7 +95,7 @@ XTYPEPROVIDER_IMPL_4( ContentProvider,
//
//=========================================================================
-XSERVICEINFO_IMPL_1(
+XSERVICEINFO_IMPL_1_CTX(
ContentProvider,
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.comp.ucb.TransientDocumentsContentProvider" ) ),
diff --git a/ucb/source/ucp/tdoc/tdoc_provider.hxx b/ucb/source/ucp/tdoc/tdoc_provider.hxx
index eaa3fd850398..69bc2b2fed3f 100644
--- a/ucb/source/ucp/tdoc/tdoc_provider.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_provider.hxx
@@ -64,7 +64,7 @@ class ContentProvider :
{
public:
ContentProvider( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
+ com::sun::star::uno::XComponentContext >& rxContext );
virtual ~ContentProvider();
// XInterface
diff --git a/ucb/source/ucp/tdoc/tdoc_storage.cxx b/ucb/source/ucp/tdoc/tdoc_storage.cxx
index dd86cff85a92..e31a877796f2 100644
--- a/ucb/source/ucp/tdoc/tdoc_storage.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_storage.cxx
@@ -21,7 +21,7 @@
#include "com/sun/star/beans/XPropertySet.hpp"
#include "com/sun/star/embed/ElementModes.hpp"
-#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/embed/StorageFactory.hpp"
#include "comphelper/processfactory.hxx"
#include "tdoc_uri.hxx"
@@ -43,10 +43,10 @@ using namespace tdoc_ucp;
//=========================================================================
StorageElementFactory::StorageElementFactory(
- const uno::Reference< lang::XMultiServiceFactory > & xSMgr,
+ const uno::Reference< uno::XComponentContext > & rxContext,
const rtl::Reference< OfficeDocumentsManager > & xDocsMgr )
: m_xDocsMgr( xDocsMgr ),
- m_xSMgr( xSMgr )
+ m_xContext( rxContext )
{
}
@@ -65,13 +65,9 @@ StorageElementFactory::createTemporaryStorage()
{
uno::Reference< embed::XStorage > xStorage;
uno::Reference< lang::XSingleServiceFactory > xStorageFac;
- if ( m_xSMgr.is() )
+ if ( m_xContext.is() )
{
- xStorageFac = uno::Reference< lang::XSingleServiceFactory >(
- m_xSMgr->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.embed.StorageFactory" ) ) ),
- uno::UNO_QUERY );
+ xStorageFac = embed::StorageFactory::create( m_xContext );
}
OSL_ENSURE( xStorageFac.is(), "Can't create storage factory!" );
@@ -185,7 +181,7 @@ StorageElementFactory::createStorage( const rtl::OUString & rUri,
|| ( eMode == READ_WRITE_CREATE ) );
std::auto_ptr< Storage > xElement(
- new Storage( comphelper::getComponentContext(m_xSMgr), this, aUriKey, xParentStorage, xStorage ) );
+ new Storage( m_xContext, this, aUriKey, xParentStorage, xStorage ) );
aIt = m_aMap.insert(
StorageMap::value_type(
@@ -234,8 +230,7 @@ StorageElementFactory::createStorage( const rtl::OUString & rUri,
return xStorage;
}
- aIt->second
- = new Storage( comphelper::getComponentContext(m_xSMgr), this, aUriKey, xParentStorage, xStorage );
+ aIt->second = new Storage( m_xContext, this, aUriKey, xParentStorage, xStorage );
aIt->second->m_aContainerIt = aIt;
return aIt->second;
}
@@ -312,8 +307,7 @@ StorageElementFactory::createOutputStream( const rtl::OUString & rUri,
// and even no writable instance if there is already another
// read-only instance!)
return uno::Reference< io::XOutputStream >(
- new OutputStream(
- comphelper::getComponentContext(m_xSMgr), rUri, xParentStorage, xStream->getOutputStream() ) );
+ new OutputStream( m_xContext, rUri, xParentStorage, xStream->getOutputStream() ) );
}
//=========================================================================
@@ -353,7 +347,7 @@ StorageElementFactory::createStream( const rtl::OUString & rUri,
}
return uno::Reference< io::XStream >(
- new Stream( comphelper::getComponentContext(m_xSMgr), rUri, xParentStorage, xStream ) );
+ new Stream( m_xContext, rUri, xParentStorage, xStream ) );
}
//=========================================================================
diff --git a/ucb/source/ucp/tdoc/tdoc_storage.hxx b/ucb/source/ucp/tdoc/tdoc_storage.hxx
index 2dc5dc0bd078..9904ab9d62ba 100644
--- a/ucb/source/ucp/tdoc/tdoc_storage.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_storage.hxx
@@ -45,7 +45,7 @@ namespace tdoc_ucp {
public:
StorageElementFactory(
const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > & xSMgr,
+ com::sun::star::uno::XComponentContext > & rxContext,
const rtl::Reference< OfficeDocumentsManager > & xDocsMgr );
~StorageElementFactory();
@@ -156,7 +156,7 @@ namespace tdoc_ucp {
osl::Mutex m_aMutex;
rtl::Reference< OfficeDocumentsManager > m_xDocsMgr;
com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ com::sun::star::uno::XComponentContext > m_xContext;
};
} // namespace tdoc_ucp