desktop/source/lib/lokinteractionhandler.cxx |   24 ++++++++++++++++++++++++
 desktop/source/lib/lokinteractionhandler.hxx |    2 ++
 uui/source/iahndl-errorhandler.cxx           |    1 -
 3 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 7cbe8dda1c45ed770194e820c542b237c5b8aae0
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Wed Sep 6 10:28:59 2023 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Fri Sep 15 16:06:30 2023 +0200

    lok: implement "handleLoadReadOnlyRequest"
    
    Is used for interaction handle to query user decision
    regarding to open the document read only.
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: Ia945eae7b1627d57d6211ae92a784d50313c2627
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156623
    Reviewed-by: Ashod Nakashian <a...@collabora.com>

diff --git a/desktop/source/lib/lokinteractionhandler.cxx 
b/desktop/source/lib/lokinteractionhandler.cxx
index 09ee2aaa9f90..8495ac2c8179 100644
--- a/desktop/source/lib/lokinteractionhandler.cxx
+++ b/desktop/source/lib/lokinteractionhandler.cxx
@@ -22,6 +22,7 @@
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/supportsservice.hxx>
 
+#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>
@@ -350,6 +351,26 @@ bool 
LOKInteractionHandler::handleMacroConfirmationRequest(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;
@@ -389,6 +410,9 @@ sal_Bool SAL_CALL 
LOKInteractionHandler::handleInteractionRequest(
     if (handleMacroConfirmationRequest(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 5c6c6f87de6d..f92b88cf11f9 100644
--- a/desktop/source/lib/lokinteractionhandler.hxx
+++ b/desktop/source/lib/lokinteractionhandler.hxx
@@ -78,6 +78,8 @@ private:
 
     static bool handleFilterOptionsRequest(const 
::com::sun::star::uno::Reference<::com::sun::star::task::XInteractionRequest>& 
Request);
 
+    static bool handleLoadReadOnlyRequest(const 
css::uno::Reference<css::task::XInteractionRequest>& xRequest);
+
 public:
     void SetPassword(char const* pPassword);
 
diff --git a/uui/source/iahndl-errorhandler.cxx 
b/uui/source/iahndl-errorhandler.cxx
index 5e758da9515c..765e7d077182 100644
--- a/uui/source/iahndl-errorhandler.cxx
+++ b/uui/source/iahndl-errorhandler.cxx
@@ -94,7 +94,6 @@ executeErrorDialog(
             break;
     }
 
-
     switch (nButtonMask)
     {
         case MessageBoxStyle::NONE:

Reply via email to