diff options
author | Henry Castro <hcastro@collabora.com> | 2023-09-06 10:28:59 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2023-10-09 16:32:35 +0200 |
commit | 447d6af45b3c454bb858bc904f50e500aaaefc60 (patch) | |
tree | 67fdac46750ebe59ac58d704a081fac65bc60eda /desktop | |
parent | f6ef76cce3b05b1b3304d409882c339c116a7c08 (diff) |
lok: implement "handleLoadReadOnlyRequest"
Is used for interaction handle to query user decision
regarding to open the document read only.
Signed-off-by: Henry Castro <hcastro@collabora.com>
Change-Id: Ia945eae7b1627d57d6211ae92a784d50313c2627
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156623
Reviewed-by: Ashod Nakashian <ash@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157703
Tested-by: Jenkins
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/lokinteractionhandler.cxx | 24 | ||||
-rw-r--r-- | desktop/source/lib/lokinteractionhandler.hxx | 2 |
2 files changed, 26 insertions, 0 deletions
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 <cppuhelper/supportsservice.hxx> #include <com/sun/star/document/BrokenPackageRequest.hpp> +#include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/task/XInteractionAbort.hpp> #include <com/sun/star/task/XInteractionApprove.hpp> #include <com/sun/star/task/XInteractionPassword2.hpp> @@ -368,6 +369,26 @@ bool LOKInteractionHandler::handlePackageReparationRequest(const uno::Reference< return false; } +bool LOKInteractionHandler::handleLoadReadOnlyRequest(const uno::Reference<task::XInteractionRequest>& 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<task::XInteractionRequest>& 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<css::task::XInteractionRequest>& xRequest); + static bool handleLoadReadOnlyRequest(const css::uno::Reference<css::task::XInteractionRequest>& xRequest); + public: void SetPassword(char const* pPassword); |