include/svtools/brwbox.hxx | 22 +--------- include/vcl/accessibletableprovider.hxx | 6 +- include/vcl/toolkit/svtabbx.hxx | 6 +- svtools/source/brwbox/brwbox2.cxx | 21 ++-------- vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx | 2 vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx | 2 vcl/source/accessibility/AccessibleBrowseBoxTable.cxx | 2 vcl/source/accessibility/accessiblebrowseboxcell.cxx | 4 - vcl/source/treelist/svtabbx.cxx | 27 +++---------- 9 files changed, 28 insertions(+), 64 deletions(-)
New commits: commit 6d87fa009153ee32bc2b5a8e97fa0072d13f64ef Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Feb 5 12:17:21 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Feb 7 09:18:08 2025 +0100 browsebox a11y: Drop '_bOnScreen' param It's always `false` since commit 261dd0fd48b2e2c284485c25feade854154595aa Author: Michael Weghorn <m.wegh...@posteo.de> Date: Fri Jan 31 11:40:09 2025 +0100 browsebox a11y: Use comphelper::OAccessibleComponentHelper , so dro the param altogether to simplify code. Change-Id: If184b3103f87a7d5391ed97b673ed10ed9953f60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181166 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index 244c2dde015b..80b3636b4b37 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -678,32 +678,18 @@ public: /** returns the Rectangle for either the column header bar or the row header bar @param _bIsColumnBar <TRUE/> when column header bar is used - @param _bOnScreen - <TRUE/> when the rectangle should be calculated OnScreen @return the Rectangle */ - virtual tools::Rectangle calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen = true) override; + virtual tools::Rectangle calcHeaderRect(bool _bIsColumnBar) override; - /** calculates the Rectangle of the table - @param _bOnScreen - <TRUE/> when the rectangle should be calculated OnScreen + /** calculates the Rectangle of the table relative to the BrowseBox. @return the Rectangle */ - virtual tools::Rectangle calcTableRect(bool _bOnScreen = true) override; + virtual tools::Rectangle calcTableRect() override; - /** - @param _nRowId - the current row - @param _nColId - the column id - @param _bOnScreen - <TRUE/> when the rectangle should be calculated OnScreen - @return - the Rectangle - */ - virtual tools::Rectangle calcFieldRectPixel(sal_Int32 _nRowId, sal_uInt16 _nColId, bool _bIsHeader, bool _bOnScreen) override; + virtual tools::Rectangle calcFieldRectPixel(sal_Int32 _nRowId, sal_uInt16 _nColId, bool _bIsHeader) override; /// return <TRUE/> if and only if the accessible object for this instance has been created and is alive SAL_DLLPRIVATE bool isAccessibleAlive( ) const; diff --git a/include/vcl/accessibletableprovider.hxx b/include/vcl/accessibletableprovider.hxx index ef6ea4f2071e..2d6f48dea846 100644 --- a/include/vcl/accessibletableprovider.hxx +++ b/include/vcl/accessibletableprovider.hxx @@ -86,9 +86,9 @@ public: virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0; virtual OUString GetAccessibleCellText( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0; - virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) = 0; - virtual tools::Rectangle calcTableRect( bool _bOnScreen = true ) = 0; - virtual tools::Rectangle calcFieldRectPixel( sal_Int32 _nRow, sal_uInt16 _nColumnPos, bool _bIsHeader, bool _bOnScreen ) = 0; + virtual tools::Rectangle calcHeaderRect(bool _bIsColumnBar) = 0; + virtual tools::Rectangle calcTableRect() = 0; + virtual tools::Rectangle calcFieldRectPixel(sal_Int32 _nRow, sal_uInt16 _nColumnPos, bool _bIsHeader) = 0; virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) = 0; virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) = 0; diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx index 0bddb16aa900..8446d24bbd53 100644 --- a/include/vcl/toolkit/svtabbx.hxx +++ b/include/vcl/toolkit/svtabbx.hxx @@ -166,9 +166,9 @@ public: virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const override; virtual OUString GetAccessibleCellText( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const override; - virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) override; - virtual tools::Rectangle calcTableRect( bool _bOnScreen = true ) override; - virtual tools::Rectangle calcFieldRectPixel( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen ) override; + virtual tools::Rectangle calcHeaderRect(bool _bIsColumnBar) override; + virtual tools::Rectangle calcTableRect() override; + virtual tools::Rectangle calcFieldRectPixel(sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader) override; virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override; virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) override; diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 93a5064765ea..4e9ddc2cb14e 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -1940,7 +1940,7 @@ void BrowseBox::SetCursorColor(const Color& _rCol) DoShowCursor(); } -tools::Rectangle BrowseBox::calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen) +tools::Rectangle BrowseBox::calcHeaderRect(bool _bIsColumnBar) { Point aTopLeft; tools::Long nWidth; @@ -1956,17 +1956,14 @@ tools::Rectangle BrowseBox::calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen) nWidth = GetColumnWidth(0); nHeight = GetWindowExtentsAbsolute().GetHeight() - aTopLeft.Y() - GetControlArea().GetSize().Height(); } - if (_bOnScreen) - aTopLeft += Point(GetWindowExtentsAbsolute().TopLeft()); return tools::Rectangle(aTopLeft,Size(nWidth,nHeight)); } -tools::Rectangle BrowseBox::calcTableRect(bool _bOnScreen) +tools::Rectangle BrowseBox::calcTableRect() { tools::Rectangle aRect(GetWindowExtentsAbsolute()); - if (!_bOnScreen) - aRect.SetPos(Point(0, 0)); - tools::Rectangle aRowBar = calcHeaderRect(false, _bOnScreen); + aRect.SetPos(Point(0, 0)); + tools::Rectangle aRowBar = calcHeaderRect(false); tools::Long nX = aRowBar.Right() - aRect.Left(); tools::Long nY = aRowBar.Top() - aRect.Top(); @@ -1975,15 +1972,9 @@ tools::Rectangle BrowseBox::calcTableRect(bool _bOnScreen) return tools::Rectangle(aRowBar.TopRight(), Size(aSize.Width() - nX, aSize.Height() - nY - GetBarHeight()) ); } -tools::Rectangle BrowseBox::calcFieldRectPixel( sal_Int32 _nRowId, sal_uInt16 _nColId, bool /*_bIsHeader*/, bool _bOnScreen ) +tools::Rectangle BrowseBox::calcFieldRectPixel(sal_Int32 _nRowId, sal_uInt16 _nColId, bool /*_bIsHeader*/) { - tools::Rectangle aRect = GetFieldRectPixel(_nRowId, _nColId, true); - - Point aTopLeft = aRect.TopLeft(); - if (_bOnScreen) - aTopLeft += Point(GetWindowExtentsAbsolute().TopLeft()); - - return tools::Rectangle(aTopLeft,aRect.GetSize()); + return GetFieldRectPixel(_nRowId, _nColId, true); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx b/vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx index 8ea3e7518825..ace8ff0789c5 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx @@ -302,7 +302,7 @@ Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxHeaderBar::getImplementationId( tools::Rectangle AccessibleBrowseBoxHeaderBar::implGetBoundingBox() { - return mpBrowseBox->calcHeaderRect(isColumnBar(), false); + return mpBrowseBox->calcHeaderRect(isColumnBar()); } sal_Int32 AccessibleBrowseBoxHeaderBar::implGetRowCount() const diff --git a/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx b/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx index 396e3fdce76f..4ddd172c1972 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx @@ -117,7 +117,7 @@ tools::Rectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBox() nCol = 0; } - tools::Rectangle aRet(mpBrowseBox->calcFieldRectPixel(nRow , nCol, true, false)); + tools::Rectangle aRet(mpBrowseBox->calcFieldRectPixel(nRow , nCol, true)); return tools::Rectangle(aRet.TopLeft() - Point(0, aRet.GetHeight()), aRet.GetSize()); } diff --git a/vcl/source/accessibility/AccessibleBrowseBoxTable.cxx b/vcl/source/accessibility/AccessibleBrowseBoxTable.cxx index e0c200305da5..e84624805667 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxTable.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxTable.cxx @@ -190,7 +190,7 @@ OUString SAL_CALL AccessibleBrowseBoxTable::getImplementationName() tools::Rectangle AccessibleBrowseBoxTable::implGetBoundingBox() { - return mpBrowseBox->calcTableRect(false); + return mpBrowseBox->calcTableRect(); } // internal helper methods ---------------------------------------------------- diff --git a/vcl/source/accessibility/accessiblebrowseboxcell.cxx b/vcl/source/accessibility/accessiblebrowseboxcell.cxx index a3e897da6b1e..83e00c8587af 100644 --- a/vcl/source/accessibility/accessiblebrowseboxcell.cxx +++ b/vcl/source/accessibility/accessiblebrowseboxcell.cxx @@ -55,9 +55,9 @@ void SAL_CALL AccessibleBrowseBoxCell::grabFocus() ::tools::Rectangle AccessibleBrowseBoxCell::implGetBoundingBox() { - tools::Rectangle aCellRect = mpBrowseBox->calcFieldRectPixel(m_nRowPos, m_nColPos, false, /*bOnScreen*/false); + tools::Rectangle aCellRect = mpBrowseBox->calcFieldRectPixel(m_nRowPos, m_nColPos, false); // above rect is relative to the browse box, convert it to be relative to the table (which is the cell's parent) - aCellRect.SetPos(aCellRect.TopLeft() - mpBrowseBox->calcTableRect(false).TopLeft()); + aCellRect.SetPos(aCellRect.TopLeft() - mpBrowseBox->calcTableRect().TopLeft()); return aCellRect; } diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index e24a19d13dee..5469f615310a 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -817,51 +817,38 @@ OUString SvHeaderTabListBox::GetAccessibleCellText( sal_Int32 _nRow, sal_uInt16 return GetTabEntryText(_nRow, _nColumnPos); } -tools::Rectangle SvHeaderTabListBox::calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen ) +tools::Rectangle SvHeaderTabListBox::calcHeaderRect(bool _bIsColumnBar) { tools::Rectangle aRect; if ( _bIsColumnBar ) { - vcl::Window* pParent = nullptr; - if (_bOnScreen) - aRect = tools::Rectangle(m_xHeaderBar->GetWindowExtentsAbsolute()); - else - { - pParent = m_xHeaderBar->GetAccessibleParentWindow(); - assert(pParent); - aRect = m_xHeaderBar->GetWindowExtentsRelative(*pParent); - } + vcl::Window* pParent = m_xHeaderBar->GetAccessibleParentWindow(); + assert(pParent); + aRect = m_xHeaderBar->GetWindowExtentsRelative(*pParent); } return aRect; } -tools::Rectangle SvHeaderTabListBox::calcTableRect( bool _bOnScreen ) +tools::Rectangle SvHeaderTabListBox::calcTableRect() { tools::Rectangle aScreenRect(GetWindowExtentsAbsolute()); - if ( _bOnScreen ) - return aScreenRect; - return tools::Rectangle(Point(0, 0), aScreenRect.GetSize()); } -tools::Rectangle SvHeaderTabListBox::calcFieldRectPixel( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen ) +tools::Rectangle SvHeaderTabListBox::calcFieldRectPixel(sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader) { DBG_ASSERT( !_bIsHeader || 0 == _nRow, "invalid parameters" ); tools::Rectangle aRect; SvTreeListEntry* pEntry = GetEntryOnPos(_nRow ); if ( pEntry ) { - aRect = _bIsHeader ? calcHeaderRect( true, false ) : GetBoundingRect( pEntry ); + aRect = _bIsHeader ? calcHeaderRect(true) : GetBoundingRect(pEntry); Point aTopLeft = aRect.TopLeft(); DBG_ASSERT(m_xHeaderBar->GetItemCount() > _nColumn, "invalid column"); tools::Rectangle aItemRect = m_xHeaderBar->GetItemRect(m_xHeaderBar->GetItemId(_nColumn)); aTopLeft.setX( aItemRect.Left() ); Size aSize = aItemRect.GetSize(); aRect = tools::Rectangle( aTopLeft, aSize ); - aTopLeft = aRect.TopLeft(); - if (_bOnScreen) - aTopLeft += Point(GetWindowExtentsAbsolute().TopLeft()); - aRect = tools::Rectangle( aTopLeft, aRect.GetSize() ); } return aRect; commit ef5e4af1ce07dcbbb2c58864b0a5c6eb674cc28d Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Feb 5 12:04:00 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Feb 7 09:18:00 2025 +0100 a11y: Rename IAccessibleTableProvider::GetFieldRectPixel to IAccessibleTableProvider::calcFieldRectPixel. This aligns the naming with the IAccessibleTableProvider::calcHeaderRect and IAccessibleTableProvider::calcHeaderRect methods and prevents a name clash with the other BrowseBox::GetFieldRectPixel variant only taking 3 params in an upcoming commit that will drop the `_bOnScreen` param from the now renamed method. Change-Id: I156412f825a187d86390325050147cd84e934251 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181165 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index 43bd459f18c2..244c2dde015b 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -703,7 +703,7 @@ public: @return the Rectangle */ - virtual tools::Rectangle GetFieldRectPixel(sal_Int32 _nRowId, sal_uInt16 _nColId, bool _bIsHeader, bool _bOnScreen) override; + virtual tools::Rectangle calcFieldRectPixel(sal_Int32 _nRowId, sal_uInt16 _nColId, bool _bIsHeader, bool _bOnScreen) override; /// return <TRUE/> if and only if the accessible object for this instance has been created and is alive SAL_DLLPRIVATE bool isAccessibleAlive( ) const; diff --git a/include/vcl/accessibletableprovider.hxx b/include/vcl/accessibletableprovider.hxx index e9fe3d6b5fb0..ef6ea4f2071e 100644 --- a/include/vcl/accessibletableprovider.hxx +++ b/include/vcl/accessibletableprovider.hxx @@ -88,7 +88,7 @@ public: virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) = 0; virtual tools::Rectangle calcTableRect( bool _bOnScreen = true ) = 0; - virtual tools::Rectangle GetFieldRectPixel( sal_Int32 _nRow, sal_uInt16 _nColumnPos, bool _bIsHeader, bool _bOnScreen ) = 0; + virtual tools::Rectangle calcFieldRectPixel( sal_Int32 _nRow, sal_uInt16 _nColumnPos, bool _bIsHeader, bool _bOnScreen ) = 0; virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) = 0; virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) = 0; diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx index 322925b437bf..0bddb16aa900 100644 --- a/include/vcl/toolkit/svtabbx.hxx +++ b/include/vcl/toolkit/svtabbx.hxx @@ -168,7 +168,7 @@ public: virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) override; virtual tools::Rectangle calcTableRect( bool _bOnScreen = true ) override; - virtual tools::Rectangle GetFieldRectPixel( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen ) override; + virtual tools::Rectangle calcFieldRectPixel( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen ) override; virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override; virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) override; diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 767b219eab07..93a5064765ea 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -1975,7 +1975,7 @@ tools::Rectangle BrowseBox::calcTableRect(bool _bOnScreen) return tools::Rectangle(aRowBar.TopRight(), Size(aSize.Width() - nX, aSize.Height() - nY - GetBarHeight()) ); } -tools::Rectangle BrowseBox::GetFieldRectPixel( sal_Int32 _nRowId, sal_uInt16 _nColId, bool /*_bIsHeader*/, bool _bOnScreen ) +tools::Rectangle BrowseBox::calcFieldRectPixel( sal_Int32 _nRowId, sal_uInt16 _nColId, bool /*_bIsHeader*/, bool _bOnScreen ) { tools::Rectangle aRect = GetFieldRectPixel(_nRowId, _nColId, true); diff --git a/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx b/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx index ca6843b50d7a..396e3fdce76f 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx @@ -117,7 +117,7 @@ tools::Rectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBox() nCol = 0; } - tools::Rectangle aRet(mpBrowseBox->GetFieldRectPixel(nRow , nCol, true, false)); + tools::Rectangle aRet(mpBrowseBox->calcFieldRectPixel(nRow , nCol, true, false)); return tools::Rectangle(aRet.TopLeft() - Point(0, aRet.GetHeight()), aRet.GetSize()); } diff --git a/vcl/source/accessibility/accessiblebrowseboxcell.cxx b/vcl/source/accessibility/accessiblebrowseboxcell.cxx index 866ca88655b8..a3e897da6b1e 100644 --- a/vcl/source/accessibility/accessiblebrowseboxcell.cxx +++ b/vcl/source/accessibility/accessiblebrowseboxcell.cxx @@ -55,7 +55,7 @@ void SAL_CALL AccessibleBrowseBoxCell::grabFocus() ::tools::Rectangle AccessibleBrowseBoxCell::implGetBoundingBox() { - tools::Rectangle aCellRect = mpBrowseBox->GetFieldRectPixel(m_nRowPos, m_nColPos, false, /*bOnScreen*/false); + tools::Rectangle aCellRect = mpBrowseBox->calcFieldRectPixel(m_nRowPos, m_nColPos, false, /*bOnScreen*/false); // above rect is relative to the browse box, convert it to be relative to the table (which is the cell's parent) aCellRect.SetPos(aCellRect.TopLeft() - mpBrowseBox->calcTableRect(false).TopLeft()); return aCellRect; diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index b13786387507..e24a19d13dee 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -844,7 +844,7 @@ tools::Rectangle SvHeaderTabListBox::calcTableRect( bool _bOnScreen ) return tools::Rectangle(Point(0, 0), aScreenRect.GetSize()); } -tools::Rectangle SvHeaderTabListBox::GetFieldRectPixel( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen ) +tools::Rectangle SvHeaderTabListBox::calcFieldRectPixel( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen ) { DBG_ASSERT( !_bIsHeader || 0 == _nRow, "invalid parameters" ); tools::Rectangle aRect;