diff options
author | Jim Raykowski <raykowj@gmail.com> | 2022-06-22 17:53:10 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2022-06-27 07:53:10 +0200 |
commit | 8e8e0aefc998adba749a93cacc4660d859fba675 (patch) | |
tree | 7dfa5b10da5a1afc0c22b0afc2968b6e45a7654f | |
parent | 85b7f8f155ae19957e1b2e6ea62f4aa8f08108cc (diff) |
tdf#149279 SwNavigator enhancement to show at least two headings
above tracked heading
For gtk3, treeview scroll_to_row to a visible collapsed row makes
the row expanded. The sal version does not. To make the behavior
consistent, the patch removes the call to
gtk_tree_view_expand_to_path which causes a visible collapsed row to
expand.
Change-Id: I29e67535ab23aa1952b4ff97c1b81276794b8036
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136436
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 12 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index ebf0a02794c7..beae047b4f37 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3894,6 +3894,18 @@ void SwContentTree::UpdateTracking() // unselect all entries, make pEntry visible, and select m_xTreeView->set_cursor(rEntry); Select(); + + // tdf#149279 show at least two outline entries before the set cursor entry + std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator(&rEntry)); + for (int i = 0; i < 2; i++) + { + if (m_xTreeView->get_iter_depth(*xIter) == 0) + break; + m_xTreeView->iter_previous(*xIter); + while (!weld::IsEntryVisible(*m_xTreeView, *xIter)) + m_xTreeView->iter_parent(*xIter); + } + m_xTreeView->scroll_to_row(*xIter); } bRet = true; } diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 6959f80698b0..9abde0981326 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -14790,7 +14790,6 @@ public: assert(gtk_tree_view_get_model(m_pTreeView) && "don't select when frozen, select after thaw. Note selection doesn't survive a freeze"); disable_notify_events(); GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1); - gtk_tree_view_expand_to_path(m_pTreeView, path); gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0); gtk_tree_path_free(path); enable_notify_events(); @@ -15468,7 +15467,6 @@ public: disable_notify_events(); const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter); GtkTreePath* path = gtk_tree_model_get_path(m_pTreeModel, const_cast<GtkTreeIter*>(&rGtkIter.iter)); - gtk_tree_view_expand_to_path(m_pTreeView, path); gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0); gtk_tree_path_free(path); enable_notify_events(); |