summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-08-23 17:23:26 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-08-27 15:40:08 +0200
commit206c70eef30f7b6f538b88f7fb9505f397bef073 (patch)
treed311561f2eb90b57aeed5c1642882a90ddbd4c6a /scripting
parent7634d064adc2c773288cec751674ff691de20b2b (diff)
fdo#46808, Adapt TempFile UNO service to new style
Change-Id: Ia448d6d74201e2be487c6d8317f94be3745808aa
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/stringresource/stringresource.cxx25
1 files changed, 10 insertions, 15 deletions
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" );