accessibility/inc/helper/IComboListBoxHelper.hxx                  |    2 
 accessibility/inc/helper/listboxhelper.hxx                        |    6 +-
 accessibility/source/extended/AccessibleBrowseBox.cxx             |    4 -
 accessibility/source/extended/AccessibleGridControl.cxx           |    4 -
 accessibility/source/extended/AccessibleGridControlHeader.cxx     |    4 -
 accessibility/source/extended/AccessibleGridControlHeaderCell.cxx |    4 -
 accessibility/source/extended/AccessibleGridControlTable.cxx      |    4 -
 accessibility/source/extended/AccessibleGridControlTableCell.cxx  |    4 -
 accessibility/source/extended/accessibleiconchoicectrlentry.cxx   |    2 
 accessibility/source/extended/accessiblelistboxentry.cxx          |    2 
 accessibility/source/standard/accessiblemenucomponent.cxx         |    4 -
 accessibility/source/standard/accessiblemenuitemcomponent.cxx     |    2 
 accessibility/source/standard/vclxaccessiblelistitem.cxx          |    2 
 include/svtools/brwbox.hxx                                        |    3 -
 include/vcl/accessibletable.hxx                                   |    3 -
 include/vcl/accessibletableprovider.hxx                           |    3 -
 include/vcl/toolkit/svtabbx.hxx                                   |    3 -
 include/vcl/window.hxx                                            |    8 +-
 sc/source/ui/Accessibility/AccessibleCell.cxx                     |    4 -
 sc/source/ui/Accessibility/AccessibleDocument.cxx                 |    6 +-
 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx      |    4 -
 sc/source/ui/Accessibility/AccessibleEditObject.cxx               |    4 -
 sc/source/ui/Accessibility/AccessiblePageHeader.cxx               |    4 -
 sc/source/ui/Accessibility/AccessiblePreviewCell.cxx              |    2 
 sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx        |    2 
 sc/source/ui/Accessibility/AccessiblePreviewTable.cxx             |    2 
 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx              |    4 -
 sc/source/ui/unoobj/viewuno.cxx                                   |    2 
 sd/source/ui/accessibility/AccessibleViewForwarder.cxx            |    2 
 sd/source/ui/presenter/PresenterCanvas.cxx                        |    4 -
 sd/source/ui/presenter/PresenterHelper.cxx                        |    2 
 sd/source/ui/slidesorter/view/SlsToolTip.cxx                      |    2 
 sfx2/source/appl/newhelp.cxx                                      |    2 
 svtools/source/brwbox/brwbox2.cxx                                 |   21 
+++++--
 svtools/source/brwbox/brwbox3.cxx                                 |    9 ++-
 sw/source/core/access/accdoc.cxx                                  |   12 ++--
 toolkit/inc/controls/table/tablecontrol.hxx                       |    3 -
 toolkit/source/awt/vclxaccessiblecomponent.cxx                    |    6 +-
 toolkit/source/controls/table/tablecontrol.cxx                    |    9 ++-
 vbahelper/source/vbahelper/vbahelper.cxx                          |    4 -
 vcl/source/app/salvtables.cxx                                     |    2 
 vcl/source/control/combobox.cxx                                   |    4 -
 vcl/source/control/ctrl.cxx                                       |    2 
 vcl/source/control/listbox.cxx                                    |    4 -
 vcl/source/treelist/svtabbx.cxx                                   |   29 
+++++-----
 vcl/source/window/menufloatingwindow.cxx                          |    2 
 vcl/source/window/window.cxx                                      |   25 
+++-----
 47 files changed, 135 insertions(+), 107 deletions(-)

New commits:
commit 0e8b7dd7a013dffe080148baac926a698f36ad85
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Jul 19 15:19:28 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Jul 20 08:15:29 2023 +0200

    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.gran...@collabora.co.uk>

diff --git a/accessibility/inc/helper/IComboListBoxHelper.hxx 
b/accessibility/inc/helper/IComboListBoxHelper.hxx
index eed2a757c1e4..749a0c7b6f7c 100644
--- a/accessibility/inc/helper/IComboListBoxHelper.hxx
+++ b/accessibility/inc/helper/IComboListBoxHelper.hxx
@@ -41,7 +41,7 @@ namespace accessibility
         virtual OUString        GetEntry( sal_Int32  nPos ) const = 0;
         virtual tools::Rectangle       GetDropDownPosSizePixel( ) const = 0;
         virtual tools::Rectangle       GetBoundingRectangle( sal_uInt16 nItem 
) const = 0;
-        virtual tools::Rectangle       GetWindowExtentsRelative() = 0;
+        virtual tools::Rectangle       GetWindowExtentsAbsolute() = 0;
         virtual bool            IsEnabled() const = 0;
         virtual bool            IsEntryVisible( sal_Int32  nPos ) const = 0;
         virtual sal_uInt16      GetDisplayLineCount() const = 0;
diff --git a/accessibility/inc/helper/listboxhelper.hxx 
b/accessibility/inc/helper/listboxhelper.hxx
index dfadf37aa015..98b6d9ee2f51 100644
--- a/accessibility/inc/helper/listboxhelper.hxx
+++ b/accessibility/inc/helper/listboxhelper.hxx
@@ -49,7 +49,7 @@ public:
 
     virtual tools::Rectangle       GetDropDownPosSizePixel() const override
     {
-        tools::Rectangle aTemp = 
m_aComboListBox.GetWindowExtentsRelative(nullptr);
+        tools::Rectangle aTemp = m_aComboListBox.GetWindowExtentsAbsolute();
         tools::Rectangle aRet = m_aComboListBox.GetDropDownPosSizePixel();
         aRet.Move(aTemp.Left(), aTemp.Top());
         return aRet;
@@ -74,9 +74,9 @@ public:
         return aRect;
     }
 
-    virtual tools::Rectangle       GetWindowExtentsRelative() override
+    virtual tools::Rectangle       GetWindowExtentsAbsolute() override
     {
-        return m_aComboListBox.GetWindowExtentsRelative( nullptr );
+        return m_aComboListBox.GetWindowExtentsAbsolute();
     }
 
     virtual bool            IsEnabled() const override
diff --git a/accessibility/source/extended/AccessibleBrowseBox.cxx 
b/accessibility/source/extended/AccessibleBrowseBox.cxx
index 539f10df1cc3..b5d0051ffc1d 100644
--- a/accessibility/source/extended/AccessibleBrowseBox.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBox.cxx
@@ -181,13 +181,13 @@ tools::Rectangle AccessibleBrowseBox::implGetBoundingBox()
 {
     vcl::Window* pParent = mpBrowseBox->GetAccessibleParentWindow();
     OSL_ENSURE( pParent, "implGetBoundingBox - missing parent window" );
-    return mpBrowseBox->GetWindowExtentsRelative( pParent );
+    return mpBrowseBox->GetWindowExtentsRelative( *pParent );
 }
 
 
 tools::Rectangle AccessibleBrowseBox::implGetBoundingBoxOnScreen()
 {
-    return mpBrowseBox->GetWindowExtentsRelative( nullptr );
+    return mpBrowseBox->GetWindowExtentsAbsolute();
 }
 
 // internal helper methods
diff --git a/accessibility/source/extended/AccessibleGridControl.cxx 
b/accessibility/source/extended/AccessibleGridControl.cxx
index 800ab312d19e..37d5013c8fa6 100644
--- a/accessibility/source/extended/AccessibleGridControl.cxx
+++ b/accessibility/source/extended/AccessibleGridControl.cxx
@@ -189,13 +189,13 @@ tools::Rectangle 
AccessibleGridControl::implGetBoundingBox()
 {
     vcl::Window* pParent = m_aTable.GetAccessibleParentWindow();
     OSL_ENSURE( pParent, "implGetBoundingBox - missing parent window" );
-    return m_aTable.GetWindowExtentsRelative( pParent );
+    return m_aTable.GetWindowExtentsRelative( *pParent );
 }
 
 
 tools::Rectangle AccessibleGridControl::implGetBoundingBoxOnScreen()
 {
-    return m_aTable.GetWindowExtentsRelative( nullptr );
+    return m_aTable.GetWindowExtentsAbsolute();
 }
 // internal helper methods ----------------------------------------------------
 
diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx 
b/accessibility/source/extended/AccessibleGridControlHeader.cxx
index 3c6a2edb9a5a..b3651f792790 100644
--- a/accessibility/source/extended/AccessibleGridControlHeader.cxx
+++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx
@@ -189,7 +189,7 @@ Sequence< sal_Int8 > SAL_CALL 
AccessibleGridControlHeader::getImplementationId()
 tools::Rectangle AccessibleGridControlHeader::implGetBoundingBox()
 {
     vcl::Window* pParent = m_aTable.GetAccessibleParentWindow();
-    tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent ) );
+    tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( *pParent ) 
);
     tools::Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar()));
     if(isColumnBar())
         return tools::Rectangle(aGridRect.TopLeft(), 
Size(aGridRect.getOpenWidth(),aHeaderRect.getOpenHeight()));
@@ -200,7 +200,7 @@ tools::Rectangle 
AccessibleGridControlHeader::implGetBoundingBox()
 
 tools::Rectangle AccessibleGridControlHeader::implGetBoundingBoxOnScreen()
 {
-    tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( nullptr ) );
+    tools::Rectangle aGridRect( m_aTable.GetWindowExtentsAbsolute() );
     tools::Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar()));
     if(isColumnBar())
         return tools::Rectangle(aGridRect.TopLeft(), 
Size(aGridRect.getOpenWidth(),aHeaderRect.getOpenHeight()));
diff --git a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx 
b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
index ba7d4488945c..6e9e6014ee8e 100644
--- a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
+++ b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
@@ -125,7 +125,7 @@ OUString SAL_CALL 
AccessibleGridControlHeaderCell::getImplementationName()
 tools::Rectangle AccessibleGridControlHeaderCell::implGetBoundingBox()
 {
     vcl::Window* pParent = m_aTable.GetAccessibleParentWindow();
-    tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent ) );
+    tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( *pParent ) 
);
     sal_Int32 nIndex = getAccessibleIndexInParent();
     tools::Rectangle aCellRect;
     if(m_eObjType == TCTYPE_COLUMNHEADERCELL)
@@ -138,7 +138,7 @@ tools::Rectangle 
AccessibleGridControlHeaderCell::implGetBoundingBox()
 
 tools::Rectangle AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen()
 {
-    tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( nullptr ) );
+    tools::Rectangle aGridRect( m_aTable.GetWindowExtentsAbsolute() );
     sal_Int32 nIndex = getAccessibleIndexInParent();
     tools::Rectangle aCellRect;
     if(m_eObjType == TCTYPE_COLUMNHEADERCELL)
diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx 
b/accessibility/source/extended/AccessibleGridControlTable.cxx
index 2c50501cba56..579826195be2 100644
--- a/accessibility/source/extended/AccessibleGridControlTable.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTable.cxx
@@ -340,7 +340,7 @@ tools::Rectangle 
AccessibleGridControlTable::implGetBoundingBox()
 {
     vcl::Window* pParent = m_aTable.GetAccessibleParentWindow();
     DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" );
-    tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent ));
+    tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( *pParent ));
     tools::Rectangle aTableRect( m_aTable.calcTableRect() );
     tools::Long nX = aGridRect.Left() + aTableRect.Left();
     tools::Long nY = aGridRect.Top() + aTableRect.Top();
@@ -352,7 +352,7 @@ tools::Rectangle 
AccessibleGridControlTable::implGetBoundingBox()
 
 tools::Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen()
 {
-    tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( nullptr ));
+    tools::Rectangle aGridRect( m_aTable.GetWindowExtentsAbsolute());
     tools::Rectangle aTableRect( m_aTable.calcTableRect() );
     tools::Long nX = aGridRect.Left() + aTableRect.Left();
     tools::Long nY = aGridRect.Top() + aTableRect.Top();
diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx 
b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
index 91d84902bdee..fe59b7eab296 100644
--- a/accessibility/source/extended/AccessibleGridControlTableCell.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
@@ -327,7 +327,7 @@ namespace accessibility
     {
         vcl::Window* pParent = m_aTable.GetAccessibleParentWindow();
         DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" );
-        tools::Rectangle aGridRect = m_aTable.GetWindowExtentsRelative( 
pParent );
+        tools::Rectangle aGridRect = m_aTable.GetWindowExtentsRelative( 
*pParent );
         sal_Int64 nIndex = getAccessibleIndexInParent();
         tools::Rectangle aCellRect = 
m_aTable.calcCellRect(nIndex%m_aTable.GetColumnCount(), 
nIndex/m_aTable.GetColumnCount());
         tools::Long nX = aGridRect.Left() + aCellRect.Left();
@@ -338,7 +338,7 @@ namespace accessibility
 
     tools::Rectangle 
AccessibleGridControlTableCell::implGetBoundingBoxOnScreen()
     {
-        tools::Rectangle aGridRect = m_aTable.GetWindowExtentsRelative( 
nullptr );
+        tools::Rectangle aGridRect = m_aTable.GetWindowExtentsAbsolute();
         sal_Int64 nIndex = getAccessibleIndexInParent();
         tools::Rectangle aCellRect = 
m_aTable.calcCellRect(nIndex%m_aTable.GetColumnCount(), 
nIndex/m_aTable.GetColumnCount());
         tools::Long nX = aGridRect.Left() + aCellRect.Left();
diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx 
b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
index 82e8ba091f22..0edf5535fc12 100644
--- a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
@@ -116,7 +116,7 @@ namespace accessibility
         {
             aRect = m_pIconCtrl->GetBoundingBox( pEntry );
             Point aTopLeft = aRect.TopLeft();
-            aTopLeft += m_pIconCtrl->GetWindowExtentsRelative( nullptr 
).TopLeft();
+            aTopLeft += m_pIconCtrl->GetWindowExtentsAbsolute().TopLeft();
             aRect = tools::Rectangle( aTopLeft, aRect.GetSize() );
         }
 
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx 
b/accessibility/source/extended/accessiblelistboxentry.cxx
index 013bb940ca80..189cb60d56a8 100644
--- a/accessibility/source/extended/accessiblelistboxentry.cxx
+++ b/accessibility/source/extended/accessiblelistboxentry.cxx
@@ -151,7 +151,7 @@ namespace accessibility
         {
             aRect = m_pTreeListBox->GetBoundingRect( pEntry );
             Point aTopLeft = aRect.TopLeft();
-            aTopLeft += m_pTreeListBox->GetWindowExtentsRelative( nullptr 
).TopLeft();
+            aTopLeft += m_pTreeListBox->GetWindowExtentsAbsolute().TopLeft();
             aRect = tools::Rectangle( aTopLeft, aRect.GetSize() );
         }
 
diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx 
b/accessibility/source/standard/accessiblemenucomponent.cxx
index 997abc9817ae..02c67944960e 100644
--- a/accessibility/source/standard/accessiblemenucomponent.cxx
+++ b/accessibility/source/standard/accessiblemenucomponent.cxx
@@ -97,7 +97,7 @@ awt::Rectangle OAccessibleMenuComponent::implGetBounds()
         if ( pWindow )
         {
             // get bounding rectangle of the window in screen coordinates
-            tools::Rectangle aRect = pWindow->GetWindowExtentsRelative( 
nullptr );
+            tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute();
             aBounds = AWTRectangle( aRect );
 
             // get position of the accessible parent in screen coordinates
@@ -234,7 +234,7 @@ awt::Point OAccessibleMenuComponent::getLocationOnScreen(  )
         vcl::Window* pWindow = m_pMenu->GetWindow();
         if ( pWindow )
         {
-            tools::Rectangle aRect = pWindow->GetWindowExtentsRelative( 
nullptr );
+            tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute();
             aPos = AWTPoint( aRect.TopLeft() );
         }
     }
diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx 
b/accessibility/source/standard/accessiblemenuitemcomponent.cxx
index a69b1f12f652..6561ff12d1cf 100644
--- a/accessibility/source/standard/accessiblemenuitemcomponent.cxx
+++ b/accessibility/source/standard/accessiblemenuitemcomponent.cxx
@@ -248,7 +248,7 @@ awt::Rectangle OAccessibleMenuItemComponent::implGetBounds()
         vcl::Window* pWindow = m_pParent->GetWindow();
         if ( pWindow )
         {
-            tools::Rectangle aRect = pWindow->GetWindowExtentsRelative( 
nullptr );
+            tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute();
             awt::Point aWindowScreenLoc = AWTPoint( aRect.TopLeft() );
 
             // get position of accessible parent in screen coordinates
diff --git a/accessibility/source/standard/vclxaccessiblelistitem.cxx 
b/accessibility/source/standard/vclxaccessiblelistitem.cxx
index 55fd0693718d..7f9aa7d109e3 100644
--- a/accessibility/source/standard/vclxaccessiblelistitem.cxx
+++ b/accessibility/source/standard/vclxaccessiblelistitem.cxx
@@ -342,7 +342,7 @@ awt::Point SAL_CALL 
VCLXAccessibleListItem::getLocationOnScreen(  )
     {
         tools::Rectangle aRect = 
pListBoxHelper->GetBoundingRectangle(static_cast<sal_uInt16>(m_nIndexInParent));
         aPoint = aRect.TopLeft();
-        aPoint += pListBoxHelper->GetWindowExtentsRelative().TopLeft();
+        aPoint += pListBoxHelper->GetWindowExtentsAbsolute().TopLeft();
     }
     return AWTPoint( aPoint );
 }
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index b2a7233874c0..2b813e192cb6 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -833,7 +833,8 @@ public:
     virtual bool                    IsCellVisible( sal_Int32 _nRow, sal_uInt16 
_nColumn ) const override;
     virtual OUString                GetAccessibleCellText(sal_Int32 _nRow, 
sal_uInt16 _nColPos) const override;
     virtual bool                    GetGlyphBoundRects( const Point& rOrigin, 
const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& 
rVector ) override;
-    virtual tools::Rectangle        GetWindowExtentsRelative(const vcl::Window 
*pRelativeWindow) const override;
+    virtual tools::Rectangle        GetWindowExtentsAbsolute() const override;
+    virtual tools::Rectangle        GetWindowExtentsRelative(const 
vcl::Window& rRelativeWindow) const override;
     virtual void                    GrabFocus() override;
     virtual css::uno::Reference< css::accessibility::XAccessible > 
GetAccessible() override;
     virtual vcl::Window*            GetAccessibleParentWindow() const override;
diff --git a/include/vcl/accessibletable.hxx b/include/vcl/accessibletable.hxx
index 7d6af73e8934..5eeaa528bdd9 100644
--- a/include/vcl/accessibletable.hxx
+++ b/include/vcl/accessibletable.hxx
@@ -73,7 +73,8 @@ public:
             AccessibleTableControlObjType eObjType ) const= 0;
 
     // Window
-    virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window 
*pRelativeWindow) const = 0;
+    virtual tools::Rectangle GetWindowExtentsAbsolute() const = 0;
+    virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& 
rRelativeWindow) const = 0;
     virtual void GrabFocus()= 0;
     virtual css::uno::Reference< css::accessibility::XAccessible > 
GetAccessible()= 0;
     virtual vcl::Window* GetAccessibleParentWindow() const= 0;
diff --git a/include/vcl/accessibletableprovider.hxx 
b/include/vcl/accessibletableprovider.hxx
index 94e5d85832d1..63f8580ee801 100644
--- a/include/vcl/accessibletableprovider.hxx
+++ b/include/vcl/accessibletableprovider.hxx
@@ -113,7 +113,8 @@ public:
     virtual bool                    GetGlyphBoundRects( const Point& rOrigin, 
const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& 
rVector ) = 0;
 
     // Window
-    virtual tools::Rectangle        GetWindowExtentsRelative(const vcl::Window 
*pRelativeWindow) const = 0;
+    virtual tools::Rectangle        GetWindowExtentsAbsolute() const = 0;
+    virtual tools::Rectangle        GetWindowExtentsRelative(const 
vcl::Window& rRelativeWindow) const = 0;
     virtual void                    GrabFocus() = 0;
     virtual css::uno::Reference< css::accessibility::XAccessible > 
GetAccessible() = 0;
     virtual vcl::Window*                 GetAccessibleParentWindow() const = 0;
diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx
index efed0e36df95..3039c1aebe8d 100644
--- a/include/vcl/toolkit/svtabbx.hxx
+++ b/include/vcl/toolkit/svtabbx.hxx
@@ -192,7 +192,8 @@ public:
     virtual bool                    GetGlyphBoundRects( const Point& rOrigin, 
const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& 
rVector ) override;
 
     // Window
-    virtual tools::Rectangle        GetWindowExtentsRelative(const vcl::Window 
*pRelativeWindow) const override;
+    virtual tools::Rectangle        GetWindowExtentsAbsolute() const override;
+    virtual tools::Rectangle        GetWindowExtentsRelative(const 
vcl::Window& rRelativeWindow) const override;
     virtual void                    GrabFocus() override;
     virtual css::uno::Reference< css::accessibility::XAccessible > 
GetAccessible() override;
     /** Creates and returns the accessible object of the whole BrowseBox. */
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index c6ba57ef7e35..4eb929804573 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -695,8 +695,6 @@ private:
 
     SAL_DLLPRIVATE vcl::Window*         ImplGetTopmostFrameWindow();
 
-    SAL_DLLPRIVATE tools::Rectangle     ImplGetWindowExtentsRelative(const 
vcl::Window *pRelativeWindow) const;
-
     SAL_DLLPRIVATE bool                 ImplStopDnd();
     SAL_DLLPRIVATE void                 ImplStartDnd();
 
@@ -947,8 +945,10 @@ public:
     Point                               OutputToAbsoluteScreenPixel( const 
Point& rPos ) const;
     Point                               AbsoluteScreenToOutputPixel( const 
Point& rPos ) const;
     tools::Rectangle                    GetDesktopRectPixel() const;
-    //  window extents including border and decoration
-    tools::Rectangle                    GetWindowExtentsRelative(const 
vcl::Window *pRelativeWindow) const;
+    //  window extents including border and decoration, relative to passed in 
window
+    tools::Rectangle                    GetWindowExtentsRelative(const 
vcl::Window& rRelativeWindow) const;
+    //  window extents including border and decoration, in absolute screen 
coordinates
+    tools::Rectangle                    GetWindowExtentsAbsolute() const;
 
     bool                                IsScrollable() const;
     virtual void                        Scroll( tools::Long nHorzScroll, 
tools::Long nVertScroll,
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx 
b/sc/source/ui/Accessibility/AccessibleCell.cxx
index 96020a08ef63..ef59f0f07c0a 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -162,7 +162,7 @@ tools::Rectangle ScAccessibleCell::GetBoundingBoxOnScreen() 
const
         vcl::Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
         if (pWindow)
         {
-            tools::Rectangle aRect = 
pWindow->GetWindowExtentsRelative(nullptr);
+            tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute();
             aCellRect.Move(aRect.Left(), aRect.Top());
         }
     }
@@ -183,7 +183,7 @@ tools::Rectangle ScAccessibleCell::GetBoundingBox() const
         vcl::Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
         if (pWindow)
         {
-            tools::Rectangle 
aRect(pWindow->GetWindowExtentsRelative(pWindow->GetAccessibleParentWindow()));
+            tools::Rectangle 
aRect(pWindow->GetWindowExtentsRelative(*pWindow->GetAccessibleParentWindow()));
             aRect.Move(-aRect.Left(), -aRect.Top());
             aCellRect = aRect.Intersection(aCellRect);
         }
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 6311947f144e..8a6ed0723e43 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -2011,7 +2011,7 @@ Point ScAccessibleDocument::LogicToPixel (const Point& 
rPoint) const
     if (pWin)
     {
         aPoint = pWin->LogicToPixel(rPoint, pWin->GetDrawMapMode());
-        aPoint += pWin->GetWindowExtentsRelative(nullptr).TopLeft();
+        aPoint += pWin->GetWindowExtentsAbsolute().TopLeft();
     }
     return aPoint;
 }
@@ -2061,7 +2061,7 @@ tools::Rectangle 
ScAccessibleDocument::GetBoundingBoxOnScreen() const
     {
         vcl::Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
         if (pWindow)
-            aRect = pWindow->GetWindowExtentsRelative(nullptr);
+            aRect = pWindow->GetWindowExtentsAbsolute();
     }
     return aRect;
 }
@@ -2073,7 +2073,7 @@ tools::Rectangle ScAccessibleDocument::GetBoundingBox() 
const
     {
         vcl::Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
         if (pWindow)
-            aRect = 
pWindow->GetWindowExtentsRelative(pWindow->GetAccessibleParentWindow());
+            aRect = 
pWindow->GetWindowExtentsRelative(*pWindow->GetAccessibleParentWindow());
     }
     return aRect;
 }
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx 
b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index 09e01e939693..9f8af9e648ee 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -1494,7 +1494,7 @@ tools::Rectangle 
ScAccessibleDocumentPagePreview::GetBoundingBoxOnScreen() const
     {
         vcl::Window* pWindow = mpViewShell->GetWindow();
         if (pWindow)
-            aRect = pWindow->GetWindowExtentsRelative(nullptr);
+            aRect = pWindow->GetWindowExtentsAbsolute();
     }
     return aRect;
 }
@@ -1506,7 +1506,7 @@ tools::Rectangle 
ScAccessibleDocumentPagePreview::GetBoundingBox() const
     {
         vcl::Window* pWindow = mpViewShell->GetWindow();
         if (pWindow)
-            aRect = 
pWindow->GetWindowExtentsRelative(pWindow->GetAccessibleParentWindow());
+            aRect = 
pWindow->GetWindowExtentsRelative(*pWindow->GetAccessibleParentWindow());
     }
     return aRect;
 }
diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx 
b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
index d500aa2a3a21..94e488a8ca33 100644
--- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx
+++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
@@ -196,7 +196,7 @@ tools::Rectangle 
ScAccessibleEditObject::GetBoundingBoxOnScreen() const
                 MapMode aMapMode( mpEditView->GetEditEngine()->GetRefMapMode() 
);
                 aScreenBounds = mpWindow->LogicToPixel( 
mpEditView->GetOutputArea(), aMapMode );
                 Point aCellLoc = aScreenBounds.TopLeft();
-                tools::Rectangle aWindowRect = 
mpWindow->GetWindowExtentsRelative( nullptr );
+                tools::Rectangle aWindowRect = 
mpWindow->GetWindowExtentsAbsolute();
                 Point aWindowLoc = aWindowRect.TopLeft();
                 Point aPos( aCellLoc.getX() + aWindowLoc.getX(), 
aCellLoc.getY() + aWindowLoc.getY() );
                 aScreenBounds.SetPos( aPos );
@@ -204,7 +204,7 @@ tools::Rectangle 
ScAccessibleEditObject::GetBoundingBoxOnScreen() const
         }
         else
         {
-            aScreenBounds = mpWindow->GetWindowExtentsRelative( nullptr );
+            aScreenBounds = mpWindow->GetWindowExtentsAbsolute();
         }
     }
 
diff --git a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx 
b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
index 075f72b0c349..909556e3586d 100644
--- a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
@@ -309,7 +309,7 @@ tools::Rectangle 
ScAccessiblePageHeader::GetBoundingBoxOnScreen() const
         vcl::Window* pWindow = mpViewShell->GetWindow();
         if (pWindow)
         {
-            tools::Rectangle aRect = 
pWindow->GetWindowExtentsRelative(nullptr);
+            tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute();
             aCellRect.Move(aRect.Left(), aRect.Top());
         }
     }
@@ -331,7 +331,7 @@ tools::Rectangle ScAccessiblePageHeader::GetBoundingBox() 
const
         tools::Rectangle aClipRect(Point(0, 0), aRect.GetSize());
         vcl::Window* pWindow = mpViewShell->GetWindow();
         if (pWindow)
-            aClipRect = 
pWindow->GetWindowExtentsRelative(pWindow->GetAccessibleParentWindow());
+            aClipRect = 
pWindow->GetWindowExtentsRelative(*pWindow->GetAccessibleParentWindow());
         aRect = aClipRect.GetIntersection(aRect);
     }
     if (aRect.IsEmpty())
diff --git a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx 
b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx
index e36b1c78875f..2e70dedd915d 100644
--- a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx
@@ -200,7 +200,7 @@ tools::Rectangle 
ScAccessiblePreviewCell::GetBoundingBoxOnScreen() const
         vcl::Window* pWindow = mpViewShell->GetWindow();
         if (pWindow)
         {
-            tools::Rectangle aRect = 
pWindow->GetWindowExtentsRelative(nullptr);
+            tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute();
             aCellRect.Move(aRect.Left(), aRect.Top());
         }
     }
diff --git a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx 
b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx
index c7b767d0eb0b..9203fe9c3157 100644
--- a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx
@@ -301,7 +301,7 @@ tools::Rectangle 
ScAccessiblePreviewHeaderCell::GetBoundingBoxOnScreen() const
         vcl::Window* pWindow = mpViewShell->GetWindow();
         if (pWindow)
         {
-            tools::Rectangle aRect = 
pWindow->GetWindowExtentsRelative(nullptr);
+            tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute();
             aCellRect.Move(aRect.Left(), aRect.Top());
         }
     }
diff --git a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx 
b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
index 236102484dcc..8300078c00ed 100644
--- a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
@@ -586,7 +586,7 @@ tools::Rectangle 
ScAccessiblePreviewTable::GetBoundingBoxOnScreen() const
         vcl::Window* pWindow = mpViewShell->GetWindow();
         if (pWindow)
         {
-            tools::Rectangle aRect = 
pWindow->GetWindowExtentsRelative(nullptr);
+            tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute();
             aCellRect.Move(aRect.Left(), aRect.Top());
         }
     }
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx 
b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index 03b92c39b996..ec7be67d80f3 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -1326,7 +1326,7 @@ tools::Rectangle 
ScAccessibleSpreadsheet::GetBoundingBoxOnScreen() const
     {
         vcl::Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
         if (pWindow)
-            aRect = pWindow->GetWindowExtentsRelative(nullptr);
+            aRect = pWindow->GetWindowExtentsAbsolute();
     }
     return aRect;
 }
@@ -1339,7 +1339,7 @@ tools::Rectangle 
ScAccessibleSpreadsheet::GetBoundingBox() const
         vcl::Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
         if (pWindow)
             //#101986#; extends to the same window, because the parent is the 
document and it has the same window
-            aRect = pWindow->GetWindowExtentsRelative(pWindow);
+            aRect = pWindow->GetWindowExtentsRelative(*pWindow);
     }
     return aRect;
 }
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 0056a737543c..e92c45deec39 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -1902,7 +1902,7 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const 
OUString& aPropertyName
             vcl::Window* pActiveWin = rViewData.GetActiveWin();
             if ( pActiveWin )
             {
-                tools::Rectangle aRect = pActiveWin->GetWindowExtentsRelative( 
nullptr );
+                tools::Rectangle aRect = 
pActiveWin->GetWindowExtentsAbsolute();
                 aRet <<= AWTRectangle( aRect );
             }
         }
diff --git a/sd/source/ui/accessibility/AccessibleViewForwarder.cxx 
b/sd/source/ui/accessibility/AccessibleViewForwarder.cxx
index 09225e27ff06..d28e69217ec2 100644
--- a/sd/source/ui/accessibility/AccessibleViewForwarder.cxx
+++ b/sd/source/ui/accessibility/AccessibleViewForwarder.cxx
@@ -79,7 +79,7 @@ Point AccessibleViewForwarder::LogicToPixel(const Point& 
rPoint) const
     {
         SdrPaintWindow* pPaintWindow = 
mpView->GetPaintWindow(static_cast<sal_uInt32>(mnWindowId));
         OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
-        ::tools::Rectangle 
aBBox(rOutDev.GetOwnerWindow()->GetWindowExtentsRelative(nullptr));
+        ::tools::Rectangle 
aBBox(rOutDev.GetOwnerWindow()->GetWindowExtentsAbsolute());
         return rOutDev.LogicToPixel(rPoint) + aBBox.TopLeft();
     }
     else
diff --git a/sd/source/ui/presenter/PresenterCanvas.cxx 
b/sd/source/ui/presenter/PresenterCanvas.cxx
index e9031c66c57c..5791204c8fb8 100644
--- a/sd/source/ui/presenter/PresenterCanvas.cxx
+++ b/sd/source/ui/presenter/PresenterCanvas.cxx
@@ -565,7 +565,7 @@ awt::Point PresenterCanvas::GetOffset (const 
Reference<awt::XWindow>& rxBaseWind
         VclPtr<vcl::Window> pSharedWindow = 
VCLUnoHelper::GetWindow(rxBaseWindow);
         if (pWindow && pSharedWindow)
         {
-            ::tools::Rectangle aBox = 
pWindow->GetWindowExtentsRelative(pSharedWindow);
+            ::tools::Rectangle aBox = 
pWindow->GetWindowExtentsRelative(*pSharedWindow);
 
             // Calculate offset of this canvas with respect to the shared
             // canvas.
@@ -591,7 +591,7 @@ awt::Point PresenterCanvas::GetOffset (const 
Reference<awt::XWindow>& rxBaseWind
     // Get the bounding box of the window and create a range in the
     // coordinate system of the child window.
     // Use the window extents.
-    ::tools::Rectangle aLocalClip = 
pWindow->GetWindowExtentsRelative(pSharedWindow);
+    ::tools::Rectangle aLocalClip = 
pWindow->GetWindowExtentsRelative(*pSharedWindow);
 
     // The local clip rectangle is used to clip the view state clipping
     // polygon.
diff --git a/sd/source/ui/presenter/PresenterHelper.cxx 
b/sd/source/ui/presenter/PresenterHelper.cxx
index cc85e6353f79..197afd5f404f 100644
--- a/sd/source/ui/presenter/PresenterHelper.cxx
+++ b/sd/source/ui/presenter/PresenterHelper.cxx
@@ -458,7 +458,7 @@ awt::Rectangle PresenterHelper::getWindowExtentsRelative (
     VclPtr<vcl::Window> pParentWindow = 
VCLUnoHelper::GetWindow(rxParentWindow);
     if (pChildWindow && pParentWindow)
     {
-        ::tools::Rectangle aBox 
(pChildWindow->GetWindowExtentsRelative(pParentWindow));
+        ::tools::Rectangle aBox 
(pChildWindow->GetWindowExtentsRelative(*pParentWindow));
         return 
awt::Rectangle(aBox.Left(),aBox.Top(),aBox.GetWidth(),aBox.GetHeight());
     }
     else
diff --git a/sd/source/ui/slidesorter/view/SlsToolTip.cxx 
b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
index c266bbe3db8e..0bd9917e2619 100644
--- a/sd/source/ui/slidesorter/view/SlsToolTip.cxx
+++ b/sd/source/ui/slidesorter/view/SlsToolTip.cxx
@@ -123,7 +123,7 @@ void ToolTip::DoShow()
     vcl::Window* pParent (pWindow);
     while (pParent!=nullptr && pParent->GetParent()!=nullptr)
         pParent = pParent->GetParent();
-    const Point aOffset (pWindow->GetWindowExtentsRelative(pParent).TopLeft());
+    const Point aOffset 
(pWindow->GetWindowExtentsRelative(*pParent).TopLeft());
 
     // We do not know how high the tool tip will be but want its top
     // edge not its bottom to be at a specific position (a little below
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index e676bec19d4e..e06407e017e2 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -2276,7 +2276,7 @@ void SfxHelpWindow_Impl::SaveConfig()
 
     aViewOpt.SetVisible( bIndex );
     VclPtr<vcl::Window> pScreenWin = VCLUnoHelper::GetWindow( xWindow );
-    aWinPos = pScreenWin->GetWindowExtentsRelative( nullptr ).TopLeft();
+    aWinPos = pScreenWin->GetWindowExtentsAbsolute().TopLeft();
     if (bSplit)
         nIndexSize = round(m_xContainer->get_position() * 100.0 / nWidth);
     const OUString aUserData = OUString::number( nIndexSize )
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()
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index deedc3b510a1..4d72a1387d5f 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -231,7 +231,7 @@ awt::Rectangle SAL_CALL 
SwAccessibleDocumentBase::getBounds()
             throw uno::RuntimeException("no Window", 
static_cast<cppu::OWeakObject*>(this));
         }
 
-        tools::Rectangle aPixBounds( pWin->GetWindowExtentsRelative( 
pWin->GetAccessibleParentWindow() ) );
+        tools::Rectangle aPixBounds( pWin->GetWindowExtentsRelative( 
*pWin->GetAccessibleParentWindow() ) );
         awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
                              aPixBounds.GetWidth(), aPixBounds.GetHeight() );
 
@@ -253,7 +253,7 @@ awt::Point SAL_CALL SwAccessibleDocumentBase::getLocation()
         throw uno::RuntimeException("no Window", 
static_cast<cppu::OWeakObject*>(this));
     }
 
-    Point aPixPos( pWin->GetWindowExtentsRelative( 
pWin->GetAccessibleParentWindow() ).TopLeft() );
+    Point aPixPos( pWin->GetWindowExtentsRelative( 
*pWin->GetAccessibleParentWindow() ).TopLeft() );
     awt::Point aLoc( aPixPos.getX(), aPixPos.getY() );
 
     return aLoc;
@@ -269,7 +269,7 @@ css::awt::Point SAL_CALL 
SwAccessibleDocumentBase::getLocationOnScreen()
         throw uno::RuntimeException("no Window", 
static_cast<cppu::OWeakObject*>(this));
     }
 
-    Point aPixPos( pWin->GetWindowExtentsRelative( nullptr ).TopLeft() );
+    Point aPixPos( pWin->GetWindowExtentsAbsolute().TopLeft() );
     awt::Point aLoc( aPixPos.getX(), aPixPos.getY() );
 
     return aLoc;
@@ -285,7 +285,7 @@ css::awt::Size SAL_CALL SwAccessibleDocumentBase::getSize()
         throw uno::RuntimeException("no Window", 
static_cast<cppu::OWeakObject*>(this));
     }
 
-    Size aPixSize( pWin->GetWindowExtentsRelative( nullptr ).GetSize() );
+    Size aPixSize( pWin->GetWindowExtentsAbsolute().GetSize() );
     awt::Size aSize( aPixSize.Width(), aPixSize.Height() );
 
     return aSize;
@@ -302,7 +302,7 @@ sal_Bool SAL_CALL SwAccessibleDocumentBase::containsPoint(
         throw uno::RuntimeException("no Window", 
static_cast<cppu::OWeakObject*>(this));
     }
 
-    tools::Rectangle aPixBounds( pWin->GetWindowExtentsRelative( nullptr ) );
+    tools::Rectangle aPixBounds( pWin->GetWindowExtentsAbsolute() );
     aPixBounds.Move(-aPixBounds.Left(), -aPixBounds.Top());
 
     Point aPixPoint( aPoint.X, aPoint.Y );
@@ -327,7 +327,7 @@ uno::Reference< XAccessible > SAL_CALL 
SwAccessibleDocumentBase::getAccessibleAt
             return nullptr;
 
         Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to window
-        if( mpChildWin->GetWindowExtentsRelative( pWin ).Contains( aPixPoint ) 
)
+        if( mpChildWin->GetWindowExtentsRelative( *pWin ).Contains( aPixPoint 
) )
             return mpChildWin->GetAccessible();
     }
 
diff --git a/toolkit/inc/controls/table/tablecontrol.hxx 
b/toolkit/inc/controls/table/tablecontrol.hxx
index 960d33dca326..aae87ed4cba0 100644
--- a/toolkit/inc/controls/table/tablecontrol.hxx
+++ b/toolkit/inc/controls/table/tablecontrol.hxx
@@ -127,7 +127,8 @@ namespace svt::table
 
 
         // IAccessibleTable
-        virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window 
*pRelativeWindow) const override;
+        virtual tools::Rectangle GetWindowExtentsAbsolute() const override;
+        virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& 
rRelativeWindow) const override;
         virtual void GrabFocus() override;
         virtual css::uno::Reference< css::accessibility::XAccessible > 
GetAccessible() override;
         virtual vcl::Window* GetAccessibleParentWindow() const override;
diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx 
b/toolkit/source/awt/vclxaccessiblecomponent.cxx
index 2c9565fec9a7..19ba5c4fbfc2 100644
--- a/toolkit/source/awt/vclxaccessiblecomponent.cxx
+++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -708,12 +708,12 @@ awt::Rectangle VCLXAccessibleComponent::implGetBounds()
     VclPtr<vcl::Window> pWindow = GetWindow();
     if ( pWindow )
     {
-        tools::Rectangle aRect = pWindow->GetWindowExtentsRelative( nullptr );
+        tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute();
         aBounds = AWTRectangle( aRect );
         vcl::Window* pParent = pWindow->GetAccessibleParentWindow();
         if ( pParent )
         {
-            tools::Rectangle aParentRect = pParent->GetWindowExtentsRelative( 
nullptr );
+            tools::Rectangle aParentRect = pParent->GetWindowExtentsAbsolute();
             awt::Point aParentScreenLoc = AWTPoint( aParentRect.TopLeft() );
             aBounds.X -= aParentScreenLoc.X;
             aBounds.Y -= aParentScreenLoc.Y;
@@ -730,7 +730,7 @@ awt::Point VCLXAccessibleComponent::getLocationOnScreen(  )
     awt::Point aPos;
     if ( GetWindow() )
     {
-        tools::Rectangle aRect = GetWindow()->GetWindowExtentsRelative( 
nullptr );
+        tools::Rectangle aRect = GetWindow()->GetWindowExtentsAbsolute();
         aPos.X = aRect.Left();
         aPos.Y = aRect.Top();
     }
diff --git a/toolkit/source/controls/table/tablecontrol.cxx 
b/toolkit/source/controls/table/tablecontrol.cxx
index 1281e7e9b436..92ec7535f04c 100644
--- a/toolkit/source/controls/table/tablecontrol.cxx
+++ b/toolkit/source/controls/table/tablecontrol.cxx
@@ -479,9 +479,14 @@ namespace svt::table
             m_pImpl->commitTableEvent( i_eventID, i_newValue, i_oldValue );
     }
 
-    tools::Rectangle TableControl::GetWindowExtentsRelative(const vcl::Window 
*pRelativeWindow) const
+    tools::Rectangle TableControl::GetWindowExtentsAbsolute() const
     {
-        return Control::GetWindowExtentsRelative( pRelativeWindow );
+        return Control::GetWindowExtentsAbsolute();
+    }
+
+    tools::Rectangle TableControl::GetWindowExtentsRelative(const vcl::Window& 
rRelativeWindow) const
+    {
+        return Control::GetWindowExtentsRelative( rRelativeWindow );
     }
 
     void TableControl::GrabFocus()
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx 
b/vbahelper/source/vbahelper/vbahelper.cxx
index db59398763c0..6fe0928686ef 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -892,7 +892,7 @@ double UserFormGeometryHelper::implGetSize( bool bHeight, 
bool bOuter ) const
     {
         if( const vcl::Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ) )
         {
-            tools::Rectangle aOuterRect = pWindow->GetWindowExtentsRelative( 
nullptr );
+            tools::Rectangle aOuterRect = pWindow->GetWindowExtentsAbsolute();
             aSizePixel = awt::Size( aOuterRect.getOpenWidth(), 
aOuterRect.getOpenHeight() );
         }
     }
@@ -916,7 +916,7 @@ void UserFormGeometryHelper::implSetSize( double fSize, 
bool bHeight, bool bOute
     {
         if( const vcl::Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ) )
         {
-            tools::Rectangle aOuterRect = pWindow->GetWindowExtentsRelative( 
nullptr );
+            tools::Rectangle aOuterRect = pWindow->GetWindowExtentsAbsolute();
             if( !aOuterRect.IsEmpty() )
             {
                 awt::Rectangle aInnerRect = mxWindow->getPosSize();
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index bd1778308314..ff59e7f4d156 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -597,7 +597,7 @@ bool SalInstanceWidget::get_extents_relative_to(const 
Widget& rRelative, int& x,
                                                 int& height) const
 {
     tools::Rectangle aRect(m_xWidget->GetWindowExtentsRelative(
-        dynamic_cast<const SalInstanceWidget&>(rRelative).getWidget()));
+        *dynamic_cast<const SalInstanceWidget&>(rRelative).getWidget()));
     x = aRect.Left();
     y = aRect.Top();
     width = aRect.GetWidth();
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 0edd309ba7f2..fb610c116767 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1332,7 +1332,7 @@ sal_Int32 ComboBox::GetTopEntry() const
 tools::Rectangle ComboBox::GetDropDownPosSizePixel() const
 {
     return m_pImpl->m_pFloatWin
-        ? m_pImpl->m_pFloatWin->GetWindowExtentsRelative(this)
+        ? m_pImpl->m_pFloatWin->GetWindowExtentsRelative(*this)
         : tools::Rectangle();
 }
 
@@ -1389,7 +1389,7 @@ void ComboBox::SetNoSelection()
 tools::Rectangle ComboBox::GetBoundingRectangle( sal_Int32 nItem ) const
 {
     tools::Rectangle aRect = GetMainWindow()->GetBoundingRectangle( nItem );
-    tools::Rectangle aOffset = GetMainWindow()->GetWindowExtentsRelative( 
static_cast<vcl::Window*>(const_cast<ComboBox *>(this)) );
+    tools::Rectangle aOffset = GetMainWindow()->GetWindowExtentsRelative( 
*static_cast<vcl::Window*>(const_cast<ComboBox *>(this)) );
     aRect.Move( aOffset.Left(), aOffset.Top() );
     return aRect;
 }
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index e87b587418ff..01454ef98c00 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -281,7 +281,7 @@ void Control::AppendLayoutData( const Control& rSubControl 
) const
     for( n = 1; n < nLines; n++ )
         mxLayoutData->m_aLineIndices.push_back( 
rSubControl.mxLayoutData->m_aLineIndices[n] + nCurrentIndex );
     int nRectangles = rSubControl.mxLayoutData->m_aUnicodeBoundRects.size();
-    tools::Rectangle aRel = rSubControl.GetWindowExtentsRelative(this);
+    tools::Rectangle aRel = rSubControl.GetWindowExtentsRelative(*this);
     for( n = 0; n < nRectangles; n++ )
     {
         tools::Rectangle aRect = 
rSubControl.mxLayoutData->m_aUnicodeBoundRects[n];
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index d60e5e030476..79b971636125 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -1121,7 +1121,7 @@ bool ListBox::IsInDropDown() const
 tools::Rectangle ListBox::GetBoundingRectangle( sal_Int32 nItem ) const
 {
     tools::Rectangle aRect = mpImplLB->GetMainWindow()->GetBoundingRectangle( 
nItem );
-    tools::Rectangle aOffset = 
mpImplLB->GetMainWindow()->GetWindowExtentsRelative( 
static_cast<vcl::Window*>(const_cast<ListBox *>(this)) );
+    tools::Rectangle aOffset = 
mpImplLB->GetMainWindow()->GetWindowExtentsRelative( 
*static_cast<vcl::Window*>(const_cast<ListBox *>(this)) );
     aRect.Move( aOffset.Left(), aOffset.Top() );
     return aRect;
 }
@@ -1375,7 +1375,7 @@ sal_uInt16 ListBox::GetDisplayLineCount() const
 
 tools::Rectangle ListBox::GetDropDownPosSizePixel() const
 {
-    return mpFloatWin ? mpFloatWin->GetWindowExtentsRelative(this) : 
tools::Rectangle();
+    return mpFloatWin ? mpFloatWin->GetWindowExtentsRelative(*this) : 
tools::Rectangle();
 }
 
 const Wallpaper& ListBox::GetDisplayBackground() const
diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index 86c215dd21b6..e784d5347f35 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -756,19 +756,17 @@ tools::Rectangle SvHeaderTabListBox::calcHeaderRect( bool 
_bIsColumnBar, bool _b
         if ( !_bOnScreen )
             pParent = m_pImpl->m_pHeaderBar->GetAccessibleParentWindow();
 
-        aRect = m_pImpl->m_pHeaderBar->GetWindowExtentsRelative( pParent );
+        aRect = m_pImpl->m_pHeaderBar->GetWindowExtentsRelative( *pParent );
     }
     return aRect;
 }
 
 tools::Rectangle SvHeaderTabListBox::calcTableRect( bool _bOnScreen )
 {
-    vcl::Window* pParent = nullptr;
-    if ( !_bOnScreen )
-        pParent = GetAccessibleParentWindow();
-
-    tools::Rectangle aRect( GetWindowExtentsRelative( pParent ) );
-    return aRect;
+    if ( _bOnScreen )
+        return GetWindowExtentsAbsolute();
+    else
+        return GetWindowExtentsRelative( *GetAccessibleParentWindow() );
 }
 
 tools::Rectangle SvHeaderTabListBox::GetFieldRectPixelAbs( sal_Int32 _nRow, 
sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen )
@@ -785,11 +783,11 @@ tools::Rectangle 
SvHeaderTabListBox::GetFieldRectPixelAbs( sal_Int32 _nRow, sal_
         aTopLeft.setX( aItemRect.Left() );
         Size aSize = aItemRect.GetSize();
         aRect = tools::Rectangle( aTopLeft, aSize );
-        vcl::Window* pParent = nullptr;
-        if ( !_bOnScreen )
-            pParent = GetAccessibleParentWindow();
         aTopLeft = aRect.TopLeft();
-        aTopLeft += GetWindowExtentsRelative( pParent ).TopLeft();
+        if (_bOnScreen)
+            aTopLeft += GetWindowExtentsAbsolute().TopLeft();
+        else
+            aTopLeft += GetWindowExtentsRelative( *GetAccessibleParentWindow() 
).TopLeft();
         aRect = tools::Rectangle( aTopLeft, aRect.GetSize() );
     }
 
@@ -1035,9 +1033,14 @@ bool SvHeaderTabListBox::GetGlyphBoundRects( const 
Point& rOrigin, const OUStrin
     return GetOutDev()->GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, 
rVector );
 }
 
-tools::Rectangle SvHeaderTabListBox::GetWindowExtentsRelative(const 
vcl::Window *pRelativeWindow) const
+tools::Rectangle SvHeaderTabListBox::GetWindowExtentsAbsolute() const
+{
+    return Control::GetWindowExtentsAbsolute();
+}
+
+tools::Rectangle SvHeaderTabListBox::GetWindowExtentsRelative(const 
vcl::Window& rRelativeWindow) const
 {
-    return Control::GetWindowExtentsRelative( pRelativeWindow );
+    return Control::GetWindowExtentsRelative( rRelativeWindow );
 }
 
 void SvHeaderTabListBox::GrabFocus()
diff --git a/vcl/source/window/menufloatingwindow.cxx 
b/vcl/source/window/menufloatingwindow.cxx
index cfd6a6ae190e..3fb13ee1deee 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -99,7 +99,7 @@ void MenuFloatingWindow::doShutdown()
     // so this can be taken into account if the commandhandler performs a 
scroll operation
     if( GetParent() )
     {
-        tools::Rectangle aInvRect( GetWindowExtentsRelative( GetParent() ) );
+        tools::Rectangle aInvRect( GetWindowExtentsRelative( *GetParent() ) );
         GetParent()->Invalidate( aInvRect );
     }
     pMenu = nullptr;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 8e24ef5a87a6..79d966383877 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2913,13 +2913,18 @@ tools::Rectangle 
Window::ImplUnmirroredAbsoluteScreenToOutputPixel( const tools:
 }
 
 
-tools::Rectangle Window::GetWindowExtentsRelative(const vcl::Window 
*pRelativeWindow) const
+// with decoration
+tools::Rectangle Window::GetWindowExtentsRelative(const vcl::Window & 
rRelativeWindow) const
 {
-    // with decoration
-    return ImplGetWindowExtentsRelative( pRelativeWindow );
+    tools::Rectangle aRect = GetWindowExtentsAbsolute();
+    // #106399# express coordinates relative to borderwindow
+    const vcl::Window *pRelWin = rRelativeWindow.mpWindowImpl->mpBorderWindow 
? rRelativeWindow.mpWindowImpl->mpBorderWindow.get() : &rRelativeWindow;
+    aRect.SetPos( pRelWin->AbsoluteScreenToOutputPixel( aRect.GetPos() ) );
+    return aRect;
 }
 
-tools::Rectangle Window::ImplGetWindowExtentsRelative(const vcl::Window 
*pRelativeWindow) const
+// with decoration
+tools::Rectangle Window::GetWindowExtentsAbsolute() const
 {
     // make sure we use the extent of our border window,
     // otherwise we miss a few pixels
@@ -2936,12 +2941,6 @@ tools::Rectangle 
Window::ImplGetWindowExtentsRelative(const vcl::Window *pRelati
         aSize.AdjustWidth(g.leftDecoration() + g.rightDecoration() );
         aSize.AdjustHeight(g.topDecoration() + g.bottomDecoration() );
     }
-    if( pRelativeWindow )
-    {
-        // #106399# express coordinates relative to borderwindow
-        const vcl::Window *pRelWin = 
pRelativeWindow->mpWindowImpl->mpBorderWindow ? 
pRelativeWindow->mpWindowImpl->mpBorderWindow.get() : pRelativeWindow;
-        aPos = pRelWin->AbsoluteScreenToOutputPixel( aPos );
-    }
     return tools::Rectangle( aPos, aSize );
 }
 
commit 669d6ed4fa2e7a01c372a6e27dd5468ec8eb3077
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Jul 19 14:30:37 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Jul 20 08:15:20 2023 +0200

    simplify the operation of ImplGetWindowExtentsRelative
    
    instead of inlining OutputToAbsoluteScreenPixel
    
    Change-Id: I4914392e6dfb5c1ace7041642fecbaa084cf7626
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154652
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index c07433173287..8e24ef5a87a6 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2921,18 +2921,16 @@ tools::Rectangle Window::GetWindowExtentsRelative(const 
vcl::Window *pRelativeWi
 
 tools::Rectangle Window::ImplGetWindowExtentsRelative(const vcl::Window 
*pRelativeWindow) const
 {
-    SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
     // make sure we use the extent of our border window,
     // otherwise we miss a few pixels
     const vcl::Window *pWin = mpWindowImpl->mpBorderWindow ? 
mpWindowImpl->mpBorderWindow : this;
 
-    Point aPos( pWin->OutputToScreenPixel( Point(0,0) ) );
-    aPos.AdjustX(g.x() );
-    aPos.AdjustY(g.y() );
+    Point aPos( pWin->OutputToAbsoluteScreenPixel( Point(0,0) ) );
     Size aSize ( pWin->GetSizePixel() );
     // #104088# do not add decoration to the workwindow to be compatible to 
java accessibility api
     if( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && 
mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame && GetType() != 
WindowType::WORKWINDOW) )
     {
+        SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
         aPos.AdjustX( -sal_Int32(g.leftDecoration()) );
         aPos.AdjustY( -sal_Int32(g.topDecoration()) );
         aSize.AdjustWidth(g.leftDecoration() + g.rightDecoration() );

Reply via email to