sw/source/core/text/EnhancedPDFExportHelper.cxx |   10 +++++++++-
 sw/source/core/text/frmpaint.cxx                |    2 +-
 sw/source/core/text/itrpaint.cxx                |    4 ++--
 3 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit a4e0e85f675ecb2282432503ab439e4445b487e3
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Mar 10 16:05:38 2023 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Mar 13 10:41:12 2023 +0000

    sw: PDF/UA export: produce Lbl for footnotes/endnotes
    
    Extend the list item Lbl code that was added in commit
    9b38beadf9eaf027b201cdf0ecb2bce5611014dd a bit for footnotes.
    
    The FootnoteNum portion gets 2 SwTaggedPDFHelper, the outer one produces
    Lbl and the inner one Link.
    
    Change-Id: I836c83d6978ecc8c0a87fa6b0fe2fa17e31a0683
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148648
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 1cf1cbd92bf6..cdab7496cf8c 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1557,7 +1557,6 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
             }
             break;
 
-        case PortionType::FootnoteNum: // tdf#152218 link both directions
         case PortionType::Footnote :
             nPDFType = vcl::PDFWriter::Link;
             aPDFType = aLinkString;
@@ -1587,6 +1586,15 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
             }
             break;
 
+        // for FootnoteNum, is called twice: outer generates Lbl, inner Link
+        case PortionType::FootnoteNum:
+            if (!mpPorInfo->m_isNumberingLabel)
+            {   // tdf#152218 link both directions
+                nPDFType = vcl::PDFWriter::Link;
+                aPDFType = aLinkString;
+                break;
+            }
+            [[fallthrough]];
         case PortionType::Number:
         case PortionType::Bullet:
         case PortionType::GrfNum:
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 0e4a7f677917..b04423b2f851 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -683,7 +683,7 @@ void SwTextFrame::PaintSwFrame(vcl::RenderContext& 
rRenderContext, SwRect const&
     // Paragraph tag - if there is a list label, opening should be delayed.
     ::std::optional<SwTaggedPDFHelper> oTaggedParagraph;
 
-    if (IsFollow() || !GetPara()->HasNumberingPortion())
+    if (IsFollow() || !(GetPara()->HasNumberingPortion() || 
GetPara()->IsFootnoteNum()))
     {   // no Lbl needed => open paragraph tag now
         Frame_Info aFrameInfo(*this);
         oTaggedParagraph.emplace(nullptr, &aFrameInfo, nullptr, 
rRenderContext);
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 474cd4811317..8f212988cba8 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -390,7 +390,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, 
SwSaveClip &rClip,
         }
 
         // multiple numbering portions are possible :(
-        if (pPor->InNumberGrp() && !pPor->IsFootnoteNumPortion()
+        if (pPor->InNumberGrp() // also footnote label
             && !static_cast<SwNumberPortion const*>(pPor)->IsFollow())
         {
             assert(!roTaggedLabel);
@@ -411,7 +411,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, 
SwSaveClip &rClip,
         }
 
         // lazy open LIBody and paragraph tag after num portions have been 
painted to Lbl
-        if (pPor->InNumberGrp() && !pPor->IsFootnoteNumPortion()
+        if (pPor->InNumberGrp() // also footnote label
             // note: numbering portion may be split if it has multiple scripts
             && !static_cast<SwNumberPortion const*>(pPor)->HasFollow()) // so 
wait for the last one
         {

Reply via email to