sw/source/core/text/itrform2.cxx | 26 ++++++++------------------ sw/source/core/text/itrform2.hxx | 2 +- 2 files changed, 9 insertions(+), 19 deletions(-)
New commits: commit 1e811754d230dd59ec54d0653284ca4737edb8b9 Author: Mark Hung <mark...@gmail.com> AuthorDate: Sat Aug 10 13:28:45 2019 +0800 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Wed Dec 18 11:49:49 2019 +0100 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 <mark...@gmail.com> (cherry picked from commit 56e95f8e20b20680d025f3ecbeb4cc5306085b1e) Reviewed-on: https://gerrit.libreoffice.org/85211 Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 34092426313a..7f06bea13b0d 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -297,14 +297,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(); } @@ -314,7 +316,7 @@ void SwTextFormatter::InsertPortion( SwTextFormatInfo &rInf, } else { - SwLinePortion *pLast = rInf.GetLast(); + pLast = rInf.GetLast(); if( pLast->GetNextPortion() ) { while( pLast->GetNextPortion() ) @@ -336,8 +338,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(); } } @@ -478,7 +484,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 ); } } @@ -522,11 +527,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() ) @@ -687,17 +688,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 53db28c7e179..e28a17004924 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 ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits