diff options
author | Jim Raykowski <raykowj@gmail.com> | 2021-11-28 15:41:26 -0900 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2021-11-30 10:14:47 +0100 |
commit | cb14adfd8cd593da4c429fcefba48531c10e47ac (patch) | |
tree | a6082d155c0e9b723eeed4869b26eae61abe60be /sw/source | |
parent | 47e65fc0baf8f671733fbf9b5ce8d735328cfb44 (diff) |
SwNavigator: keep entries selected on right-click
when click position is on a selected entry unless root is in the
selections then select root entry only
Fixes regression from commit c4016f246fde835c0cfdabbb7cc35bc6dd48fb24
Applies to root content navigation view for content types where multi-
selection is possible.
Change-Id: I3eb3b3f1eaaee39543700b8b7e3087d2795b3cdb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126017
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index edf53fcbe01f..140b42c7af1a 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1533,10 +1533,18 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) grab_focus(); + // select clicked entry or limit selection to root entry if needed if (std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator()); rCEvt.IsMouseEvent() && m_xTreeView->get_dest_row_at_pos( rCEvt.GetMousePosPixel(), xEntry.get(), false)) - m_xTreeView->set_cursor(*xEntry); + { + // if clicked entry is not currently selected then clear selections and select it + if (!m_xTreeView->is_selected(*xEntry)) + m_xTreeView->set_cursor(*xEntry); + // if root entry is selected then clear selections and select it + else if (m_xTreeView->is_selected(0)) + m_xTreeView->set_cursor(0); + } std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xTreeView.get(), "modules/swriter/ui/navigatorcontextmenu.ui")); std::unique_ptr<weld::Menu> xPop = xBuilder->weld_menu("navmenu"); |