diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-07-19 15:19:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-07-20 08:15:29 +0200 |
commit | 0e8b7dd7a013dffe080148baac926a698f36ad85 (patch) | |
tree | 940962b117c06943784aa94f1116bf748a2d057c /svtools/source | |
parent | 669d6ed4fa2e7a01c372a6e27dd5468ec8eb3077 (diff) |
split GetWindowExtentsRelative asunder
sometimes it returns a relative position, sometimes an absolute
position.
Rather have two different methods with names that match what
they return.
Change-Id: Ie1e73c6be1c797fd59934c96866d1fef1f972b35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154653
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools/source')
-rw-r--r-- | svtools/source/brwbox/brwbox2.cxx | 21 | ||||
-rw-r--r-- | svtools/source/brwbox/brwbox3.cxx | 9 |
2 files changed, 24 insertions, 6 deletions
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 09b1a7469fea..6b3105f0515e 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -1958,9 +1958,15 @@ tools::Rectangle BrowseBox::calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen) { aTopLeft.setY( GetDataRowHeight() ); nWidth = GetColumnWidth(0); - nHeight = GetWindowExtentsRelative( pParent ).GetHeight() - aTopLeft.Y() - GetControlArea().GetSize().Height(); + if (pParent) + nHeight = GetWindowExtentsRelative( *pParent ).GetHeight() - aTopLeft.Y() - GetControlArea().GetSize().Height(); + else + nHeight = GetWindowExtentsAbsolute().GetHeight() - aTopLeft.Y() - GetControlArea().GetSize().Height(); } - aTopLeft += GetWindowExtentsRelative( pParent ).TopLeft(); + if (pParent) + aTopLeft += GetWindowExtentsRelative( *pParent ).TopLeft(); + else + aTopLeft += GetWindowExtentsAbsolute().TopLeft(); return tools::Rectangle(aTopLeft,Size(nWidth,nHeight)); } @@ -1970,7 +1976,11 @@ tools::Rectangle BrowseBox::calcTableRect(bool _bOnScreen) if ( !_bOnScreen ) pParent = GetAccessibleParentWindow(); - tools::Rectangle aRect( GetWindowExtentsRelative( pParent ) ); + tools::Rectangle aRect; + if (pParent) + aRect = GetWindowExtentsRelative( *pParent ); + else + aRect = GetWindowExtentsAbsolute(); tools::Rectangle aRowBar = calcHeaderRect(false, pParent == nullptr); tools::Long nX = aRowBar.Right() - aRect.Left(); @@ -1989,7 +1999,10 @@ tools::Rectangle BrowseBox::GetFieldRectPixelAbs( sal_Int32 _nRowId, sal_uInt16 tools::Rectangle aRect = GetFieldRectPixel(_nRowId,_nColId,_bOnScreen); Point aTopLeft = aRect.TopLeft(); - aTopLeft += GetWindowExtentsRelative( pParent ).TopLeft(); + if (pParent) + aTopLeft += GetWindowExtentsRelative( *pParent ).TopLeft(); + else + aTopLeft += GetWindowExtentsAbsolute().TopLeft(); return tools::Rectangle(aTopLeft,aRect.GetSize()); } diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index eaa558b18a00..4a1263d66e2b 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -531,9 +531,14 @@ bool BrowseBox::GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, return GetOutDev()->GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector ); } -tools::Rectangle BrowseBox::GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const +tools::Rectangle BrowseBox::GetWindowExtentsAbsolute() const { - return Control::GetWindowExtentsRelative( pRelativeWindow ); + return Control::GetWindowExtentsAbsolute(); +} + +tools::Rectangle BrowseBox::GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const +{ + return Control::GetWindowExtentsRelative( rRelativeWindow ); } void BrowseBox::GrabFocus() |