From b1a6c0355a5a8fc6f9cca0bbaa32f9fdd2b84495 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 11 Jun 2020 20:03:36 +0100 Subject: allow hover-select to unselect when mouse outside treeview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id991d4c3cdbb6a97c0024430bbff9ccbb29a2d52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96165 Tested-by: Jenkins Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106879 Tested-by: Szymon Kłos Reviewed-by: Szymon Kłos --- vcl/source/treelist/svimpbox.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'vcl') diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index 75b482ecaa0b..e56932047df0 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -2091,9 +2091,19 @@ void SvImpLBox::MouseButtonUp( const MouseEvent& rMEvt) void SvImpLBox::MouseMove( const MouseEvent& rMEvt) { - SvTreeListEntry* pEntry = GetClickedEntry( rMEvt.GetPosPixel() ); + Point aPos = rMEvt.GetPosPixel(); + SvTreeListEntry* pEntry = GetClickedEntry(aPos); if ( !MouseMoveCheckCtrl( rMEvt, pEntry ) && ( m_aSelEng.GetSelectionMode() != SelectionMode::NONE ) ) - m_aSelEng.SelMouseMove( rMEvt ); + { + m_aSelEng.SelMouseMove(rMEvt); + if (m_pView->mbHoverSelection) + { + if (aPos.X() < 0 || aPos.Y() < 0 || aPos.X() > m_aOutputSize.Width() || aPos.Y() > m_aOutputSize.Height()) + m_pView->SelectAll(false); + else if (!m_pView->IsSelected(pEntry) && IsSelectable(pEntry)) + m_pView->Select(pEntry); + } + } } void SvImpLBox::ExpandAll() -- cgit