summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-04-05 18:00:27 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-04-06 09:34:52 +0200
commit5ef4d326a06f9fc0aff36bd5cdcba1b7af8e03db (patch)
tree267381ef0618b78dc69e417ec6e172125838fa8a /drawinglayer
parent2ca70301a97172b04c170f5f2e486c33114243ff (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>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx23
1 files changed, 22 insertions, 1 deletions
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 58396ba0c73b..9adbb7501701 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -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(