diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-06-11 20:03:36 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-11-30 18:22:05 +0100 |
commit | b1a6c0355a5a8fc6f9cca0bbaa32f9fdd2b84495 (patch) | |
tree | 03f557041dfbcee2025c30297008d6960000eecd /vcl | |
parent | 7364cbbdea110d3c7b1656290b4c0a746a95cfe4 (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>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106879
Tested-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/treelist/svimpbox.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
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() |