diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-10-20 20:03:11 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-10-25 11:17:08 +0200 |
commit | eeba703a36aa1e1adcd8dc8b6f87e267ee38aae7 (patch) | |
tree | 17812da50992bc5e1acbb119fb4bd1748af9ed70 /sw | |
parent | 23c2df654f11dac0d701d154bd16a35c3e11585e (diff) |
tdf#157817 sw: PDF/UA export: fix ToX header sections
The problem was that a P or equivalent element is not allowed as child
of a TOC; previously the P was outside/before the TOC because the ToX
header was completely ignored but now it starts a SE for the ToC content
section before being ignored.
Tagged PDF Best Practice Guide suggests putting the header inside a
Caption element.
Another problem is that if the ToX header is on one page but the first
entry in the ToX content section is on the next page, BeginTag() created
a new SE for the ToX content section.
(regression from commit 033e37b49b5712df19dbfd2c307a102bce620de1)
Change-Id: I3c1f8fdda81c1f10198f5eaefc10bcd14f277a8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158298
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit a5851d0a6fdc3e08e93daf8cf0ae7f6fc2d73ef6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158285
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/text/EnhancedPDFExportHelper.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 9ebc233dc687..9f99c58b4a35 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -524,6 +524,7 @@ void SwTaggedPDFHelper::BeginTag( vcl::PDFWriter::StructElement eType, const OUS if ( ( rFrame.IsPageFrame() && !static_cast<const SwPageFrame&>(rFrame).GetPrev() ) || ( rFrame.IsFlowFrame() && !SwFlowFrame::CastFlowFrame(&rFrame)->IsFollow() && SwFlowFrame::CastFlowFrame(&rFrame)->HasFollow() ) || + rFrame.IsSctFrame() || // all of them, so that opening parent sections works ( rFrame.IsTextFrame() && rFrame.GetDrawObjs() ) || (rFrame.IsFootnoteFrame() && static_cast<SwFootnoteFrame const&>(rFrame).GetFollow()) || ( rFrame.IsRowFrame() && rFrame.IsInSplitTableRow() ) || @@ -665,6 +666,12 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) bRowSpan = true; break; + case vcl::PDFWriter::Caption: + if (pFrame->IsSctFrame()) + { + break; + } + [[fallthrough]]; case vcl::PDFWriter::H1 : case vcl::PDFWriter::H2 : case vcl::PDFWriter::H3 : @@ -673,7 +680,6 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) case vcl::PDFWriter::H6 : case vcl::PDFWriter::Paragraph : case vcl::PDFWriter::Heading : - case vcl::PDFWriter::Caption : case vcl::PDFWriter::BlockQuote : bPlacement = @@ -1271,6 +1277,11 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() OpenTagImpl(pSection); break; } + else if (SectionType::ToxHeader == pSection->GetType()) + { + nPDFType = vcl::PDFWriter::Caption; + aPDFType = aCaptionString; + } else if (SectionType::ToxContent == pSection->GetType()) { const SwTOXBase* pTOXBase = pSection->GetTOXBase(); |