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-30 19:24:37 +0200
commit0844dd442e9805788ed940055c74d070e184121a (patch)
tree337a350c4a386acadddc0dbe1de8b966f636e0cf
parent8d77ba93d8b2291fe2059e80c2ba71c02547126d (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". (cherry-picked from commit a21ef822f9769ded6ff834dbfa347cf0e5f913fd) Conflicts: sw/qa/uitest/writer_tests/trackedChanges.py Change-Id: If7b12e8d3c0e437495e1fcae0e8f04e34301c516 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132685 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132700 Tested-by: László Németh <nemeth@numbertext.org>
-rw-r--r--sw/qa/uitest/writer_tests/trackedChanges.py30
-rw-r--r--sw/source/uibase/misc/redlndlg.cxx27
2 files changed, 57 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py b/sw/qa/uitest/writer_tests/trackedChanges.py
index dea49c28673f..1c458694d734 100644
--- a/sw/qa/uitest/writer_tests/trackedChanges.py
+++ b/sw/qa/uitest/writer_tests/trackedChanges.py
@@ -7,6 +7,7 @@
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, type_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
class trackedchanges(UITestCase):
@@ -319,4 +320,33 @@ class trackedchanges(UITestCase):
tables = document.getTextTables()
self.assertEqual(3, len(tables))
+ 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 a8099859455d..b3ca574b492d 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -1121,6 +1121,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;
});