ignore positions on top of scrollbars for GetTargetAtPoint

Change-Id: I6d63ac3723b392e7c82836ea5d4455ebde8a8e08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96553
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2020-06-17 16:47:15 +01:00
parent 65cc604f68
commit 8c74d9b30a
3 changed files with 27 additions and 1 deletions

View file

@ -557,6 +557,10 @@ protected:
void ImplEditEntry( SvTreeListEntry* pEntry );
void AdjustEntryHeightAndRecalc();
// true if rPos is over the SvTreeListBox body, i.e. not over a
// scrollbar
VCL_DLLPRIVATE bool PosOverBody(const Point& rPos) const;
public:
void SetNoAutoCurEntry( bool b );

View file

@ -130,7 +130,7 @@ public:
SvTreeListEntry* GetTargetAtPoint(const Point& rPos, bool bHighLightTarget)
{
SvTreeListEntry* pOldTargetEntry = pTargetEntry;
pTargetEntry = pImpl->GetEntry(rPos);
pTargetEntry = PosOverBody(rPos) ? pImpl->GetEntry(rPos) : nullptr;
if (pOldTargetEntry != pTargetEntry)
ImplShowTargetEmphasis(pOldTargetEntry, false);

View file

@ -1996,6 +1996,28 @@ void SvTreeListBox::ModelHasCleared()
SvListView::ModelHasCleared();
}
bool SvTreeListBox::PosOverBody(const Point& rPos) const
{
if (rPos.X() < 0 || rPos.Y() < 0)
return false;
Size aSize(GetSizePixel());
if (rPos.X() > aSize.Width() || rPos.Y() > aSize.Height())
return false;
if (pImpl->m_aVerSBar->IsVisible())
{
tools::Rectangle aRect(pImpl->m_aVerSBar->GetPosPixel(), pImpl->m_aVerSBar->GetSizePixel());
if (aRect.IsInside(rPos))
return false;
}
if (pImpl->m_aHorSBar->IsVisible())
{
tools::Rectangle aRect(pImpl->m_aHorSBar->GetPosPixel(), pImpl->m_aHorSBar->GetSizePixel());
if (aRect.IsInside(rPos))
return false;
}
return true;
}
void SvTreeListBox::ScrollOutputArea( short nDeltaEntries )
{
if( !nDeltaEntries || !pImpl->m_aVerSBar->IsVisible() )