sw/source/uibase/misc/redlndlg.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
New commits: commit d89d3e73a7a0c43ea700d6bd402081c449573a7f Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Jun 19 11:40:26 2025 +0500 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Jun 20 08:58:52 2025 +0200 LOK: enable dialog controls in AllowManageRedlines mode The new function takes the "accept all" command state into account, which goes through SfxDispatcher::FindServer_, which considers the read-only mode for document, view, and all special cases. Change-Id: I532789dd6886589ab1b6896889fd269909d40204 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186701 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index d1180be8271a..ae6ca0feb358 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -35,6 +35,7 @@ #include <swwait.hxx> #include <uitool.hxx> #include <o3tl/string_view.hxx> +#include <o3tl/temporary.hxx> #include <cmdid.h> #include <strings.hrc> @@ -321,6 +322,15 @@ void SwRedlineAcceptDlg::Init(SwRedlineTable::size_type nStart) lcl_reselect(rTreeView, pSelectedEntryRedlineData); } +static bool isAcceptRejectCommandsEnabled(const SwView& rView) +{ + // Check the state of the command, including read-only mode and special cases + // like LOK AllowChangeComments mode + return rView.GetViewFrame().GetDispatcher()->QueryState(FN_REDLINE_ACCEPT_ALL, + o3tl::temporary(SfxPoolItemHolder())) + != SfxItemState::DISABLED; +} + void SwRedlineAcceptDlg::InitAuthors() { if (!m_xTabPagesCTRL) @@ -368,8 +378,7 @@ void SwRedlineAcceptDlg::InitAuthors() pFilterPage->SelectAuthor(aStrings[0]); weld::TreeView& rTreeView = m_pTable->GetWidget(); - SwDocShell* pShell = pSh ? pSh->GetDoc()->GetDocShell() : nullptr; - bool const bEnable = pShell && !pShell->IsReadOnly() + bool const bEnable = isAcceptRejectCommandsEnabled(*pView) && rTreeView.n_children() != 0 && !pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements(); bool bSel = rTreeView.get_selected(nullptr); @@ -1394,8 +1403,7 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, GotoHdl, Timer *, void) } } - SwDocShell* pShell = pSh->GetDoc()->GetDocShell(); - bool const bEnable = pShell && !pShell->IsReadOnly() + bool const bEnable = isAcceptRejectCommandsEnabled(*pView) && !pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements(); m_pTPView->EnableAccept( bEnable && bSel /*&& !bReadonlySel*/ ); m_pTPView->EnableReject( bEnable && bSel /*&& !bReadonlySel*/ );