sw/source/core/docnode/ndtbl.cxx | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
New commits: commit f60d768fad73494fbfd600d8c7f8a0f1c7e3e857 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sun Oct 6 14:45:00 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sun Oct 6 21:47:20 2024 +0200 flatten SwCollectTableLineBoxes::GetBoxOfPos Change-Id: I3a7908456ebd29f5c5bf1ad1e7dc593abce4928c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174558 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index b36fd35dba4b..facfb5798ba5 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -3004,28 +3004,27 @@ void SwCollectTableLineBoxes::AddBox( const SwTableBox& rBox ) const SwTableBox* SwCollectTableLineBoxes::GetBoxOfPos( const SwTableBox& rBox ) { - const SwTableBox* pRet = nullptr; + if (m_aPositionArr.empty()) + return nullptr; - if( !m_aPositionArr.empty() ) + std::vector<sal_uInt16>::size_type n; + for( n = 0; n < m_aPositionArr.size(); ++n ) { - std::vector<sal_uInt16>::size_type n; - for( n = 0; n < m_aPositionArr.size(); ++n ) - if( m_aPositionArr[ n ] == m_nWidth ) - break; - else if( m_aPositionArr[ n ] > m_nWidth ) - { - if( n ) - --n; - break; - } + if( m_aPositionArr[ n ] == m_nWidth ) + break; + else if( m_aPositionArr[ n ] > m_nWidth ) + { + if( n ) + --n; + break; + } + } - if( n >= m_aPositionArr.size() ) - --n; + if( n >= m_aPositionArr.size() ) + --n; - m_nWidth = m_nWidth + o3tl::narrowing<sal_uInt16>(rBox.GetFrameFormat()->GetFrameSize().GetWidth()); - pRet = m_Boxes[ n ]; - } - return pRet; + m_nWidth = m_nWidth + o3tl::narrowing<sal_uInt16>(rBox.GetFrameFormat()->GetFrameSize().GetWidth()); + return m_Boxes[ n ]; } bool SwCollectTableLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth )