From fcd990f208be4430157dca2d6093337f21cb079b Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 23 Aug 2012 08:33:10 +0200 Subject: Some clean up after previous commit Change-Id: Ie419c769c5d661d51c1b43b9808791dcf9e1725c --- comphelper/inc/comphelper/storagehelper.hxx | 21 +++++++++++++-------- comphelper/source/misc/storagehelper.cxx | 18 ++++-------------- 2 files changed, 17 insertions(+), 22 deletions(-) (limited to 'comphelper') diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx index f255dc842fb5..f26f997cc2f3 100644 --- a/comphelper/inc/comphelper/storagehelper.hxx +++ b/comphelper/inc/comphelper/storagehelper.hxx @@ -24,13 +24,7 @@ #include #include #include -#include -#include #include -#include -#include -#include -#include #include "comphelper/comphelperdllapi.h" @@ -42,6 +36,18 @@ #define PACKAGE_ENCRYPTIONDATA_SHA1UTF8 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA1UTF8EncryptionKey" ) ) #define PACKAGE_ENCRYPTIONDATA_SHA1MS1252 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA1MS1252EncryptionKey" ) ) +namespace com { namespace sun { namespace star { + namespace beans { struct NamedValue; } + namespace embed { class XStorage; } + namespace io { + class XInputStream; + class XOutputStream; + class XStream; + } + namespace lang { class XSingleServiceFactory; } + namespace uno { class XComponentContext; } +} } } + namespace comphelper { // Unfortunately - the impl.s of XStorage like to invalidate all @@ -123,8 +129,7 @@ public: static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetInputStreamFromURL( const ::rtl::OUString& aURL, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& context ) throw ( ::com::sun::star::uno::Exception ); static void SetCommonStorageEncryptionData( diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index ebe8c4146459..785d4b26dea2 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -19,8 +19,9 @@ #include #include +#include #include -#include +#include #include #include #include @@ -35,7 +36,6 @@ #include -#include #include #include #include @@ -224,20 +224,10 @@ void OStorageHelper::CopyInputToOutput( // ---------------------------------------------------------------------- uno::Reference< io::XInputStream > OStorageHelper::GetInputStreamFromURL( const ::rtl::OUString& aURL, - const uno::Reference< lang::XMultiServiceFactory >& xSF ) + const uno::Reference< uno::XComponentContext >& context ) throw ( uno::Exception ) { - uno::Reference< lang::XMultiServiceFactory > xFactory = xSF.is() ? xSF : ::comphelper::getProcessServiceFactory(); - if ( !xFactory.is() ) - throw uno::RuntimeException(); - - uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess( - ucb::SimpleFileAccess::create(comphelper::ComponentContext(xFactory).getUNOContext()) ); - - if ( !xTempAccess.is() ) - throw uno::RuntimeException(); - - uno::Reference< io::XInputStream > xInputStream = xTempAccess->openFileRead( aURL ); + uno::Reference< io::XInputStream > xInputStream = ucb::SimpleFileAccess::create(context)->openFileRead( aURL ); if ( !xInputStream.is() ) throw uno::RuntimeException(); -- cgit