sw/qa/uitest/data/reject-all-overlap.docx |binary sw/qa/uitest/writer_tests/trackedChanges.py | 17 +++++++++++++++++ sw/source/uibase/misc/redlndlg.cxx | 22 ++-------------------- 3 files changed, 19 insertions(+), 20 deletions(-)
New commits: commit 8e513d30d1bd4c69e2e155e72f61897fc830adbb Author: Miklos Vajna <[email protected]> AuthorDate: Tue Dec 16 08:34:26 2025 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Wed Dec 17 12:51:45 2025 +0100 tdf#168737 sw interdependent redlines, reject all: fix ignored format redlines The bugdoc has two redlines: a format and a delete redline. Pressing "reject all" in the manage changes dialog doesn't reject the format redline. Seems this happens because of code added in commit 9c4eef7d809ad7d283860c7b47b0f561aa240906 (tdf#52391 reject/clear formatting of format-only changes, 2019-01-29), which argued that rejection of format redlines isn't really implemented, so better if a "mass reject all" doesn't reject them, unless only format redlines are found in the document. But in the meantime I worked on improving support for rejecting format redlines, most recently commit 47cb60bc534104852a219426e3beb4c714b6cf07 (tdf#167761 sw format redline, char props: implement ODF import, 2025-08-18) added ODF import/export of these old direct character properties, so it now makes less sense to filter out format redlines while rejecting all of them. Also, the matching toolbar button didn't ignore such format redlines. Fix the problem by simplifying SwRedlineAcceptDlg::CallAcceptReject(): unless the redline data for the iterator says this item is disabled, always add it to the list of redlines, similar to what the "reject the selected redline(s)" case did already. Note that the original 2019 commit was less confusing, as it did change the label of the reject all button, but that was removed in commit 2e1a38ceb6866248ec30f6fe58cd3adc1b910eec (tdf#146893 Rework Manage Changes dialog, 2022-01-24). Change-Id: I69e7247d068cea2a25cd46ad2d5b41fccfa54919 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195772 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins diff --git a/sw/qa/uitest/data/reject-all-overlap.docx b/sw/qa/uitest/data/reject-all-overlap.docx new file mode 100644 index 000000000000..6263df4e0f6f Binary files /dev/null and b/sw/qa/uitest/data/reject-all-overlap.docx differ diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py b/sw/qa/uitest/writer_tests/trackedChanges.py index 967d2d401499..b2ce09d8e1b9 100644 --- a/sw/qa/uitest/writer_tests/trackedChanges.py +++ b/sw/qa/uitest/writer_tests/trackedChanges.py @@ -625,6 +625,23 @@ class trackedchanges(UITestCase): # i.e. a change was not accepted. self.assertEqual(document.Redlines.Count, 0) + def test_reject_all_deletes_all_redlines(self): + # Given a document with overlapping changes: + with self.ui_test.load_file(get_url_for_data_file("reject-all-overlap.docx")) as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # When rejecting all changes using the manage changes dialog: + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg: + xAccBtn = xTrackDlg.getChild("rejectall") + xAccBtn.executeAction("CLICK", tuple()) + + # Then make sure all changes are rejected: + # Without the accompanying fix in place, this failed with: + # AssertionError: 1 != 0 + # i.e. a change was not rejected. + self.assertEqual(document.Redlines.Count, 0) + def test_tdf155847_multiple_tracked_columns_crash(self): with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as document: diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 8595cfe292e7..ab5fbd4a7bd0 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -1109,7 +1109,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept ) weld::TreeView& rTreeView = m_pTable->GetWidget(); - auto lambda = [this, pSh, bSelect, bAccept, &rTreeView, &nPos, &aRedlines](weld::TreeIter& rEntry) { + auto lambda = [bSelect, &rTreeView, &nPos, &aRedlines](weld::TreeIter& rEntry) { if (!rTreeView.get_iter_depth(rEntry)) { if (bSelect && nPos == -1) @@ -1117,25 +1117,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept ) RedlinData *pData = weld::fromId<RedlinData*>(rTreeView.get_id(rEntry)); - bool bIsNotFormatted = true; - - // first remove only changes with insertion/deletion, if they exist - // (format-only changes haven't had real rejection yet, only an - // approximation: clear direct formatting, so try to warn - // with the extended button label "Reject All/Clear formatting") - if ( !bSelect && !bAccept && !m_bOnlyFormatedRedlines ) - { - SwRedlineTable::size_type nPosition = GetRedlinePos(rEntry); - if (nPosition != SwRedlineTable::npos) - { - const SwRangeRedline& rRedln = pSh->GetRedline(nPosition); - - if (RedlineType::Format == rRedln.GetType()) - bIsNotFormatted = false; - } - } - - if (!pData->bDisabled && bIsNotFormatted) + if (!pData->bDisabled) aRedlines.emplace_back(rTreeView.make_iterator(&rEntry)); } return false;
