uui/inc/strings.hrc|1
uui/source/iahndl-errorhandler.cxx | 39 +
uui/source/iahndl.cxx | 11 ++
uui/source/iahndl.hxx |5
4 files changed, 56 insertions(+)
New commits:
commit 81fa0ab10b9acabe9b7f8ce9a8d7b1c0765bfdfc
Author: Henry Castro
AuthorDate: Wed Sep 6 10:27:12 2023 -0400
Commit: Henry Castro
CommitDate: Fri Sep 15 16:06:03 2023 +0200
uui: 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: Ia6792ca540b5c62f4c9de8a5793ef45de3740484
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156622
Tested-by: Jenkins CollaboraOffice
Reviewed-by: Ashod Nakashian
diff --git a/uui/inc/strings.hrc b/uui/inc/strings.hrc
index 98bd94ef8484..b6daff517f51 100644
--- a/uui/inc/strings.hrc
+++ b/uui/inc/strings.hrc
@@ -78,5 +78,6 @@
#define STR_RELOADEDITABLE_TITLE
NC_("STR_RELOADEDITABLE_TITLE", "Document is now editable")
#define STR_RELOADEDITABLE_MSG NC_("STR_RELOADEDITABLE_MSG",
"Document file '$(ARG1)' is now editable \n\nReload this document for editing?")
#define STR_RELOADEDITABLE_BTN NC_("STR_RELOADEDITABLE_BTN",
"~Reload")
+#define STR_LOADREADONLY_MSGNC_("STR_LOADREADONLY_MSG",
"The author would like you to open '$(ARG1)' as read-only unless you need to
make changes. Open as read-only?.")
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl-errorhandler.cxx
b/uui/source/iahndl-errorhandler.cxx
index c03d518108f3..5e758da9515c 100644
--- a/uui/source/iahndl-errorhandler.cxx
+++ b/uui/source/iahndl-errorhandler.cxx
@@ -33,6 +33,7 @@
#include
#include
+#include
#include "getcontinuations.hxx"
#include "iahndl.hxx"
@@ -290,4 +291,42 @@ UUIInteractionHelper::handleErrorHandlerRequest(
}
}
+void
+UUIInteractionHelper::handleLoadReadOnlyRequest(
+const OUString& sDocumentURL,
+uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+rContinuations)
+{
+std::locale aLocale(Translate::Create("uui"));
+std::vector aArguments = { sDocumentURL };
+uno::Reference xRetry;
+uno::Reference xAbort;
+uno::Reference xApprove;
+uno::Reference xDisapprove;
+uno::Reference xParent = getParentXWindow();
+OUString aMessage(Translate::get(STR_LOADREADONLY_MSG, aLocale));
+
+aMessage = replaceMessageWithArguments(aMessage, aArguments);
+getContinuations(rContinuations, , , ,
);
+
+std::unique_ptr xBox(
+Application::CreateMessageDialog(Application::GetFrameWeld(xParent),
+ VclMessageType::Question,
+ VclButtonsType::YesNo,
+ aMessage,
+ GetpApp()));
+
+if (xBox->run() == RET_YES)
+{
+if (xApprove.is())
+xApprove->select();
+}
+else
+{
+if (xDisapprove.is())
+xDisapprove->select();
+}
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index ce5dfffa88db..7bd3fb7104d4 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -813,6 +813,17 @@ UUIInteractionHelper::handleRequest_impl(
return true;
}
+OUString aFileName;
+beans::NamedValue aLoadReadOnlyRequest;
+if ((aAnyRequest >>= aLoadReadOnlyRequest) &&
+aLoadReadOnlyRequest.Name == "LoadReadOnlyRequest" &&
+(aLoadReadOnlyRequest.Value >>= aFileName))
+{
+handleLoadReadOnlyRequest(aFileName,
+ rRequest->getContinuations());
+return true;
+}
+
// Last chance: interaction handlers registered in the
configuration
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index 78d283d6bf0e..cf468f57dbcf 100644
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -238,6 +238,11 @@ private:
const OUString & instructions,
const OUString & url,
css::uno::Sequence< css::uno::Reference<
css::task::XInteractionContinuation > > const & rContinuations );
+
+void
+handleLoadReadOnlyRequest(
+const OUString& sDocumentURL,
+css::uno::Sequence< css::uno::Reference<
css::task::XInteractionContinuation > > const & rContinuations);
};
class ErrorResource