sw/source/core/text/itrpaint.cxx |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 0913da454e2dd88fb8fc83cddd20c735b79f73ca
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue May 2 20:37:12 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed May 3 11:19:53 2023 +0200

    sw: fix crashtesting assert on tdf124604-1.docx
    
    frmpaint.cxx:801: SwTextFrame::PaintSwFrame: Assertion `... || 
oTaggedParagraph || ...' failed.
    
    Here the problem is that the numbering label on the last paragraph is so
    indented that it ends up off the right end of the page, and so the loop
    in SwTextPainter::DrawTextLine() terminates before seeing it.
    
    Sigh, add another special case ...
    
    (regression from commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd)
    
    Change-Id: I6bb7385a10269d77d533c3b98462602e58a60317
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151299
    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 54935069d60d..e0fc758fb597 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -456,6 +456,24 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, 
SwSaveClip &rClip,
                  pNext && pNext->IsHolePortion() ) ?
                pNext :
                nullptr;
+        if (!pPor) // check if the end of the list label is off-screen
+        {
+            while (pNext)
+            {
+                if (!roTaggedParagraph && pNext->InNumberGrp()
+                    && !static_cast<SwNumberPortion 
const*>(pNext)->HasFollow())
+                {
+                    if (roTaggedLabel)
+                    {
+                        roTaggedLabel.reset();
+                    } // else, if the numbering isn't visible at all, no Lbl
+                    Frame_Info aFrameInfo(*m_pFrame); // open LBody
+                    roTaggedParagraph.emplace(nullptr, &aFrameInfo, nullptr, 
*GetInfo().GetOut());
+                    break;
+                }
+                pNext = pNext->GetNextPortion();
+            }
+        }
     }
 
     // delete underline font
commit 336a3c3d5b5b8e502cb6edfecf4f5fa1780b13e3
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue May 2 19:47:03 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed May 3 11:19:47 2023 +0200

    sw: fix crashtesting assert on ooo95981-1.odt
    
    itrpaint.cxx:433: void SwTextPainter::DrawTextLine: Assertion 
`roTaggedLabel' failed
    
    The problem is that there are 2 SwNumberingPortions, and CalcPaintOfst()
    skips one of them.  So the portion that doesn't have a follow may never
    be iterated.
    
    (regression from commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd)
    
    Change-Id: If6618b183cf533f69091d4657d3a412f9d1cc4b7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151298
    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 f88e6ec07c70..54935069d60d 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -406,9 +406,8 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, 
SwSaveClip &rClip,
 
         // multiple numbering portions are possible :(
         if (pPor->InNumberGrp() // also footnote label
-            && !static_cast<SwNumberPortion const*>(pPor)->IsFollow())
+            && !roTaggedLabel) // note: CalcPaintOfst may skip some portions
         {
-            assert(!roTaggedLabel);
             assert(isPDFTaggingEnabled); (void) isPDFTaggingEnabled;
             Por_Info aPorInfo(*pPor, *this, true); // open Lbl
             roTaggedLabel.emplace(nullptr, nullptr, &aPorInfo, *pOut);

Reply via email to