diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-04-05 18:00:27 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-05-13 20:01:49 +0200 |
commit | b72a5721e5a7105430fd716fb4dbc404221feb6f (patch) | |
tree | e3e391d835a8827fa58a97c9bd52d9336cc9ecbc /drawinglayer | |
parent | 363fc14e7354e4d971e2002e666f800ef3712434 (diff) |
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.stahl@allotropia.de>
(cherry picked from commit 5ef4d326a06f9fc0aff36bd5cdcba1b7af8e03db)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150094
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 23 |
1 files changed, 22 insertions, 1 deletions
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( |