sw/source/core/text/itrpaint.cxx | 18 ++++++++++++++++-- sw/source/core/text/itrpaint.hxx | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-)
New commits: commit e4042da6e63ed2ac6e1687f696580d9a502bad83 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Apr 5 15:47:38 2023 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Apr 5 16:53:55 2023 +0200 sw: fix crashtesting assert on tdf90408-1.doc frmpaint.cxx:801: SwTextFrame::PaintSwFrame: Assertion `... || oTaggedParagraph || ...' failed. The problem is that here the SwNumberingPortion is outside of the table cell and even outside of the page due to negative indent, hence CalcPaintOfst() skips it. Have to add another special case to open the LBody/P tags in this case. Let's not produce Lbl tag in this case since it's not visible. (regression from commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd) Change-Id: Ic048849c9f426ebfa59e05acece1ec995fd28247 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150056 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index c2a455641715..f88e6ec07c70 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -70,7 +70,7 @@ void SwTextPainter::CtorInitTextPainter( SwTextFrame *pNewFrame, SwTextPaintInfo m_bPaintDrop = false; } -SwLinePortion *SwTextPainter::CalcPaintOfst( const SwRect &rPaint ) +SwLinePortion *SwTextPainter::CalcPaintOfst(const SwRect &rPaint, bool& rbSkippedNumPortions) { SwLinePortion *pPor = m_pCurr->GetFirstPortion(); GetInfo().SetPaintOfst( 0 ); @@ -98,6 +98,11 @@ SwLinePortion *SwTextPainter::CalcPaintOfst( const SwRect &rPaint ) } else pPor->Move( GetInfo() ); + if (pPor->InNumberGrp() + && !static_cast<SwNumberPortion const*>(pPor)->HasFollow()) + { + rbSkippedNumPortions = true; // all numbering portions were skipped? + } pLast = pPor; pPor = pPor->GetNextPortion(); } @@ -145,7 +150,16 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, // 6882: blank lines can't be optimized by removing them if Formatting Marks are shown const bool bEndPor = GetInfo().GetOpt().IsParagraph() && GetInfo().GetText().isEmpty(); - SwLinePortion *pPor = bEndPor ? m_pCurr->GetFirstPortion() : CalcPaintOfst( rPaint ); + bool bSkippedNumPortions(false); + SwLinePortion *pPor = bEndPor ? m_pCurr->GetFirstPortion() : CalcPaintOfst(rPaint, bSkippedNumPortions); + + if (bSkippedNumPortions) // ugly but hard to check earlier in PaintSwFrame: + { // there is a num portion but it is outside of the frame area and not painted + assert(!roTaggedLabel); + assert(!roTaggedParagraph); + Frame_Info aFrameInfo(*m_pFrame); // open LBody + roTaggedParagraph.emplace(nullptr, &aFrameInfo, nullptr, *GetInfo().GetOut()); + } // Optimization! SwTwips nMaxRight = std::min<SwTwips>( rPaint.Right(), Right() ); diff --git a/sw/source/core/text/itrpaint.hxx b/sw/source/core/text/itrpaint.hxx index 1c614e2a34d3..893db371dbb4 100644 --- a/sw/source/core/text/itrpaint.hxx +++ b/sw/source/core/text/itrpaint.hxx @@ -31,7 +31,7 @@ class SwTextPainter : public SwTextCursor { bool m_bPaintDrop; - SwLinePortion *CalcPaintOfst( const SwRect &rPaint ); + SwLinePortion *CalcPaintOfst(const SwRect &rPaint, bool& rbSkippedNumPortions); void CheckSpecialUnderline( const SwLinePortion* pPor, tools::Long nAdjustBaseLine = 0 ); protected: