summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2022-04-07 17:58:06 +0200
committerLászló Németh <nemeth@numbertext.org>2022-04-08 12:00:10 +0200
commita21ef822f9769ded6ff834dbfa347cf0e5f913fd (patch)
tree1e681c9c5b09d89abf074177fc1404b785a98252
parent844be7358f1eec00094a55fa1fb4fadadb8cd1bf (diff)
tdf#147179 sw: select tracked row change in Manage Changes
In Manage Changes dialog window, selecting items of list of changes results selection of the associated text changes in the main text, as a visual feedback. From commit eebe4747d2d13545004937bb0267ccfc8ab9d63f, text changes of deleted/inserted rows or tables are listed under a single "tracked row" list item, as its children. Selecting a "tracked row" list item in Manage Changes resulted incomplete text selection in the main text: only the first text change in the first cell was selected instead of all associated text changes of tracked row(s) or table. Note: Manage Changes supports multiple selections, i.e. it's possible to select multiple list items by Ctrl + click, and select ranges by Shift + click. This commit does the same with redlines of tracked row changes. Follow-up to commit eebe4747d2d13545004937bb0267ccfc8ab9d63f "tdf#144270 sw: manage tracked table (row) deletion/insertion". Change-Id: If7b12e8d3c0e437495e1fcae0e8f04e34301c516 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132685 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--sw/qa/uitest/writer_tests/trackedChanges.py29
-rw-r--r--sw/source/uibase/misc/redlndlg.cxx27
2 files changed, 56 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py b/sw/qa/uitest/writer_tests/trackedChanges.py
index c04034e7149b..0d13ddcdff8d 100644
--- a/sw/qa/uitest/writer_tests/trackedChanges.py
+++ b/sw/qa/uitest/writer_tests/trackedChanges.py
@@ -353,4 +353,33 @@ class trackedchanges(UITestCase):
# This was False (missing comment)
self.assertEqual(True, get_state_as_dict(xChild)["Text"].endswith('\tComment added'))
+ def test_tdf147179(self):
+ with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ tables = document.getTextTables()
+ self.assertEqual(3, len(tables))
+
+ # Select text of the tracked row, not only text of its first cell
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild("writerchanges")
+
+ # select second tracked table row in tree list
+ changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+ while get_state_as_dict(xWriterEdit)["SelectedText"] != 'klj':
+ xToolkit.processEventsToIdle()
+
+ # this was "j" (only text of the first cell was selected, not text of the row)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "klj" )
+
+ # select first tracked table row in tree list
+ changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+ while get_state_as_dict(xWriterEdit)["SelectedText"] != 'bca':
+ xToolkit.processEventsToIdle()
+
+ # this was "a" (only text of the first cell was selected, not text of the row)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "bca" )
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index 7bed942acbf5..dd5feeacc747 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -1123,6 +1123,33 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, GotoHdl, Timer *, void)
pSh->EnterAddMode();
}
}
+
+ // select all redlines of tracked table rows
+ std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator( &*xActEntry ));
+ if ( rTreeView.iter_children(*xChild) )
+ {
+ RedlinData *pData = reinterpret_cast<RedlinData*>(rTreeView.get_id(*xChild).toInt64());
+ // disabled for redline stack, but not for redlines of table rows
+ if ( !pData->bDisabled )
+ {
+ do
+ {
+ nPos = GetRedlinePos(*xChild);
+ if (nPos != SwRedlineTable::npos)
+ {
+ const SwRangeRedline& rRedln = pSh->GetRedline( nPos );
+ bIsNotFormated |= RedlineType::Format != rRedln.GetType();
+
+ if (pSh->GotoRedline(nPos, true))
+ {
+ pSh->SetInSelect();
+ pSh->EnterAddMode();
+ }
+ }
+ }
+ while ( rTreeView.iter_next_sibling(*xChild) );
+ }
+ }
return false;
});