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

New commits:
commit 93088fef9373427fd36555375f731417f665b6dd
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Jul 20 11:54:26 2023 +0200
Commit:     خالد حسني <kha...@libreoffice.org>
CommitDate: Tue Jul 25 11:22:47 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/+/154628
    Reviewed-by: خالد حسني <kha...@libreoffice.org>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index ee5def1a1126..d87fca92676e 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3642,7 +3642,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 ");
             aLine.append(rScreen.m_nStructParent);
@@ -3875,7 +3875,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 );
@@ -4664,7 +4664,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