summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2021-11-28 15:41:26 -0900
committerXisco Fauli <xiscofauli@libreoffice.org>2021-11-30 16:32:24 +0100
commiteb895e42d1327a9263f53768d84c89a5ce6e8e63 (patch)
treed316c4ecfd489f11cb5855bb9e7b918a67a4aea0 /sw
parentb0e6f49aaf6897b1102ef92b1474ffbc64a71e09 (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> (cherry picked from commit cb14adfd8cd593da4c429fcefba48531c10e47ac) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126100 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/utlui/content.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 0dbbd73949cc..44c610341fea 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");