desktop/source/lib/init.cxx | 3 +++ sfx2/source/control/unoctitm.cxx | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-)
New commits: commit b44a1fdd7e0f5f7be02665407ebbc15b977d2f7b Author: Gökay Şatır <[email protected]> AuthorDate: Fri Mar 8 13:51:01 2024 +0300 Commit: Michael Meeks <[email protected]> CommitDate: Fri Mar 8 14:55:10 2024 +0100 Allow enabling saving when comment edit is allowed in readonly. Signed-off-by: Gökay Şatır <[email protected]> Change-Id: I88d535a5b23fb6d5de8e72eec61bdf3550bc757d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164570 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Michael Meeks <[email protected]> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index c98362b6ba63..739ba2a42021 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5124,6 +5124,9 @@ static bool isCommandAllowed(OUString& command) { return true; else { + if (command == u".uno:Save"_ustr && SfxViewShell::Current() && SfxViewShell::Current()->IsAllowChangeComments()) + return true; + for (size_t i = 0; i < std::size(nonAllowedList); i++) { if (nonAllowedList[i] == command) diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 7ddfd50a0796..9b588293082b 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -547,7 +547,20 @@ static bool isCommandAllowedForViewType(const OUString& command) u"CopyHyperlinkLocation"_ustr }; - return std::find(std::begin(allowedCommandList), std::end(allowedCommandList), command) != std::end(allowedCommandList); + bool allowed = std::find(std::begin(allowedCommandList), std::end(allowedCommandList), command) != std::end(allowedCommandList); + + if (!allowed && SfxViewShell::Current() && SfxViewShell::Current()->IsAllowChangeComments()) + { + constexpr OUString allowedCommentCommandList[] = { + u"InsertAnnotation"_ustr, + u"DeleteComment"_ustr, + u"DeleteAnnotation"_ustr, + u"EditAnnotation"_ustr + }; + allowed = std::find(std::begin(allowedCommentCommandList), std::end(allowedCommentCommandList), command) != std::end(allowedCommentCommandList); + } + + return allowed; } return true;
