From 206c70eef30f7b6f538b88f7fb9505f397bef073 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 23 Aug 2012 17:23:26 +0200 Subject: fdo#46808, Adapt TempFile UNO service to new style Change-Id: Ia448d6d74201e2be487c6d8317f94be3745808aa --- oox/source/core/filterdetect.cxx | 4 ++-- oox/source/drawingml/graphicshapecontext.cxx | 6 +++--- oox/source/ole/olestorage.cxx | 10 ++++------ 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'oox') diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index 464bf51c18a8..0e2a1cb64f32 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -19,6 +19,7 @@ #include "oox/core/filterdetect.hxx" +#include #include #include #include @@ -574,8 +575,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript else { // create temporary file for unencrypted package - Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW ); - Reference< XStream > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); + Reference< XStream > xTempFile( TempFile::create(mxContext), UNO_QUERY_THROW ); Reference< XOutputStream > xDecryptedPackage( xTempFile->getOutputStream(), UNO_SET_THROW ); BinaryXOutputStream aDecryptedPackage( xDecryptedPackage, true ); BinaryXInputStream aEncryptedPackage( xEncryptedPackage, true ); diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index 8c340b183bc0..1b13420f866b 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include "oox/drawingml/graphicshapecontext.hxx" #include @@ -76,9 +76,9 @@ Reference< XFastContextHandler > GraphicShapeContext::createFastChildContext( sa getEmbeddedWAVAudioFile( getRelations(), xAttribs, mpShapePtr->getGraphicProperties().maAudio ); if( !mpShapePtr->getGraphicProperties().maAudio.msEmbed.isEmpty() ) { - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); + Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); Reference< XInputStream > xInStrm( getFilter().openInputStream( mpShapePtr->getGraphicProperties().maAudio.msEmbed ), UNO_SET_THROW ); - Reference< XTempFile > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); + Reference< XTempFile > xTempFile( TempFile::create(xContext) ); Reference< XOutputStream > xOutStrm( xTempFile->getOutputStream(), UNO_SET_THROW ); BinaryXOutputStream aOutStrm( xOutStrm, false ); BinaryXInputStream aInStrm( xInStrm, false ); diff --git a/oox/source/ole/olestorage.cxx b/oox/source/ole/olestorage.cxx index fdd6c8de2a95..3b71dda8068c 100644 --- a/oox/source/ole/olestorage.cxx +++ b/oox/source/ole/olestorage.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -95,8 +96,7 @@ OleOutputStream::OleOutputStream( const Reference< XComponentContext >& rxContex { try { - Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW ); - mxTempFile.set( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); + mxTempFile.set( TempFile::create(rxContext), UNO_QUERY_THROW ); mxOutStrm = mxTempFile->getOutputStream(); mxSeekable.set( mxOutStrm, UNO_QUERY ); } @@ -224,8 +224,7 @@ void OleStorage::initStorage( const Reference< XInputStream >& rxInStream ) Reference< XInputStream > xInStrm = rxInStream; if( !Reference< XSeekable >( xInStrm, UNO_QUERY ).is() ) try { - Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW ); - Reference< XStream > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); + Reference< XStream > xTempFile( TempFile::create(mxContext), UNO_QUERY_THROW ); { Reference< XOutputStream > xOutStrm( xTempFile->getOutputStream(), UNO_SET_THROW ); /* Pass false to both binary stream objects to keep the UNO @@ -335,8 +334,7 @@ StorageRef OleStorage::implOpenSubStorage( const OUString& rElementName, bool bC if( !isReadOnly() && (bCreateMissing || xSubStorage.get()) ) try { // create new storage based on a temp file - Reference< XMultiServiceFactory > xFactory( mxContext->getServiceManager(), UNO_QUERY_THROW ); - Reference< XStream > xTempFile( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TempFile" ) ), UNO_QUERY_THROW ); + Reference< XStream > xTempFile( TempFile::create(mxContext), UNO_QUERY_THROW ); StorageRef xTempStorage( new OleStorage( *this, xTempFile, rElementName ) ); // copy existing substorage into temp storage if( xSubStorage.get() ) -- cgit