sw/source/core/access/acctable.cxx | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-)
New commits: commit 49392773762d0e8caa655a9d4d5a8ae81120c222 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Apr 16 14:00:19 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu Apr 17 07:07:36 2025 +0200 sw a11y: Use range-based for Change-Id: Ia8b233d1b7d818365bfc6c2fb9652c2f4b0dc1b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184299 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index ad92cfa96428..7d59a97480d4 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -165,11 +165,8 @@ void SwAccessibleTableData_Impl::CollectData( const SwFrame *pFrame ) const SwFrame* SwAccessibleTableData_Impl::FindCell(const Point& rPos, const SwFrame* pFrame) const { const SwAccessibleChildSList aList( *pFrame, mrAccMap ); - SwAccessibleChildSList::const_iterator aIter( aList.begin() ); - SwAccessibleChildSList::const_iterator aEndIter( aList.end() ); - while (aIter != aEndIter) + for (const SwAccessibleChild& rLower : aList) { - const SwAccessibleChild& rLower = *aIter; const SwFrame *pLower = rLower.GetSwFrame(); OSL_ENSURE( pLower, "child should be a frame" ); if( pLower ) @@ -196,7 +193,6 @@ const SwFrame* SwAccessibleTableData_Impl::FindCell(const Point& rPos, const SwF } } } - ++aIter; } return nullptr; commit bba51aab027b097c9cefab523c59ff5c42674f4a Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Apr 16 13:54:31 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu Apr 17 07:07:30 2025 +0200 sw a11y: Return cell instead of using out param Instead of having a bool return value and an out param for the `const SwFrame*`, simply return the `const SwFrame*`. Change-Id: I6920e23b08b9d6fbe29acf5c71858e6ec0c45512 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184298 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index 55cc64642aa1..ad92cfa96428 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -82,7 +82,7 @@ class SwAccessibleTableData_Impl void CollectData( const SwFrame *pFrame ); - bool FindCell(const Point& rPos, const SwFrame* pFrame, const SwFrame*& rFrame) const; + const SwFrame* FindCell(const Point& rPos, const SwFrame* pFrame) const; void GetSelection( const Point& rTabPos, const SwRect& rArea, const SwSelBoxes& rSelBoxes, const SwFrame *pFrame, @@ -162,15 +162,12 @@ void SwAccessibleTableData_Impl::CollectData( const SwFrame *pFrame ) } } -bool SwAccessibleTableData_Impl::FindCell(const Point& rPos, const SwFrame* pFrame, - const SwFrame*& rRet) const +const SwFrame* SwAccessibleTableData_Impl::FindCell(const Point& rPos, const SwFrame* pFrame) const { - bool bFound = false; - const SwAccessibleChildSList aList( *pFrame, mrAccMap ); SwAccessibleChildSList::const_iterator aIter( aList.begin() ); SwAccessibleChildSList::const_iterator aEndIter( aList.end() ); - while( !bFound && aIter != aEndIter ) + while (aIter != aEndIter) { const SwAccessibleChild& rLower = *aIter; const SwFrame *pLower = rLower.GetSwFrame(); @@ -186,24 +183,23 @@ bool SwAccessibleTableData_Impl::FindCell(const Point& rPos, const SwFrame* pFra // We have found the cell OSL_ENSURE( rFrame.Left() <= rPos.X() && rFrame.Top() <= rPos.Y(), "find frame moved to far!" ); - bFound = true; - rRet = pLower; + return pLower; } } else { // #i77106# - if ( !pLower->IsRowFrame() || - IncludeRow( *pLower ) ) + if (!pLower->IsRowFrame() || IncludeRow(*pLower)) { - bFound = FindCell(rPos, pLower, rRet); + if (const SwFrame* pCell = FindCell(rPos, pLower)) + return pCell; } } } ++aIter; } - return bFound; + return nullptr; } void SwAccessibleTableData_Impl::GetSelection( @@ -321,10 +317,8 @@ const SwFrame *SwAccessibleTableData_Impl::GetCellAtPos( { Point aPos( mpTabFrame->getFrameArea().Pos() ); aPos.Move( nLeft, nTop ); - const SwFrame *pRet = nullptr; - FindCell(aPos, mpTabFrame, pRet); - return pRet; + return FindCell(aPos, mpTabFrame); } inline sal_Int32 SwAccessibleTableData_Impl::GetRowCount() const