summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-06-11 20:03:36 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-06-12 20:02:57 +0200
commit7dadf3db348ea1e38be7f58697852f6d775bc710 (patch)
treea457047436d479bb146f6db1791f295592e30e66
parentfc0cc8fd1ae92eed355e8569fd5ba2fa7cf0cc40 (diff)
allow hover-select to unselect when mouse outside treeview
Change-Id: Id991d4c3cdbb6a97c0024430bbff9ccbb29a2d52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96165 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/treelist/svimpbox.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index dbccbf3a17ca..bf54f1dcc7ae 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -2059,12 +2059,18 @@ 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);
- if (m_pView->mbHoverSelection && !m_pView->IsSelected(pEntry) && IsSelectable(pEntry))
- m_pView->Select(pEntry);
+ 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);
+ }
}
}