summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comphelper/source/misc/simplefileaccessinteraction.cxx12
-rw-r--r--comphelper/source/misc/stillreadwriteinteraction.cxx61
-rw-r--r--include/comphelper/stillreadwriteinteraction.hxx6
-rw-r--r--include/ucbhelper/interceptedinteraction.hxx34
-rw-r--r--ucbhelper/source/client/interceptedinteraction.cxx8
-rw-r--r--unotools/source/misc/mediadescriptor.cxx1
6 files changed, 73 insertions, 49 deletions
diff --git a/comphelper/source/misc/simplefileaccessinteraction.cxx b/comphelper/source/misc/simplefileaccessinteraction.cxx
index 15029a1230e0..8cd77af7d693 100644
--- a/comphelper/source/misc/simplefileaccessinteraction.cxx
+++ b/comphelper/source/misc/simplefileaccessinteraction.cxx
@@ -29,9 +29,10 @@ const sal_Int32 HANDLE_CERTIFICATEREQUEST = 3;
/// Will handle com::sun::star::ucb::AuthenticationRequest
const sal_Int32 HANDLE_AUTHENTICATIONREQUEST = 4;
-static std::span<const ::ucbhelper::InterceptedInteraction::InterceptedRequest> getInterceptions()
+SimpleFileAccessInteraction::SimpleFileAccessInteraction(
+ const css::uno::Reference<css::task::XInteractionHandler>& xHandler)
{
- static const ::ucbhelper::InterceptedInteraction::InterceptedRequest lInterceptions[]{
+ std::vector<::ucbhelper::InterceptedInteraction::InterceptedRequest> lInterceptions{
{ //intercept standard IO error exception (local file and WebDAV)
css::uno::Any(css::ucb::InteractiveIOException()),
cppu::UnoType<css::task::XInteractionAbort>::get(), HANDLE_INTERACTIVEIOEXCEPTION },
@@ -51,14 +52,9 @@ static std::span<const ::ucbhelper::InterceptedInteraction::InterceptedRequest>
css::uno::Any(css::ucb::AuthenticationRequest()),
cppu::UnoType<css::task::XInteractionApprove>::get(), HANDLE_AUTHENTICATIONREQUEST }
};
- return lInterceptions;
-}
-SimpleFileAccessInteraction::SimpleFileAccessInteraction(
- const css::uno::Reference<css::task::XInteractionHandler>& xHandler)
- : InterceptedInteraction(getInterceptions())
-{
setInterceptedHandler(xHandler);
+ setInterceptions(std::move(lInterceptions));
}
SimpleFileAccessInteraction::~SimpleFileAccessInteraction() {}
diff --git a/comphelper/source/misc/stillreadwriteinteraction.cxx b/comphelper/source/misc/stillreadwriteinteraction.cxx
index 191b751f978d..88bc25bc46cb 100644
--- a/comphelper/source/misc/stillreadwriteinteraction.cxx
+++ b/comphelper/source/misc/stillreadwriteinteraction.cxx
@@ -34,42 +34,43 @@
namespace comphelper{
-const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0;
-const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1;
-const sal_Int32 HANDLE_AUTHENTICATIONREQUESTEXCEPTION = 2;
-const sal_Int32 HANDLE_CERTIFICATEVALIDATIONREQUESTEXCEPTION = 3;
-
-static std::span<const ::ucbhelper::InterceptedInteraction::InterceptedRequest> getInterceptions()
-{
- static const ::ucbhelper::InterceptedInteraction::InterceptedRequest lInterceptions[] {
- {
- css::uno::Any(css::ucb::InteractiveIOException()),
- cppu::UnoType<css::task::XInteractionAbort>::get(), HANDLE_INTERACTIVEIOEXCEPTION
- },
- {
- css::uno::Any(css::ucb::UnsupportedDataSinkException()),
- cppu::UnoType<css::task::XInteractionAbort>::get(), HANDLE_UNSUPPORTEDDATASINKEXCEPTION
- },
- {
- css::uno::Any(css::ucb::AuthenticationRequest()),
- cppu::UnoType<css::task::XInteractionApprove>::get(), HANDLE_AUTHENTICATIONREQUESTEXCEPTION
- },
- {
- css::uno::Any(css::ucb::CertificateValidationRequest()),
- cppu::UnoType<css::task::XInteractionApprove>::get(), HANDLE_CERTIFICATEVALIDATIONREQUESTEXCEPTION
- },
- };
- return lInterceptions;
-}
-
StillReadWriteInteraction::StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler,
css::uno::Reference< css::task::XInteractionHandler > xAuxiliaryHandler)
- : InterceptedInteraction(getInterceptions())
- , m_bUsed (false)
+ : m_bUsed (false)
, m_bHandledByMySelf (false)
, m_xAuxiliaryHandler(std::move(xAuxiliaryHandler))
{
+ std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions;
+ lInterceptions.reserve(4);
+ ::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest;
+
+ aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION;
+ aInterceptedRequest.Request <<= css::ucb::InteractiveIOException();
+ aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
+ lInterceptions.push_back(aInterceptedRequest);
+
+ aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION;
+ aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException();
+ aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionAbort>::get();
+ lInterceptions.push_back(aInterceptedRequest);
+
+ aInterceptedRequest.Handle = HANDLE_AUTHENTICATIONREQUESTEXCEPTION;
+ aInterceptedRequest.Request <<= css::ucb::AuthenticationRequest();
+ aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionApprove>::get();
+ lInterceptions.push_back(aInterceptedRequest);
+
+ aInterceptedRequest.Handle = HANDLE_CERTIFICATEVALIDATIONREQUESTEXCEPTION;
+ aInterceptedRequest.Request <<= css::ucb::CertificateValidationRequest();
+ aInterceptedRequest.Continuation = cppu::UnoType<css::task::XInteractionApprove>::get();
+ lInterceptions.push_back(aInterceptedRequest);
+
setInterceptedHandler(xHandler);
+ setInterceptions(std::move(lInterceptions));
+}
+
+void StillReadWriteInteraction::resetInterceptions()
+{
+ setInterceptions(std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest >());
}
void StillReadWriteInteraction::resetErrorStates()
diff --git a/include/comphelper/stillreadwriteinteraction.hxx b/include/comphelper/stillreadwriteinteraction.hxx
index 6347e03f47c3..fb03a7ad1d84 100644
--- a/include/comphelper/stillreadwriteinteraction.hxx
+++ b/include/comphelper/stillreadwriteinteraction.hxx
@@ -33,6 +33,11 @@ namespace comphelper{
class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) StillReadWriteInteraction final : public ::ucbhelper::InterceptedInteraction
{
private:
+ static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0;
+ static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1;
+ static const sal_Int32 HANDLE_AUTHENTICATIONREQUESTEXCEPTION = 2;
+ static const sal_Int32 HANDLE_CERTIFICATEVALIDATIONREQUESTEXCEPTION = 3;
+
bool m_bUsed;
bool m_bHandledByMySelf;
@@ -40,6 +45,7 @@ public:
StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler,
css::uno::Reference< css::task::XInteractionHandler > xAuxiliaryHandler);
+ void resetInterceptions();
void resetErrorStates();
bool wasWriteError() const { return (m_bUsed && m_bHandledByMySelf);}
diff --git a/include/ucbhelper/interceptedinteraction.hxx b/include/ucbhelper/interceptedinteraction.hxx
index b7ac77068c14..738c0f2b002d 100644
--- a/include/ucbhelper/interceptedinteraction.hxx
+++ b/include/ucbhelper/interceptedinteraction.hxx
@@ -78,6 +78,16 @@ class UCBHELPER_DLLPUBLIC InterceptedInteraction : public InterceptedInteraction
sal_Int32 Handle;
+ /** @short default ctor.
+
+ @descr Such constructed object can't be used really.
+ Might it will crash if it's used!
+ Don't forget to initialize all(!) members...
+ */
+ InterceptedRequest()
+ {
+ Handle = INVALID_HANDLE;
+ }
InterceptedRequest(css::uno::Any Request_, css::uno::Type Continuation_, sal_Int32 Handle_)
: Request(std::move(Request_)), Continuation(std::move(Continuation_)), Handle(Handle_)
{
@@ -120,22 +130,16 @@ class UCBHELPER_DLLPUBLIC InterceptedInteraction : public InterceptedInteraction
/** @short these list contains the requests, which should be intercepted.
*/
- std::span< const InterceptedRequest > m_lInterceptions;
+ ::std::vector< InterceptedRequest > m_lInterceptions;
// native interface
public:
- /** @short initialise with a list of intercepted interactions.
-
- @attention If the interface method handle() will be overwritten by
- a derived class, the functionality behind these static list
- can't be used.
- @param lInterceptions
- the list of intercepted requests.
+ /** @short initialize a new instance with default values.
*/
- InterceptedInteraction(std::span< const InterceptedRequest > m_lInterceptions);
+ InterceptedInteraction();
/** @short initialize a new instance with the interaction handler,
@@ -152,6 +156,18 @@ class UCBHELPER_DLLPUBLIC InterceptedInteraction : public InterceptedInteraction
void setInterceptedHandler(const css::uno::Reference< css::task::XInteractionHandler >& xInterceptedHandler);
+ /** @short set a new list of intercepted interactions.
+
+ @attention If the interface method handle() will be overwritten by
+ a derived class, the functionality behind these static list
+ can't be used.
+
+ @param lInterceptions
+ the list of intercepted requests.
+ */
+ void setInterceptions(::std::vector< InterceptedRequest >&& lInterceptions);
+
+
/** @short extract a requested continuation from the list of available ones.
@param lContinuations
diff --git a/ucbhelper/source/client/interceptedinteraction.cxx b/ucbhelper/source/client/interceptedinteraction.cxx
index 15b1b318bdac..96b3fd32cb41 100644
--- a/ucbhelper/source/client/interceptedinteraction.cxx
+++ b/ucbhelper/source/client/interceptedinteraction.cxx
@@ -23,8 +23,7 @@
namespace ucbhelper{
-InterceptedInteraction::InterceptedInteraction(std::span< const InterceptedRequest > lInterceptions)
- : m_lInterceptions(lInterceptions)
+InterceptedInteraction::InterceptedInteraction()
{
}
@@ -33,6 +32,11 @@ void InterceptedInteraction::setInterceptedHandler(const css::uno::Reference< cs
m_xInterceptedHandler = xInterceptedHandler;
}
+void InterceptedInteraction::setInterceptions(::std::vector< InterceptedRequest >&& lInterceptions)
+{
+ m_lInterceptions = std::move(lInterceptions);
+}
+
InterceptedInteraction::EInterceptionState InterceptedInteraction::intercepted(
const InterceptedRequest&,
const css::uno::Reference< css::task::XInteractionRequest >&)
diff --git a/unotools/source/misc/mediadescriptor.cxx b/unotools/source/misc/mediadescriptor.cxx
index d4567c467052..b8bb7f13469e 100644
--- a/unotools/source/misc/mediadescriptor.cxx
+++ b/unotools/source/misc/mediadescriptor.cxx
@@ -459,6 +459,7 @@ bool MediaDescriptor::impl_openStreamWithURL( const OUString& sURL, bool bLockFi
if ( bReadOnly )
(*this)[MediaDescriptor::PROP_READONLY] <<= bReadOnly;
+ xInteraction->resetInterceptions();
xInteraction->resetErrorStates();
try
{