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 17eaebee27
"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>
This commit is contained in:
@@ -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 )
|
||||
|
||||
Reference in New Issue
Block a user