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>
This commit is contained in:
Michael Stahl 2023-04-05 18:00:27 +02:00
parent 2ca70301a9
commit 5ef4d326a0

View file

@ -1157,7 +1157,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)
{
@ -1177,6 +1176,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);
@ -1196,6 +1196,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)
{
@ -1240,6 +1256,11 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
{
process(rControlPrimitive);
}
if (mpPDFExtOutDevData)
{
mpPDFExtOutDevData->EndStructureElement();
}
}
void VclMetafileProcessor2D::processTextHierarchyFieldPrimitive2D(