diff options
Diffstat (limited to 'embeddedobj/source/msole/olepersist.cxx')
-rw-r--r-- | embeddedobj/source/msole/olepersist.cxx | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx index efb51d39ff33..7765043af0c5 100644 --- a/embeddedobj/source/msole/olepersist.cxx +++ b/embeddedobj/source/msole/olepersist.cxx @@ -43,10 +43,12 @@ #include <com/sun/star/io/XSeekable.hpp> #include <com/sun/star/io/XTruncate.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/ucb/SimpleFileAccess.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess2.hpp> #include <rtl/logfile.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/mimeconfighelper.hxx> #include <comphelper/classids.hxx> @@ -68,16 +70,11 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang: try { - uno::Reference < ucb::XSimpleFileAccess > xAccess( - xFactory->createInstance ( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )), - uno::UNO_QUERY ); + uno::Reference < ucb::XSimpleFileAccess2 > xAccess( + ucb::SimpleFileAccess::create( comphelper::ComponentContext(xFactory).getUNOContext() ) ); - if ( xAccess.is() ) - { - xAccess->kill( aURL ); - bRet = sal_True; - } + xAccess->kill( aURL ); + bRet = sal_True; } catch( const uno::Exception& ) { @@ -128,13 +125,8 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang: if ( !aResult.isEmpty() ) { try { - uno::Reference < ucb::XSimpleFileAccess > xTempAccess( - xFactory->createInstance ( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )), - uno::UNO_QUERY ); - - if ( !xTempAccess.is() ) - throw uno::RuntimeException(); // TODO: + uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess( + ucb::SimpleFileAccess::create( comphelper::ComponentContext(xFactory).getUNOContext() ) ); uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( aResult ); if ( xTempOutStream.is() ) @@ -596,13 +588,8 @@ sal_Bool OleEmbeddedObject::HasVisReplInStream() try { // open temporary file for reading - uno::Reference < ucb::XSimpleFileAccess > xTempAccess( - m_xFactory->createInstance ( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )), - uno::UNO_QUERY ); - - if ( !xTempAccess.is() ) - throw uno::RuntimeException(); // TODO: + uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess( + ucb::SimpleFileAccess::create( comphelper::ComponentContext(m_xFactory).getUNOContext() ) ); xStream = xTempAccess->openFileRead( m_aTempURL ); } @@ -1068,12 +1055,7 @@ void OleEmbeddedObject::StoreObjectToStream( uno::Reference< io::XOutputStream > // open temporary file for reading uno::Reference < ucb::XSimpleFileAccess > xTempAccess( - m_xFactory->createInstance ( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )), - uno::UNO_QUERY ); - - if ( !xTempAccess.is() ) - throw uno::RuntimeException(); // TODO: + ucb::SimpleFileAccess::create( comphelper::ComponentContext(m_xFactory).getUNOContext() ) ); uno::Reference< io::XInputStream > xTempInStream = xTempAccess->openFileRead( m_aTempURL ); OSL_ENSURE( xTempInStream.is(), "The object's temporary file can not be reopened for reading!\n" ); |