diff options
author | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2016-08-06 17:30:31 +0200 |
---|---|---|
committer | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2016-08-08 10:55:49 +0000 |
commit | f60eaab748add19683e66c7e4bc073c9ce7887f7 (patch) | |
tree | 3dc22884c71aa237bf1e3b2d28a1d9bb10dc45c7 /unotools | |
parent | 0bab74d6357c6438cfb38d56dd8f75217af6bd2a (diff) |
Related: tdf#99312, add specialized interaction handler
Needed to manage https certificates and authentication whenever
needed.
Change-Id: If20b85a9b349b203a8c46d453afa823629d114cb
Reviewed-on: https://gerrit.libreoffice.org/27927
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/ucbhelper/ucbstreamhelper.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/unotools/source/ucbhelper/ucbstreamhelper.cxx b/unotools/source/ucbhelper/ucbstreamhelper.cxx index 51d4f65ef1e7..133fa28e3c4f 100644 --- a/unotools/source/ucbhelper/ucbstreamhelper.cxx +++ b/unotools/source/ucbhelper/ucbstreamhelper.cxx @@ -20,12 +20,14 @@ #include <rtl/ustring.hxx> #include <unotools/ucbstreamhelper.hxx> #include <comphelper/processfactory.hxx> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/CommandAbortedException.hpp> #include <com/sun/star/ucb/UniversalContentBroker.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/ucb/InsertCommandArgument.hpp> #include <com/sun/star/io/XActiveDataStreamer.hpp> +#include <comphelper/simplefileaccessinteraction.hxx> #include <ucbhelper/content.hxx> #include <unotools/streamwrap.hxx> #include <ucblockbytes.hxx> @@ -140,7 +142,14 @@ static SvStream* lcl_CreateStream( const OUString& rFileName, StreamMode eOpenMo SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode ) { - return lcl_CreateStream( rFileName, eOpenMode, Reference < XInteractionHandler >(), true /* bEnsureFileExists */ ); + // related tdf#99312 + // create a specialized interaction handler to manages Web certificates and Web credentials when needed + Reference< XInteractionHandler > xIH( + css::task::InteractionHandler::createWithParent( comphelper::getProcessComponentContext(), nullptr ) ); + Reference < XInteractionHandler > xIHScoped( static_cast< XInteractionHandler *> ( + new comphelper::SimpleFileAccessInteraction( xIH ) ) ); + + return lcl_CreateStream( rFileName, eOpenMode, xIHScoped, true /* bEnsureFileExists */ ); } SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode, @@ -152,7 +161,13 @@ SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode e SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode, bool bFileExists ) { - return lcl_CreateStream( rFileName, eOpenMode, Reference < XInteractionHandler >(), !bFileExists ); + // related tdf#99312 + // create a specialized interaction handler to manages Web certificates and Web credentials when needed + Reference< XInteractionHandler > xIH( + css::task::InteractionHandler::createWithParent( comphelper::getProcessComponentContext(), nullptr ) ); + Reference < XInteractionHandler > xIHScoped( static_cast< XInteractionHandler *> ( + new comphelper::SimpleFileAccessInteraction( xIH ) ) ); + return lcl_CreateStream( rFileName, eOpenMode, xIHScoped,!bFileExists ); } SvStream* UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream ) |