diff options
author | Mark Hung <marklh9@gmail.com> | 2019-08-10 13:28:45 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2019-08-20 14:16:55 +0200 |
commit | 56e95f8e20b20680d025f3ecbeb4cc5306085b1e (patch) | |
tree | 540bacdaa2996ef8d7a551f438077fceda62daa9 /sw | |
parent | 316b07d0af06948c69c1375c67c01903b8eeb134 (diff) |
tdf#126353 merge character borders on layout portions.
Layout portions / para portions may have portion length.
So merging them is valid and there's no need to check
them at all. Invoke MergeCharacterBorder in InsertPortion
to handle border merging consistently.
Change-Id: I3669bcbb1d658e1df74d338d6cf062e5f07faf4d
Reviewed-on: https://gerrit.libreoffice.org/77366
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/text/itrform2.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/text/itrform2.hxx | 2 |
2 files changed, 9 insertions, 19 deletions
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 8047c2565906..72d3363e800b 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -298,14 +298,16 @@ SwLinePortion *SwTextFormatter::Underflow( SwTextFormatInfo &rInf ) } void SwTextFormatter::InsertPortion( SwTextFormatInfo &rInf, - SwLinePortion *pPor ) const + SwLinePortion *pPor ) { + SwLinePortion *pLast = nullptr; // The new portion is inserted, but everything's different for // LineLayout... if( pPor == m_pCurr ) { if ( m_pCurr->GetNextPortion() ) { + pLast = pPor; pPor = m_pCurr->GetNextPortion(); } @@ -315,7 +317,7 @@ void SwTextFormatter::InsertPortion( SwTextFormatInfo &rInf, } else { - SwLinePortion *pLast = rInf.GetLast(); + pLast = rInf.GetLast(); if( pLast->GetNextPortion() ) { while( pLast->GetNextPortion() ) @@ -337,8 +339,12 @@ void SwTextFormatter::InsertPortion( SwTextFormatInfo &rInf, rInf.SetLast( pPor ); while( pPor ) { + if (!pPor->IsDropPortion()) + MergeCharacterBorder(*pPor, pLast, rInf); + pPor->Move( rInf ); rInf.SetLast( pPor ); + pLast = pPor; pPor = pPor->GetNextPortion(); } } @@ -479,7 +485,6 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) new SwKernPortion( *rInf.GetLast(), nLstHeight, pLast->InFieldGrp() && pPor->InFieldGrp() ); rInf.GetLast()->SetNextPortion( nullptr ); - MergeCharacterBorder(*pKrn, rInf.GetLast()->FindLastPortion(), rInf); InsertPortion( rInf, pKrn ); } } @@ -523,11 +528,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) } if ( pGridKernPortion != pPor ) - { - SwLinePortion *pLast = rInf.GetLast()? rInf.GetLast()->FindLastPortion():nullptr ; - MergeCharacterBorder(*pGridKernPortion, pLast , rInf); InsertPortion( rInf, pGridKernPortion ); - } } if( pPor->IsDropPortion() ) @@ -688,17 +689,6 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) rInf.SetFull( bFull ); - if( !pPor->IsDropPortion() ) - { - SwLinePortion *pPrev = rInf.GetLast() ? rInf.GetLast()->FindLastPortion() : nullptr; - for ( SwLinePortion *pNext = pPor ; pNext!= nullptr ; pNext=pNext->GetNextPortion()) - { - if ( !pNext->IsParaPortion() ) - MergeCharacterBorder(*pNext, pPrev, rInf); - pPrev = pNext ; - } - } - // Restportions from fields with multiple lines don't yet have the right ascent if ( !pPor->GetLen() && !pPor->IsFlyPortion() && !pPor->IsGrfNumPortion() && ! pPor->InNumberGrp() diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx index 64fc52e80cd6..ff9af549ccd7 100644 --- a/sw/source/core/text/itrform2.hxx +++ b/sw/source/core/text/itrform2.hxx @@ -129,7 +129,7 @@ class SwTextFormatter : public SwTextPainter bool ChkFlyUnderflow( SwTextFormatInfo &rInf ) const; // Insert portion - void InsertPortion( SwTextFormatInfo &rInf, SwLinePortion *pPor ) const; + void InsertPortion( SwTextFormatInfo &rInf, SwLinePortion *pPor ); // Guess height for the DropPortion void GuessDropHeight( const sal_uInt16 nLines ); |