diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-29 17:17:28 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-06-06 10:01:22 +0200 |
commit | d08578912f2c9ef42d4349079422e25b951e544e (patch) | |
tree | d029b5a9110bcdc255e72ef9c98887f3f8521ea6 /embeddedobj | |
parent | 7d2a5b5114987f1ab415e32ebb5bb9a46b98dc17 (diff) |
fdo#46808, Adapt UNO services to new style, Part 7, updating ::create
Update calls to factories to use new SimpleFileAccess::create method
Change-Id: Ie5b0696fe2228a9033b19969245a53c21a61aa14
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, added some tweaks.
Diffstat (limited to 'embeddedobj')
-rw-r--r-- | embeddedobj/source/msole/oleembed.cxx | 10 | ||||
-rw-r--r-- | embeddedobj/source/msole/olepersist.cxx | 42 | ||||
-rw-r--r-- | embeddedobj/source/msole/ownview.cxx | 10 |
3 files changed, 22 insertions, 40 deletions
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index b44d789cbc77..087fb2a328d5 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -44,13 +44,15 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/document/XStorageBasedDocument.hpp> -#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/ucb/SimpleFileAccess.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess2.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/system/XSystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <rtl/logfile.hxx> +#include <comphelper/componentcontext.hxx> #include <cppuhelper/interfacecontainer.h> #include <comphelper/mimeconfighelper.hxx> #include <comphelper/storagehelper.hxx> @@ -736,10 +738,8 @@ namespace xNativeTempFile = uno::Reference<beans::XPropertySet>(); - uno::Reference<ucb::XSimpleFileAccess> xSimpleFileAccess( - xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - uno::UNO_QUERY_THROW); + uno::Reference < ucb::XSimpleFileAccess2 > xSimpleFileAccess( + ucb::SimpleFileAccess::create( comphelper::ComponentContext(xFactory).getUNOContext() ) ); xSimpleFileAccess->setReadOnly(sUrl, sal_True); } 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" ); diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx index 063bb0d5a572..354ff11e3ece 100644 --- a/embeddedobj/source/msole/ownview.cxx +++ b/embeddedobj/source/msole/ownview.cxx @@ -36,7 +36,8 @@ #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XSeekable.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> -#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/ucb/SimpleFileAccess.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess2.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -45,6 +46,7 @@ #include <com/sun/star/document/XTypeDetection.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <cppuhelper/implbase1.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/mimeconfighelper.hxx> @@ -420,10 +422,8 @@ void OwnView_Impl::CreateNative() try { - uno::Reference < ucb::XSimpleFileAccess > xAccess( - m_xFactory->createInstance ( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )), - uno::UNO_QUERY_THROW ); + uno::Reference < ucb::XSimpleFileAccess2 > xAccess( + ucb::SimpleFileAccess::create( comphelper::ComponentContext(m_xFactory).getUNOContext() ) ); uno::Reference< io::XInputStream > xInStream = xAccess->openFileRead( m_aTempFileURL ); if ( !xInStream.is() ) |