sw/source/core/text/itradj.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
New commits: commit 82d46a18cd9ec8c5027785b6d8303c4a0ce4e34f Author: László Németh <nem...@numbertext.org> AuthorDate: Wed Aug 21 23:14:22 2024 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Fri Aug 23 11:55:47 2024 +0200 tdf#162109 sw smart justify: fix overhanging last line Last line of justified paragraphs is excluded from justification normally, but not in the case, where it fits only with shrinking spaces. This line was overhanging because of the missing justification and space shrinking. Regression from commit 17eaebee279772b6062ae3448012133897fc71bb "tdf#119908 sw smart justify: fix justification by shrinking". Change-Id: I83ac8562b46999d7fd676d737bed0b9c141a89b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172228 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 6b857398a59d16308d6185d01e003e401439f060) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172195 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx index 4dcaf03df1f8..d889f49a8051 100644 --- a/sw/source/core/text/itradj.cxx +++ b/sw/source/core/text/itradj.cxx @@ -47,6 +47,23 @@ void SwTextAdjuster::FormatBlock( ) bool bSkip = !IsLastBlock() && m_nStart + m_pCurr->GetLen() >= TextFrameIndex(GetInfo().GetText().getLength()); + // tdf#162109 if the last line is longer, than the paragraph width, + // it contains shrinking spaces: don't skip block format here + if( bSkip ) + { + // sum width of the text portions to calculate the line width without shrinking + tools::Long nBreakWidth = 0; + const SwLinePortion *pPos = m_pCurr->GetNextPortion(); + while( pPos && bSkip ) + { + if( !pPos->InGlueGrp() ) + nBreakWidth += pPos->Width(); + if( nBreakWidth > m_pCurr->Width() ) + bSkip = false; + pPos = pPos->GetNextPortion(); + } + } + // Multi-line fields are tricky, because we need to check whether there are // any other text portions in the paragraph. if( bSkip )