From b6b26421a1029b18b48b69dbdac4bb70fb622604 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 20 Jul 2023 08:19:52 +0200 Subject: split Point/Size/Rectangle into AbsoluteScreenPixel* types to attempt to make it obvious in code what kind of coordinate system we are dealing with. The idea is that by doing this, the compile-time type checking will flush out inconsistencies between different code. I started with vcl::Window::OutputToAbsoluteScreenPixel and worked outwards from there. Change-Id: Ia967d7a0bb38886695f3a761b85c8b9340ddb1c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154676 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../extended/accessibleiconchoicectrlentry.cxx | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'accessibility/source/extended/accessibleiconchoicectrlentry.cxx') diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx index 0edf5535fc12..44ac61e9252a 100644 --- a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx +++ b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx @@ -108,19 +108,15 @@ namespace accessibility return aRect; } - tools::Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen_Impl() const + AbsoluteScreenPixelRectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen_Impl() const { - tools::Rectangle aRect; SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); - if ( pEntry ) - { - aRect = m_pIconCtrl->GetBoundingBox( pEntry ); - Point aTopLeft = aRect.TopLeft(); - aTopLeft += m_pIconCtrl->GetWindowExtentsAbsolute().TopLeft(); - aRect = tools::Rectangle( aTopLeft, aRect.GetSize() ); - } - - return aRect; + if ( !pEntry ) + return AbsoluteScreenPixelRectangle(); + tools::Rectangle aRect = m_pIconCtrl->GetBoundingBox( pEntry ); + AbsoluteScreenPixelPoint aTopLeft = m_pIconCtrl->GetWindowExtentsAbsolute().TopLeft(); + aTopLeft += AbsoluteScreenPixelPoint(aRect.TopLeft()); + return AbsoluteScreenPixelRectangle( aTopLeft, aRect.GetSize() ); } bool AccessibleIconChoiceCtrlEntry::IsAlive_Impl() const @@ -152,7 +148,7 @@ namespace accessibility return GetBoundingBox_Impl(); } - tools::Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen() + AbsoluteScreenPixelRectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen() { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); -- cgit