drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 23 ++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
New commits: commit 462512b71eec7be6874e776a0ec4aa7a83acdb36 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Apr 5 18:00:27 2023 +0200 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Apr 6 16:49:13 2023 +0200 tdf#152234 drawinglayer: PDF/UA export: fallback for unsupported forms veraPDF complains: Specification: ISO 14289-1:2014, Clause: 7.1, Test number: 3 Content shall be marked as Artifact or tagged as real content Form element can only be used for those form controls for which PDFWriterImpl can produce a Widget annotation; see createDefaultWidget(). For a label control, it's not editable so it's not a PDF widget. For an image button, it could be implemented in VCL but isn't currently. So a fallback is required in any case, "Figure" or "Div" can be used. Change-Id: I454030ff7c67a8a8101fcc59e945fe9dbc5f87a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150059 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 5ef4d326a06f9fc0aff36bd5cdcba1b7af8e03db) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150094 Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 45b95f54557b..e88a3e9802a5 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -1165,7 +1165,6 @@ void VclMetafileProcessor2D::processControlPrimitive2D( pPDFControl->TextFont.SetFontSize(aFontSize); mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Form); - OUString const& rAltText(rControlPrimitive.GetAltText()); vcl::PDFWriter::StructAttributeValue role; switch (pPDFControl->Type) { @@ -1185,6 +1184,7 @@ void VclMetafileProcessor2D::processControlPrimitive2D( // ISO 14289-1:2014, Clause: 7.18.4 mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Role, role); // ISO 14289-1:2014, Clause: 7.18.1 + OUString const& rAltText(rControlPrimitive.GetAltText()); if (!rAltText.isEmpty()) { mpPDFExtOutDevData->SetAlternateText(rAltText); @@ -1204,6 +1204,22 @@ void VclMetafileProcessor2D::processControlPrimitive2D( } } + if (!bDoProcessRecursively) + { + return; + } + + if (mpPDFExtOutDevData) + { // no corresponding PDF Form, use Figure instead + mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Figure); + mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement, vcl::PDFWriter::Block); + OUString const& rAltText(rControlPrimitive.GetAltText()); + if (!rAltText.isEmpty()) + { + mpPDFExtOutDevData->SetAlternateText(rAltText); + } + } + // #i93169# used flag the wrong way; true means that nothing was done yet if (bDoProcessRecursively) { @@ -1248,6 +1264,11 @@ void VclMetafileProcessor2D::processControlPrimitive2D( { process(rControlPrimitive); } + + if (mpPDFExtOutDevData) + { + mpPDFExtOutDevData->EndStructureElement(); + } } void VclMetafileProcessor2D::processTextHierarchyFieldPrimitive2D(