summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx3
-rw-r--r--comphelper/source/streaming/seekableinput.cxx27
-rw-r--r--embeddedobj/source/commonembedding/persistence.cxx92
-rw-r--r--embeddedobj/source/msole/olecomponent.cxx8
-rw-r--r--embeddedobj/source/msole/oleembed.cxx5
-rw-r--r--embeddedobj/source/msole/olepersist.cxx16
-rw-r--r--embeddedobj/source/msole/ownview.cxx3
-rw-r--r--embedserv/source/embed/ed_ipersiststr.cxx143
-rw-r--r--filter/source/xsltfilter/OleHandler.cxx9
-rw-r--r--oox/source/core/filterdetect.cxx4
-rw-r--r--oox/source/drawingml/graphicshapecontext.cxx6
-rw-r--r--oox/source/ole/olestorage.cxx10
-rw-r--r--package/source/xstor/owriteablestream.cxx10
-rw-r--r--package/source/xstor/switchpersistencestream.cxx4
-rw-r--r--package/source/xstor/xfactory.cxx8
-rw-r--r--package/source/xstor/xstorage.cxx9
-rw-r--r--package/source/zippackage/ZipPackage.cxx3
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx28
-rw-r--r--scripting/source/stringresource/stringresource.cxx25
-rw-r--r--sdext/source/minimizer/impoptimizer.cxx5
-rw-r--r--sdext/source/minimizer/informationdialog.cxx9
-rw-r--r--sdext/source/pdfimport/filterdet.cxx5
-rw-r--r--sfx2/source/doc/doctemplates.cxx3
-rw-r--r--sot/source/unoolestorage/xolesimplestorage.cxx6
-rw-r--r--svl/source/fsstor/fsstorage.cxx3
-rw-r--r--svl/source/misc/documentlockfile.cxx4
-rw-r--r--ucb/Library_ucpgvfs1.mk1
-rw-r--r--ucb/source/ucp/gvfs/gvfs_content.cxx7
-rw-r--r--unotools/source/ucbhelper/ucblockbytes.cxx16
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx6
30 files changed, 227 insertions, 251 deletions
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index dec47f17f7ee..cd6aff745e07 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <ucbhelper/content.hxx>
@@ -311,7 +312,7 @@ void SAL_CALL ChartModel::storeToURL(
{
Reference< lang::XMultiServiceFactory > xFact( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
Reference< io::XStream > xStream(
- xFact->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile"))), uno::UNO_QUERY_THROW );
+ io::TempFile::create(m_xContext), uno::UNO_QUERY_THROW );
Reference< io::XInputStream > xInputStream( xStream->getInputStream());
Reference< embed::XStorage > xStorage(
diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx
index c18d66afe26d..41ee54e70017 100644
--- a/comphelper/source/streaming/seekableinput.cxx
+++ b/comphelper/source/streaming/seekableinput.cxx
@@ -17,9 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/seekableinput.hxx>
using namespace ::com::sun::star;
@@ -91,22 +93,19 @@ void OSeekableInputWrapper::PrepareCopy_Impl()
throw uno::RuntimeException();
uno::Reference< io::XOutputStream > xTempOut(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile")) ),
- uno::UNO_QUERY );
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
- if ( xTempOut.is() )
+ copyInputToOutput_Impl( m_xOriginalStream, xTempOut );
+ xTempOut->closeOutput();
+
+ uno::Reference< io::XSeekable > xTempSeek( xTempOut, uno::UNO_QUERY );
+ if ( xTempSeek.is() )
{
- copyInputToOutput_Impl( m_xOriginalStream, xTempOut );
- xTempOut->closeOutput();
-
- uno::Reference< io::XSeekable > xTempSeek( xTempOut, uno::UNO_QUERY );
- if ( xTempSeek.is() )
- {
- xTempSeek->seek( 0 );
- m_xCopyInput = uno::Reference< io::XInputStream >( xTempOut, uno::UNO_QUERY );
- if ( m_xCopyInput.is() )
- m_xCopySeek = xTempSeek;
- }
+ xTempSeek->seek( 0 );
+ m_xCopyInput = uno::Reference< io::XInputStream >( xTempOut, uno::UNO_QUERY );
+ if ( m_xCopyInput.is() )
+ m_xCopySeek = xTempSeek;
}
}
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index a7780dde30b3..4cd67ef22b18 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/embed/XOptimizedStorage.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/EmbedUpdateModes.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
@@ -53,6 +54,7 @@
#include <com/sun/star/beans/IllegalTypeException.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/fileformat.h>
#include <comphelper/storagehelper.hxx>
#include <comphelper/mimeconfighelper.hxx>
@@ -132,57 +134,53 @@ uno::Reference< io::XInputStream > createTempInpStreamFromStor(
uno::Reference< io::XInputStream > xResult;
- const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) );
- uno::Reference < io::XStream > xTempStream = uno::Reference < io::XStream > (
- xFactory->createInstance ( aServiceName ),
- uno::UNO_QUERY );
- if ( xTempStream.is() )
- {
- uno::Reference < lang::XSingleServiceFactory > xStorageFactory(
- xFactory->createInstance ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" )) ),
- uno::UNO_QUERY );
+ uno::Reference < io::XStream > xTempStream( io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[0] <<= xTempStream;
- aArgs[1] <<= embed::ElementModes::READWRITE;
- uno::Reference< embed::XStorage > xTempStorage( xStorageFactory->createInstanceWithArguments( aArgs ),
- uno::UNO_QUERY );
- if ( !xTempStorage.is() )
- throw uno::RuntimeException(); // TODO:
+ uno::Reference < lang::XSingleServiceFactory > xStorageFactory(
+ xFactory->createInstance ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" )) ),
+ uno::UNO_QUERY );
- try
- {
- xStorage->copyToStorage( xTempStorage );
- } catch( const uno::Exception& e )
- {
- throw embed::StorageWrappedTargetException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Can't copy storage!" )),
- uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
- }
+ uno::Sequence< uno::Any > aArgs( 2 );
+ aArgs[0] <<= xTempStream;
+ aArgs[1] <<= embed::ElementModes::READWRITE;
+ uno::Reference< embed::XStorage > xTempStorage( xStorageFactory->createInstanceWithArguments( aArgs ),
+ uno::UNO_QUERY );
+ if ( !xTempStorage.is() )
+ throw uno::RuntimeException(); // TODO:
- try {
- uno::Reference< lang::XComponent > xComponent( xTempStorage, uno::UNO_QUERY );
- OSL_ENSURE( xComponent.is(), "Wrong storage implementation!" );
- if ( xComponent.is() )
- xComponent->dispose();
- }
- catch ( const uno::Exception& )
- {
- }
+ try
+ {
+ xStorage->copyToStorage( xTempStorage );
+ } catch( const uno::Exception& e )
+ {
+ throw embed::StorageWrappedTargetException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Can't copy storage!" )),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny( e ) );
+ }
- try {
- uno::Reference< io::XOutputStream > xTempOut = xTempStream->getOutputStream();
- if ( xTempOut.is() )
- xTempOut->closeOutput();
- }
- catch ( const uno::Exception& )
- {
- }
+ try {
+ uno::Reference< lang::XComponent > xComponent( xTempStorage, uno::UNO_QUERY );
+ OSL_ENSURE( xComponent.is(), "Wrong storage implementation!" );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ catch ( const uno::Exception& )
+ {
+ }
- xResult = xTempStream->getInputStream();
+ try {
+ uno::Reference< io::XOutputStream > xTempOut = xTempStream->getOutputStream();
+ if ( xTempOut.is() )
+ xTempOut->closeOutput();
+ }
+ catch ( const uno::Exception& )
+ {
}
+ xResult = xTempStream->getInputStream();
+
return xResult;
}
@@ -587,11 +585,11 @@ uno::Reference< io::XInputStream > OCommonEmbeddedObject::StoreDocumentToTempStr
const ::rtl::OUString& aHierarchName )
{
uno::Reference < io::XOutputStream > xTempOut(
- m_xFactory->createInstance ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" )) ),
- uno::UNO_QUERY );
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
uno::Reference< io::XInputStream > aResult( xTempOut, uno::UNO_QUERY );
- if ( !xTempOut.is() || !aResult.is() )
+ if ( !aResult.is() )
throw uno::RuntimeException(); // TODO:
uno::Reference< frame::XStorable > xStorable;
diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx
index 8893091299d2..e785aaaf33e9 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/embed/UnreachableStateException.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/awt/XRequestCallback.hpp>
@@ -1596,11 +1597,8 @@ uno::Any SAL_CALL OleComponent::getTransferData( const datatransfer::DataFlavor&
// allow to retrieve stream-representation of the object persistence
bSupportedFlavor = sal_True;
uno::Reference < io::XStream > xTempFileStream(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
- uno::UNO_QUERY );
-
- if ( !xTempFileStream.is() )
- throw uno::RuntimeException(); // TODO
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
uno::Reference< io::XOutputStream > xTempOutStream = xTempFileStream->getOutputStream();
uno::Reference< io::XInputStream > xTempInStream = xTempFileStream->getInputStream();
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index 087fb2a328d5..1a65e1a5efdb 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -38,6 +38,7 @@
#include <com/sun/star/embed/StateChangeInProgressException.hpp>
#include <com/sun/star/embed/EmbedMisc.hpp>
#include <com/sun/star/embed/XEmbedObjectCreator.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
@@ -705,8 +706,8 @@ namespace
// the solution is only active for Unix systems
#ifndef WNT
uno::Reference <beans::XPropertySet> xNativeTempFile(
- xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile"))), uno::UNO_QUERY_THROW);
+ io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW);
uno::Reference < io::XStream > xStream(xNativeTempFile, uno::UNO_QUERY_THROW);
uno::Sequence< uno::Any > aArgs( 2 );
diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx
index 2d74cb858f09..7939ad527499 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -91,11 +92,8 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang:
::rtl::OUString aResult;
uno::Reference < beans::XPropertySet > xTempFile(
- xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
- uno::UNO_QUERY );
-
- if ( !xTempFile.is() )
- throw uno::RuntimeException(); // TODO
+ io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
try {
xTempFile->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RemoveFile" )), uno::makeAny( sal_False ) );
@@ -172,7 +170,7 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang:
try
{
uno::Reference < beans::XPropertySet > xTempFile(
- xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
+ io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
uno::UNO_QUERY );
uno::Reference < io::XStream > xTempStream( xTempFile, uno::UNO_QUERY_THROW );
@@ -278,7 +276,7 @@ uno::Reference< io::XStream > OleEmbeddedObject::GetNewFilledTempStream_Impl( co
OSL_ENSURE( xInStream.is(), "Wrong parameter is provided!\n" );
uno::Reference < io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference< io::XOutputStream > xTempOutStream = xTempFile->getOutputStream();
@@ -355,7 +353,7 @@ uno::Reference< io::XStream > OleEmbeddedObject::TryToGetAcceptableFormat_Impl(
{
// this is either a bitmap or a metafile clipboard format, retrieve the pure stream
uno::Reference < io::XStream > xResult(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference < io::XSeekable > xResultSeek( xResult, uno::UNO_QUERY_THROW );
uno::Reference < io::XOutputStream > xResultOut = xResult->getOutputStream();
@@ -403,7 +401,7 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea
xCachedSeek->seek( 0 );
uno::Reference < io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference< io::XSeekable > xTempSeek( xTempFile, uno::UNO_QUERY_THROW );
diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx
index 354ff11e3ece..c5bb43ad9b11 100644
--- a/embeddedobj/source/msole/ownview.cxx
+++ b/embeddedobj/source/msole/ownview.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/embed/XClassifiedObject.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
@@ -276,7 +277,7 @@ sal_Bool OwnView_Impl::ReadContentsAndGenerateTempFile( const uno::Reference< io
// create m_aNativeTempURL
::rtl::OUString aNativeTempURL;
uno::Reference < beans::XPropertySet > xNativeTempFile(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference < io::XStream > xNativeTempStream( xNativeTempFile, uno::UNO_QUERY_THROW );
uno::Reference < io::XOutputStream > xNativeOutTemp = xNativeTempStream->getOutputStream();
diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx
index 45e863a26ab0..9e9ef8ca7f18 100644
--- a/embedserv/source/embed/ed_ipersiststr.cxx
+++ b/embedserv/source/embed/ed_ipersiststr.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
@@ -64,51 +65,46 @@ uno::Reference< io::XInputStream > createTempXInStreamFromIStream(
if ( !pStream )
return xResult;
- const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) );
- uno::Reference < io::XOutputStream > xTempOut = uno::Reference < io::XOutputStream > (
- xFactory->createInstance ( aServiceName ),
- uno::UNO_QUERY );
- if ( xTempOut.is() )
- {
- ULARGE_INTEGER nNewPos;
- LARGE_INTEGER aZero = { 0L, 0L };
- HRESULT hr = pStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
- if ( FAILED( hr ) ) return xResult;
+ uno::Reference < io::XOutputStream > xTempOut( io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
+ ULARGE_INTEGER nNewPos;
+ LARGE_INTEGER aZero = { 0L, 0L };
+ HRESULT hr = pStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
+ if ( FAILED( hr ) ) return xResult;
- STATSTG aStat;
- hr = pStream->Stat( &aStat, STATFLAG_NONAME );
- if ( FAILED( hr ) ) return xResult;
+ STATSTG aStat;
+ hr = pStream->Stat( &aStat, STATFLAG_NONAME );
+ if ( FAILED( hr ) ) return xResult;
- sal_uInt32 nSize = (sal_uInt32)aStat.cbSize.QuadPart;
- sal_uInt32 nCopied = 0;
- uno::Sequence< sal_Int8 > aBuffer( nConstBufferSize );
- try
+ sal_uInt32 nSize = (sal_uInt32)aStat.cbSize.QuadPart;
+ sal_uInt32 nCopied = 0;
+ uno::Sequence< sal_Int8 > aBuffer( nConstBufferSize );
+ try
+ {
+ sal_uInt32 nRead = 0;
+ do
{
- sal_uInt32 nRead = 0;
- do
- {
- pStream->Read( (void*)aBuffer.getArray(), nConstBufferSize, &nRead );
+ pStream->Read( (void*)aBuffer.getArray(), nConstBufferSize, &nRead );
- if ( nRead < nConstBufferSize )
- aBuffer.realloc( nRead );
+ if ( nRead < nConstBufferSize )
+ aBuffer.realloc( nRead );
- xTempOut->writeBytes( aBuffer );
- nCopied += nRead;
- } while( nRead == nConstBufferSize );
+ xTempOut->writeBytes( aBuffer );
+ nCopied += nRead;
+ } while( nRead == nConstBufferSize );
- if ( nCopied == nSize )
+ if ( nCopied == nSize )
+ {
+ uno::Reference < io::XSeekable > xTempSeek ( xTempOut, uno::UNO_QUERY );
+ if ( xTempSeek.is() )
{
- uno::Reference < io::XSeekable > xTempSeek ( xTempOut, uno::UNO_QUERY );
- if ( xTempSeek.is() )
- {
- xTempSeek->seek ( 0 );
- xResult = uno::Reference< io::XInputStream >( xTempOut, uno::UNO_QUERY );
- }
+ xTempSeek->seek ( 0 );
+ xResult = uno::Reference< io::XInputStream >( xTempOut, uno::UNO_QUERY );
}
}
- catch( const uno::Exception& )
- {
- }
+ }
+ catch( const uno::Exception& )
+ {
}
return xResult;
@@ -620,63 +616,58 @@ STDMETHODIMP EmbedDocument_Impl::Save( IStorage *pStgSave, BOOL fSameAsLoad )
HRESULT hr = E_FAIL;
- const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) );
- uno::Reference < io::XOutputStream > xTempOut = uno::Reference < io::XOutputStream > (
- m_xFactory->createInstance ( aServiceName ),
- uno::UNO_QUERY );
+ uno::Reference < io::XOutputStream > xTempOut( io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
- if ( xTempOut.is() )
+ uno::Reference< frame::XStorable > xStorable( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
+ if( xStorable.is() )
{
- uno::Reference< frame::XStorable > xStorable( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
- if( xStorable.is() )
+ try
{
- try
+ xStorable->storeToURL( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "private:stream" ) ),
+ fillArgsForStoring_Impl( xTempOut ) );
+ hr = copyXTempOutToIStream( xTempOut, pTargetStream );
+ if ( SUCCEEDED( hr ) )
{
- xStorable->storeToURL( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "private:stream" ) ),
- fillArgsForStoring_Impl( xTempOut ) );
- hr = copyXTempOutToIStream( xTempOut, pTargetStream );
+ // no need to truncate the stream, the size of the stream is always the same
+ ULARGE_INTEGER nNewPos;
+ LARGE_INTEGER aZero = { 0L, 0L };
+ hr = pNewExtStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
if ( SUCCEEDED( hr ) )
{
- // no need to truncate the stream, the size of the stream is always the same
- ULARGE_INTEGER nNewPos;
- LARGE_INTEGER aZero = { 0L, 0L };
- hr = pNewExtStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos );
+ SIZEL aSize;
+ hr = m_pDocHolder->GetExtent( &aSize );
+
if ( SUCCEEDED( hr ) )
{
- SIZEL aSize;
- hr = m_pDocHolder->GetExtent( &aSize );
+ sal_uInt32 nWritten;
+ sal_Int8 aInf[EXT_STREAM_LENGTH];
+ *((sal_Int32*)aInf) = 0;
+ *((sal_Int32*)&aInf[4]) = 0;
+ *((sal_Int32*)&aInf[8]) = aSize.cx;
+ *((sal_Int32*)&aInf[12]) = aSize.cy;
+
+ hr = pNewExtStream->Write( (void*)aInf, EXT_STREAM_LENGTH, &nWritten );
+ if ( nWritten != EXT_STREAM_LENGTH ) hr = E_FAIL;
if ( SUCCEEDED( hr ) )
{
- sal_uInt32 nWritten;
- sal_Int8 aInf[EXT_STREAM_LENGTH];
- *((sal_Int32*)aInf) = 0;
- *((sal_Int32*)&aInf[4]) = 0;
- *((sal_Int32*)&aInf[8]) = aSize.cx;
- *((sal_Int32*)&aInf[12]) = aSize.cy;
-
- hr = pNewExtStream->Write( (void*)aInf, EXT_STREAM_LENGTH, &nWritten );
- if ( nWritten != EXT_STREAM_LENGTH ) hr = E_FAIL;
-
- if ( SUCCEEDED( hr ) )
+ m_pOwnStream = CComPtr< IStream >();
+ m_pExtStream = CComPtr< IStream >();
+ if ( fSameAsLoad || pStgSave == m_pMasterStorage )
{
- m_pOwnStream = CComPtr< IStream >();
- m_pExtStream = CComPtr< IStream >();
- if ( fSameAsLoad || pStgSave == m_pMasterStorage )
- {
- uno::Reference< util::XModifiable > xMod( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
- if ( xMod.is() )
- xMod->setModified( sal_False );
- m_bIsDirty = sal_False;
- }
+ uno::Reference< util::XModifiable > xMod( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
+ if ( xMod.is() )
+ xMod->setModified( sal_False );
+ m_bIsDirty = sal_False;
}
}
}
}
}
- catch( const uno::Exception& )
- {
- }
+ }
+ catch( const uno::Exception& )
+ {
}
}
diff --git a/filter/source/xsltfilter/OleHandler.cxx b/filter/source/xsltfilter/OleHandler.cxx
index e2226c099ad0..715058ca507e 100644
--- a/filter/source/xsltfilter/OleHandler.cxx
+++ b/filter/source/xsltfilter/OleHandler.cxx
@@ -48,11 +48,13 @@
#include <package/Inflater.hxx>
#include <package/Deflater.hxx>
+#include <comphelper/componentcontext.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/servicefactory.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
@@ -70,11 +72,8 @@ using namespace ::rtl;
namespace XSLT
{
Reference<XStream> SAL_CALL OleHandler::createTempFile() {
- Reference<XStream>
- tempFile(
- m_msf->createInstance(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ))),
+ Reference<XStream> tempFile(
+ TempFile::create(comphelper::ComponentContext(m_msf).getUNOContext()),
UNO_QUERY);
OSL_ASSERT(tempFile.is());
return tempFile;
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 <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <comphelper/docpasswordhelper.hxx>
#include <comphelper/mediadescriptor.hxx>
@@ -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 <com/sun/star/io/XTempFile.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include "oox/drawingml/graphicshapecontext.hxx"
#include <osl/diagnose.h>
@@ -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 <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
@@ -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() )
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 25e66390754d..ce8b36e2382b 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
@@ -236,11 +237,8 @@ const sal_Int32 n_ConstBufferSize = 32000;
::rtl::OUString aTempURL;
uno::Reference < beans::XPropertySet > xTempFile(
- xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile") ) ),
- uno::UNO_QUERY );
-
- if ( !xTempFile.is() )
- throw uno::RuntimeException(); // TODO
+ io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
try {
xTempFile->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveFile") ), uno::makeAny( sal_False ) );
@@ -1513,7 +1511,7 @@ void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io:
uno::Reference < io::XStream > xTempFile;
if ( !xTargetStream.is() )
xTempFile = uno::Reference < io::XStream >(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile") ) ),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY );
else
xTempFile = xTargetStream;
diff --git a/package/source/xstor/switchpersistencestream.cxx b/package/source/xstor/switchpersistencestream.cxx
index 41f43f51ec56..359a65a0ac40 100644
--- a/package/source/xstor/switchpersistencestream.cxx
+++ b/package/source/xstor/switchpersistencestream.cxx
@@ -19,6 +19,8 @@
#include <osl/diagnose.h>
+#include <com/sun/star/io/TempFile.hpp>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/storagehelper.hxx>
#include <switchpersistencestream.hxx>
@@ -174,7 +176,7 @@ void SwitchablePersistenceStream::CopyAndSwitchPersistenceTo( const uno::Referen
if ( !xTargetStream.is() )
{
xTargetStream = uno::Reference < io::XStream >(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile") ) ),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
xTargetSeek = uno::Reference< io::XSeekable >( xTargetStream, uno::UNO_QUERY_THROW );
diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx
index 8012c82072d5..302334646d25 100644
--- a/package/source/xstor/xfactory.cxx
+++ b/package/source/xstor/xfactory.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <comphelper/componentcontext.hxx>
@@ -84,11 +85,8 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstance()
{
// TODO: reimplement TempStream service to support XStream interface
uno::Reference < io::XStream > xTempStream(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile") ) ),
- uno::UNO_QUERY );
-
- if ( !xTempStream.is() )
- throw uno::RuntimeException(); // TODO:
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
return uno::Reference< uno::XInterface >(
static_cast< OWeakObject* >( new OStorage( xTempStream,
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index d8fade3b2912..9900cbc4dcad 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/embed/UseBackupException.hpp>
#include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/ucb/XProgressHandler.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
@@ -144,7 +145,7 @@ uno::Reference< io::XInputStream > GetSeekableTempCopy( uno::Reference< io::XInp
uno::Reference< lang::XMultiServiceFactory > xFactory )
{
uno::Reference < io::XOutputStream > xTempOut(
- xFactory->createInstance ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ),
+ io::TempFile::create(comphelper::ComponentContext(xFactory).getUNOContext()),
uno::UNO_QUERY );
uno::Reference < io::XInputStream > xTempIn( xTempOut, uno::UNO_QUERY );
@@ -3800,8 +3801,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getPlainRawStreamElement(
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
uno::Reference < io::XOutputStream > xTempOut(
- m_pImpl->GetServiceFactory()->createInstance (
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ),
+ io::TempFile::create(comphelper::ComponentContext(m_pImpl->GetServiceFactory()).getUNOContext()),
uno::UNO_QUERY );
xTempIn = uno::Reference < io::XInputStream >( xTempOut, uno::UNO_QUERY );
uno::Reference < io::XSeekable > xSeek( xTempOut, uno::UNO_QUERY );
@@ -3913,8 +3913,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement(
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
uno::Reference < io::XOutputStream > xTempOut(
- m_pImpl->GetServiceFactory()->createInstance (
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ) ),
+ io::TempFile::create(comphelper::ComponentContext(m_pImpl->GetServiceFactory()).getUNOContext()),
uno::UNO_QUERY );
xTempIn = uno::Reference < io::XInputStream >( xTempOut, uno::UNO_QUERY );
uno::Reference < io::XSeekable > xSeek( xTempOut, uno::UNO_QUERY );
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index e6abbea5b4ee..bc941a61b7f3 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/packages/zip/ZipConstants.hpp>
#include <com/sun/star/packages/manifest/XManifestReader.hpp>
#include <com/sun/star/packages/manifest/XManifestWriter.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
@@ -1177,7 +1178,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
if( bUseTemp )
{
// create temporary file
- uno::Reference < io::XStream > xTempFile( m_xFactory->createInstance ("com.sun.star.io.TempFile"), UNO_QUERY_THROW );
+ uno::Reference < io::XStream > xTempFile( io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()), UNO_QUERY_THROW );
xTempOut.set( xTempFile->getOutputStream(), UNO_SET_THROW );
xTempIn.set( xTempFile->getInputStream(), UNO_SET_THROW );
}
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index a8029ff9ec72..5c7feb7645ca 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/packages/zip/ZipConstants.hpp>
#include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
@@ -37,6 +38,7 @@
#include <osl/diagnose.h>
#include "wrapstreamforshare.hxx"
+#include <comphelper/componentcontext.hxx>
#include <comphelper/seekableinput.hxx>
#include <comphelper/storagehelper.hxx>
@@ -175,12 +177,10 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop
// create temporary stream
uno::Reference < io::XOutputStream > xTempOut(
- m_xFactory->createInstance("com.sun.star.io.TempFile"),
- uno::UNO_QUERY );
- uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY );
- uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY );
- if ( !xTempOut.is() || !xTempIn.is() || !xTempSeek.is() )
- throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
+ uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY_THROW );
+ uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY_THROW );
// copy the raw stream to the temporary file starting from the current position
::comphelper::OStorageHelper::CopyInputToOutput( GetOwnSeekStream(), xTempOut );
@@ -282,10 +282,8 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream(
{
// create temporary file
uno::Reference < io::XStream > xTempStream(
- m_xFactory->createInstance ("com.sun.star.io.TempFile"),
- uno::UNO_QUERY );
- if ( !xTempStream.is() )
- throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
// create a package based on it
ZipPackage* pPackage = new ZipPackage( m_xFactory );
@@ -341,12 +339,10 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream(
// create another temporary file
uno::Reference < io::XOutputStream > xTempOut(
- m_xFactory->createInstance ("com.sun.star.io.TempFile"),
- uno::UNO_QUERY );
- uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY );
- uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY );
- if ( !xTempOut.is() || !xTempIn.is() || !xTempSeek.is() )
- throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
+ uno::UNO_QUERY_THROW );
+ uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY_THROW );
+ uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY_THROW );
// copy the raw stream to the temporary file
::comphelper::OStorageHelper::CopyInputToOutput( xInRaw, xTempOut );
diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx
index b0d4eb61d065..7af39bd9dc75 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -18,6 +18,7 @@
*/
#include "stringresource.hxx"
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XTextInputStream.hpp>
#include <com/sun/star/io/XTextOutputStream.hpp>
#include <com/sun/star/io/XActiveDataSink.hpp>
@@ -1301,10 +1302,8 @@ BinaryOutput::BinaryOutput( Reference< XMultiComponentFactory > xMCF,
: m_xMCF( xMCF )
, m_xContext( xContext )
{
- m_xTempFile = m_xMCF->createInstanceWithContext
- ( ::rtl::OUString("com.sun.star.io.TempFile"), m_xContext );
- if( m_xTempFile.is() )
- m_xOutputStream = Reference< io::XOutputStream >( m_xTempFile, UNO_QUERY );
+ m_xTempFile = io::TempFile::create( m_xContext );
+ m_xOutputStream = Reference< io::XOutputStream >( m_xTempFile, UNO_QUERY_THROW );
}
template< class T >
@@ -1529,19 +1528,15 @@ Reference< io::XInputStream > BinaryInput::getInputStreamForSection( sal_Int32 n
Reference< io::XInputStream > xIn;
if( m_nCurPos + nSize <= m_nSize )
{
- Reference< io::XOutputStream > xTempOut( m_xMCF->createInstanceWithContext
- ( ::rtl::OUString("com.sun.star.io.TempFile"), m_xContext ), UNO_QUERY );
- if( xTempOut.is() )
- {
- Sequence< sal_Int8 > aSection( m_pData + m_nCurPos, nSize );
- xTempOut->writeBytes( aSection );
+ Reference< io::XOutputStream > xTempOut( io::TempFile::create(m_xContext), UNO_QUERY_THROW );
+ Sequence< sal_Int8 > aSection( m_pData + m_nCurPos, nSize );
+ xTempOut->writeBytes( aSection );
- Reference< io::XSeekable> xSeekable( xTempOut, UNO_QUERY );
- if( xSeekable.is() )
- xSeekable->seek( 0 );
+ Reference< io::XSeekable> xSeekable( xTempOut, UNO_QUERY );
+ if( xSeekable.is() )
+ xSeekable->seek( 0 );
- xIn = Reference< io::XInputStream>( xTempOut, UNO_QUERY );
- }
+ xIn = Reference< io::XInputStream>( xTempOut, UNO_QUERY );
}
else
OSL_FAIL( "BinaryInput::getInputStreamForSection(): Read past end" );
diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx
index 95b35ff0d887..bc404562f05b 100644
--- a/sdext/source/minimizer/impoptimizer.cxx
+++ b/sdext/source/minimizer/impoptimizer.cxx
@@ -67,6 +67,7 @@
#include <com/sun/star/graphic/GraphicType.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
@@ -350,7 +351,7 @@ Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentContext >&
}
if ( bNeedsOptimizing && aDestSizePixel.Width && aDestSizePixel.Height )
{
- Reference< XStream > xTempFile( rxMSF->getServiceManager()->createInstanceWithContext( OUString("com.sun.star.io.TempFile"), rxMSF ), UNO_QUERY_THROW );
+ Reference< XStream > xTempFile( io::TempFile::create(rxMSF), UNO_QUERY_THROW );
Reference< XOutputStream > xOutputStream( xTempFile->getOutputStream() );
Reference< XGraphicProvider > xGraphicProvider( GraphicProvider::create( rxMSF ) );
@@ -370,7 +371,7 @@ Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentContext >&
else // this is a metafile
{
rtl::OUString aDestMimeType( aSourceMimeType );
- Reference< XStream > xTempFile( rxMSF->getServiceManager()->createInstanceWithContext( OUString("com.sun.star.io.TempFile"), rxMSF ), UNO_QUERY_THROW );
+ Reference< XStream > xTempFile( io::TempFile::create(rxMSF), UNO_QUERY_THROW );
Reference< XOutputStream > xOutputStream( xTempFile->getOutputStream() );
Reference< XGraphicProvider > xGraphicProvider( GraphicProvider::create( rxMSF ) );
ImpCompressGraphic( xGraphicProvider, xGraphic, xOutputStream, aDestMimeType, aLogicalSize, rGraphicSettings.mnJPEGQuality, rGraphicSettings.mnImageResolution, sal_False, aGraphicCropLogic );
diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx
index b09f1ab90d5c..c56b254400a0 100644
--- a/sdext/source/minimizer/informationdialog.cxx
+++ b/sdext/source/minimizer/informationdialog.cxx
@@ -29,15 +29,16 @@
#include "informationdialog.hxx"
#include "optimizationstats.hxx"
-#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/graphic/GraphicProvider.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
-#include <rtl/ustrbuf.hxx>
-#include <sal/macros.h>
+#include <com/sun/star/io/TempFile.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include "com/sun/star/util/URL.hpp"
#include "com/sun/star/util/URLTransformer.hpp"
#include "com/sun/star/util/XURLTransformer.hpp"
+#include <rtl/ustrbuf.hxx>
+#include <sal/macros.h>
#define DIALOG_WIDTH 240
#define DIALOG_HEIGHT 80
@@ -215,7 +216,7 @@ OUString InformationDialog::ImpGetStandardImage( const OUString& sPrivateURL )
rtl::OUString sURL;
try
{
- mxTempFile = Reference< XStream >( mxMSF->getServiceManager()->createInstanceWithContext( OUString("com.sun.star.io.TempFile"), mxMSF ), UNO_QUERY_THROW );
+ mxTempFile = Reference< XStream >( io::TempFile::create(mxMSF), UNO_QUERY_THROW );
Reference< XPropertySet > xPropSet( mxTempFile, UNO_QUERY );
Reference< XOutputStream > xOutputStream( mxTempFile->getOutputStream() );
if ( xOutputStream.is() && xPropSet.is() )
diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx
index 8bfee3b51fde..8cbcd36da601 100644
--- a/sdext/source/pdfimport/filterdet.cxx
+++ b/sdext/source/pdfimport/filterdet.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <boost/scoped_ptr.hpp>
@@ -214,9 +215,7 @@ FileEmitContext::FileEmitContext( const rtl::OUString&
m_xOut()
{
m_xContextStream = uno::Reference< io::XStream >(
- xContext->getServiceManager()->createInstanceWithContext(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) ),
- xContext ), uno::UNO_QUERY_THROW );
+ io::TempFile::create(xContext), uno::UNO_QUERY_THROW );
m_xOut = m_xContextStream->getOutputStream();
m_xSeek = uno::Reference<io::XSeekable>(m_xOut, uno::UNO_QUERY_THROW );
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index d3680ebac99e..0e8ca95d142a 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/document/XTypeDetection.hpp>
#include <com/sun/star/document/XStandaloneDocumentInfo.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/ucb/NameClash.hpp>
@@ -1409,7 +1410,7 @@ sal_Bool SfxDocTplService_Impl::WriteUINamesForTemplateDir_Impl( const ::rtl::OU
sal_Bool bResult = sal_False;
try {
uno::Reference< beans::XPropertySet > xTempFile(
- mxFactory->createInstance( ::rtl::OUString("com.sun.star.io.TempFile") ),
+ io::TempFile::create(comphelper::ComponentContext(mxFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
::rtl::OUString aTempURL;
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx
index bd845c49552c..a1a93ae5f3d5 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -22,8 +22,10 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XTruncate.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <comphelper/storagehelper.hxx>
+#include <comphelper/componentcontext.hxx>
#include <unotools/ucbstreamhelper.hxx>
@@ -256,7 +258,7 @@ void SAL_CALL OLESimpleStorage::initialize( const uno::Sequence< uno::Any >& aAr
else
{
uno::Reference < io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString("com.sun.star.io.TempFile") ),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference < io::XSeekable > xTempSeek( xTempFile, uno::UNO_QUERY_THROW );
uno::Reference< io::XOutputStream > xTempOut = xTempFile->getOutputStream();
@@ -441,7 +443,7 @@ uno::Any SAL_CALL OLESimpleStorage::getByName( const ::rtl::OUString& aName )
uno::Any aResult;
uno::Reference< io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString("com.sun.star.io.TempFile") ),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY );
uno::Reference< io::XSeekable > xSeekable( xTempFile, uno::UNO_QUERY_THROW );
uno::Reference< io::XOutputStream > xOutputStream = xTempFile->getOutputStream();
diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index 2272e72a62b4..03ad05bdfba8 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/io/XTruncate.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -685,7 +686,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::cloneStreamElement( const ::rt
uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
xTempResult = uno::Reference < io::XStream >(
- m_pImpl->m_xFactory->createInstance ( ::rtl::OUString("com.sun.star.io.TempFile") ),
+ io::TempFile::create(comphelper::ComponentContext(m_pImpl->m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference < io::XOutputStream > xTempOut = xTempResult->getOutputStream();
uno::Reference < io::XInputStream > xTempIn = xTempResult->getInputStream();
diff --git a/svl/source/misc/documentlockfile.cxx b/svl/source/misc/documentlockfile.cxx
index 3c77b261b929..17d9e7ca239e 100644
--- a/svl/source/misc/documentlockfile.cxx
+++ b/svl/source/misc/documentlockfile.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
#include <com/sun/star/ucb/NameClashException.hpp>
#include <com/sun/star/io/WrongFormatException.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <osl/time.h>
#include <osl/security.hxx>
@@ -36,6 +37,7 @@
#include <rtl/ustrbuf.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
#include <unotools/bootstrap.hxx>
@@ -91,7 +93,7 @@ sal_Bool DocumentLockFile::CreateOwnLockFile()
try
{
uno::Reference< io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString("com.sun.star.io.TempFile") ),
+ io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()),
uno::UNO_QUERY_THROW );
uno::Reference< io::XSeekable > xSeekable( xTempFile, uno::UNO_QUERY_THROW );
diff --git a/ucb/Library_ucpgvfs1.mk b/ucb/Library_ucpgvfs1.mk
index 213c7fc789de..577b65d6eec1 100644
--- a/ucb/Library_ucpgvfs1.mk
+++ b/ucb/Library_ucpgvfs1.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_Library_add_libs,ucpgvfs1,\
))
$(eval $(call gb_Library_use_libraries,ucpgvfs1,\
+ comphelper \
cppu \
cppuhelper \
sal \
diff --git a/ucb/source/ucp/gvfs/gvfs_content.cxx b/ucb/source/ucp/gvfs/gvfs_content.cxx
index fd51030dbfc5..037a8379db09 100644
--- a/ucb/source/ucp/gvfs/gvfs_content.cxx
+++ b/ucb/source/ucp/gvfs/gvfs_content.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/beans/PropertySetInfoChangeEvent.hpp>
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/lang/IllegalAccessException.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
@@ -68,6 +69,7 @@
#include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
#include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
#include <com/sun/star/ucb/NameClashException.hpp>
+#include <comphelper/componentcontext.hxx>
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/propertyvalueset.hxx>
#include <ucbhelper/interactionrequest.hxx>
@@ -1444,12 +1446,11 @@ Content::createTempStream(
GnomeVFSHandle *handle = NULL;
::rtl::OString aURI = getOURI();
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
// Something badly wrong happened - can't seek => stream to a temporary file
- const rtl::OUString sServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) );
uno::Reference < io::XOutputStream > xTempOut =
uno::Reference < io::XOutputStream >
- ( m_xSMgr->createInstance( sServiceName ), uno::UNO_QUERY );
+ ( io::TempFile::create(comphelper::ComponentContext(m_xSMgr).getUNOContext()), uno::UNO_QUERY );
if ( !xTempOut.is() )
cancelCommandExecution( GNOME_VFS_ERROR_IO, xEnv );
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx
index 103adee9204d..037d16bbe811 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
#include <com/sun/star/ucb/InteractiveIOException.hpp>
#include <com/sun/star/io/XActiveDataStreamer.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/ucb/DocumentHeaderField.hpp>
#include <com/sun/star/ucb/XCommandInfo.hpp>
#include <com/sun/star/ucb/XCommandProcessor.hpp>
@@ -1322,17 +1323,12 @@ sal_Bool UcbLockBytes::setInputStream_Impl( const Reference<XInputStream> &rxInp
m_xSeekable = Reference < XSeekable > ( rxInputStream, UNO_QUERY );
if( !m_xSeekable.is() && rxInputStream.is() )
{
- Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
- Reference< XOutputStream > rxTempOut = Reference < XOutputStream > (
- xFactory->createInstance ( ::rtl::OUString("com.sun.star.io.TempFile") ),
- UNO_QUERY );
+ Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+ Reference< XOutputStream > rxTempOut = Reference < XOutputStream > ( TempFile::create(xContext), UNO_QUERY_THROW );
- if( rxTempOut.is() )
- {
- ::comphelper::OStorageHelper::CopyInputToOutput( rxInputStream, rxTempOut );
- m_xInputStream = Reference< XInputStream >( rxTempOut, UNO_QUERY );
- m_xSeekable = Reference < XSeekable > ( rxTempOut, UNO_QUERY );
- }
+ ::comphelper::OStorageHelper::CopyInputToOutput( rxInputStream, rxTempOut );
+ m_xInputStream = Reference< XInputStream >( rxTempOut, UNO_QUERY );
+ m_xSeekable = Reference < XSeekable > ( rxTempOut, UNO_QUERY );
}
}
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index e7e4cb26524a..b98a59035c8f 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XTruncate.hpp>
+#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/lang/XComponent.hpp>
@@ -773,10 +774,7 @@ SignatureStreamHelper DigitalSignaturesDialog::ImplOpenSignatureStream(
if (nStreamOpenMode & css::embed::ElementModes::TRUNCATE)
{
//We write always into a new temporary stream.
- mxTempSignatureStream = Reference < css::io::XStream >(
- mxCtx->getServiceManager()->createInstanceWithContext(
- OUSTR( "com.sun.star.io.TempFile" ), mxCtx) ,
- UNO_QUERY_THROW);
+ mxTempSignatureStream = Reference < css::io::XStream >(css::io::TempFile::create(mxCtx), UNO_QUERY_THROW);
aHelper.xSignatureStream = mxTempSignatureStream;
}
else