sw/source/core/text/EnhancedPDFExportHelper.cxx |   30 ++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

New commits:
commit b5ad63cc2b1c8ee2acc2b322aba5cd666954c05f
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Mar 7 15:39:56 2023 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Mar 9 21:03:46 2023 +0000

    sw: PDF/UA export: produce more headings H7..H10
    
    ISO 14289-1:2014 adds a new feature:
    
      7.4.3 Additional headings
      If a PDF that contains the tags H1, H2, H3, H4, H5, and H6 (in any
      permissible sequence) requires more headings, tags numbered from
      H7 upward (without limit) may be defined and used.
    
    Do not add new enum values H7..H10 to StructElement, because this
    approach results in veraPDF complaining:
    
      Specification: ISO 14289-1:2014, Clause: 7.1, Test number: 5
      All non-standard structure types shall be mapped to the nearest
      functionally equivalent standard type, as defined in ISO
      32000-1:2008, 14.8.4, in the role map dictionary of the structure
      tree root.
    
    Change-Id: Icf39667dee3847f6b755bfa592a9d30ce872c26e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148431
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 470a2c0692533f42d333b9416daf3f0871cd951a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148494
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 3f6a0c172142..ded04bd86aeb 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -148,6 +148,10 @@ constexpr OUStringLiteral aH3String = u"H3";
 constexpr OUStringLiteral aH4String = u"H4";
 constexpr OUStringLiteral aH5String = u"H5";
 constexpr OUStringLiteral aH6String = u"H6";
+constexpr OUStringLiteral aH7String = u"H7";
+constexpr OUStringLiteral aH8String = u"H8";
+constexpr OUStringLiteral aH9String = u"H9";
+constexpr OUStringLiteral aH10String = u"H10";
 constexpr OUStringLiteral aListString = u"L";
 constexpr OUStringLiteral aListItemString = u"LI";
 constexpr OUStringLiteral aListBodyString = u"LBody";
@@ -1172,9 +1176,6 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
                     && sw::IsParaPropsNode(*pFrame->getRootFrame(), *pTextNd))
                 {
                     int nRealLevel = pTextNd->GetAttrOutlineLevel()-1;
-                    nRealLevel = std::min(nRealLevel, 5);
-
-                    nPDFType =  o3tl::narrowing<sal_uInt16>(vcl::PDFWriter::H1 
+ nRealLevel);
                     switch(nRealLevel)
                     {
                         case 0 :
@@ -1192,10 +1193,31 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
                         case 4 :
                             aPDFType = aH5String;
                             break;
-                        default:
+                        case 5:
                             aPDFType = aH6String;
                             break;
+                        case 6:
+                            aPDFType = aH7String;
+                            break;
+                        case 7:
+                            aPDFType = aH8String;
+                            break;
+                        case 8:
+                            aPDFType = aH9String;
+                            break;
+                        case 9:
+                            aPDFType = aH10String;
+                            break;
+                        default:
+                            assert(false);
+                            break;
                     }
+
+                    // PDF/UA allows unlimited headings, but PDF only up to H6
+                    // ... and apparently the extra H7.. must be declared in
+                    // RoleMap, or veraPDF complains.
+                    nRealLevel = std::min(nRealLevel, 5);
+                    nPDFType =  o3tl::narrowing<sal_uInt16>(vcl::PDFWriter::H1 
+ nRealLevel);
                 }
 
                 // Section: TOCI

Reply via email to