From 447d6af45b3c454bb858bc904f50e500aaaefc60 Mon Sep 17 00:00:00 2001 From: Henry Castro Date: Wed, 6 Sep 2023 10:28:59 -0400 Subject: lok: implement "handleLoadReadOnlyRequest" Is used for interaction handle to query user decision regarding to open the document read only. Signed-off-by: Henry Castro Change-Id: Ia945eae7b1627d57d6211ae92a784d50313c2627 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156623 Reviewed-by: Ashod Nakashian Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157703 Tested-by: Jenkins --- desktop/source/lib/lokinteractionhandler.cxx | 24 ++++++++++++++++++++++++ desktop/source/lib/lokinteractionhandler.hxx | 2 ++ 2 files changed, 26 insertions(+) (limited to 'desktop') diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx index 6df4fe2d98e5..a05091cedf5e 100644 --- a/desktop/source/lib/lokinteractionhandler.cxx +++ b/desktop/source/lib/lokinteractionhandler.cxx @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -368,6 +369,26 @@ bool LOKInteractionHandler::handlePackageReparationRequest(const uno::Reference< return false; } +bool LOKInteractionHandler::handleLoadReadOnlyRequest(const uno::Reference& xRequest) +{ + uno::Any const request(xRequest->getRequest()); + + OUString aFileName; + beans::NamedValue aLoadReadOnlyRequest; + if ((request >>= aLoadReadOnlyRequest) && + aLoadReadOnlyRequest.Name == "LoadReadOnlyRequest" && + (aLoadReadOnlyRequest.Value >>= aFileName)) + { + auto xInteraction(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), nullptr)); + + if (xInteraction.is()) + xInteraction->handleInteractionRequest(xRequest); + + return true; + } + return false; +} + bool LOKInteractionHandler::handleFilterOptionsRequest(const uno::Reference& xRequest) { document::FilterOptionsRequest aFilterOptionsRequest; @@ -410,6 +431,9 @@ sal_Bool SAL_CALL LOKInteractionHandler::handleInteractionRequest( if (handlePackageReparationRequest(xRequest)) return true; + if (handleLoadReadOnlyRequest(xRequest)) + return true; + // TODO: perform more interactions 'for real' like the above selectApproved(rContinuations); diff --git a/desktop/source/lib/lokinteractionhandler.hxx b/desktop/source/lib/lokinteractionhandler.hxx index fc2bf12b48cc..c3641db0762f 100644 --- a/desktop/source/lib/lokinteractionhandler.hxx +++ b/desktop/source/lib/lokinteractionhandler.hxx @@ -79,6 +79,8 @@ private: static bool handleFilterOptionsRequest(const ::com::sun::star::uno::Reference<::com::sun::star::task::XInteractionRequest>& Request); static bool handlePackageReparationRequest(const css::uno::Reference& xRequest); + static bool handleLoadReadOnlyRequest(const css::uno::Reference& xRequest); + public: void SetPassword(char const* pPassword); -- cgit