summaryrefslogtreecommitdiffstats
path: root/comphelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-11-23 10:01:44 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-11-23 12:07:09 +0100
commit59280a9ce5a15136a6fdd383aedf02c6cf7d6e96 (patch)
treeae4a920bc8687df984745f347cfbb0f3b5d52101 /comphelper
parenttdf#158072 Fails to apply AutoFilter in Mail Merge dialog (diff)
downloadcore-59280a9ce5a15136a6fdd383aedf02c6cf7d6e96.tar.gz
core-59280a9ce5a15136a6fdd383aedf02c6cf7d6e96.zip
tdf#158321 No error message when file doesn't exist
Revert "reduce allocations in InterceptedInteraction" This reverts commit e3c961e6a3917d95534652e0f982918cc1079015. Change-Id: I26ba0acaa088dff1800ccd69513056f821bd4d7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159762 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/simplefileaccessinteraction.cxx12
-rw-r--r--comphelper/source/misc/stillreadwriteinteraction.cxx61
2 files changed, 35 insertions, 38 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()