vcl/source/gdi/pdfwriter_impl.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 1e9407aec765e42a3deface23ffefb0db1e03706
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Jul 20 11:54:26 2023 +0200
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Jul 31 22:17:27 2023 +0200

    tdf#154990 vcl: PDF export: incorrect checks of annotation struct parents
    
    The first form annotation is missing /StructParent.
    
    The invalid value is -1, not 0. Typically 0 is the index of the MCIDs
    entry (m_aMCIDParents) in the ParentTree /Nums, but if there is not a
    single MCID in the document, this is omitted and 0 may be a valid
    annotation then.
    
    Change-Id: I9885d176eae272d98000f9d9f0ffae82558c0ea0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154668
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 49dca4be647733507b2082a9c74187076a4a8d9b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154627
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index bf8eb426348d..4e1c1e14c643 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3646,7 +3646,7 @@ bool PDFWriterImpl::emitScreenAnnotations()
         // End Action dictionary.
         aLine.append("/OP 0 >>");
 
-        if (0 < rScreen.m_nStructParent)
+        if (-1 != rScreen.m_nStructParent)
         {
             aLine.append("\n/StructParent "
                 + OString::number(rScreen.m_nStructParent)
@@ -3884,7 +3884,7 @@ we check in the following sequence:
             }
             aLine.append( ">>\n" );
         }
-        if( rLink.m_nStructParent > 0 )
+        if (rLink.m_nStructParent != -1)
         {
             aLine.append( "/StructParent " );
             aLine.append( rLink.m_nStructParent );
@@ -4725,7 +4725,7 @@ bool PDFWriterImpl::emitWidgetAnnotations()
                     iRectMargin = 1;
                 }
 
-                if (0 < rWidget.m_nStructParent)
+                if (-1 != rWidget.m_nStructParent)
                 {
                     aLine.append("/StructParent ");
                     aLine.append(rWidget.m_nStructParent);

Reply via email to