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

New commits:
commit 49dca4be647733507b2082a9c74187076a4a8d9b
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Jul 20 11:54:26 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu Jul 20 13:35:40 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>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 5765426375ba..42f85d42bb76 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3641,7 +3641,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)
@@ -3879,7 +3879,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 );
@@ -4720,7 +4720,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