diff options
author | László Németh <nemeth@numbertext.org> | 2024-08-21 23:14:22 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-08-23 11:55:17 +0200 |
commit | e679e3b194901ebb52738be32f20148e4627d4e9 (patch) | |
tree | ee70b3d53d0c4e8d4366286d48f09766fae5ed5a | |
parent | ebeaced0f7bbdbeec9762b85cc6f92a1f8610240 (diff) |
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 <nemeth@numbertext.org>
(cherry picked from commit 6b857398a59d16308d6185d01e003e401439f060)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172193
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r-- | sw/source/core/text/itradj.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx index 1a49b9aa8819..e93ece45ce29 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 ) |