summaryrefslogtreecommitdiff
path: root/drawinglayer/source
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-03-27 12:51:24 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-04-04 15:01:15 +0200
commit2a87a59a52ae26db5106f7d1f4346225d032b550 (patch)
tree00347577e9dc4c3730631d2daef2a4a2c50abda8 /drawinglayer/source
parent4047cb44b7a41115dafb7cffcebd2a02329283df (diff)
tdf#152234 vcl,drawinglayer: PDF/UA export: produce Role for form controls
veraPDF complains: Specification: ISO 14289-1:2014, Clause: 7.18.4, Test number: 2 If the Form element omits a Role attribute (Table 348), it shall have only one child: an object reference (14.7.4.3) identifying the widget annotation per ISO 32000-1:2008, 14.8.4.5, Table 340. LO forms produce both page content in an MCID and an /Annot, so Role is needed. Change-Id: Ic231931a7c35d8da37ca76e02d97501edb43347c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149626 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'drawinglayer/source')
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 56675ff113ef..58396ba0c73b 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1158,6 +1158,25 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Form);
OUString const& rAltText(rControlPrimitive.GetAltText());
+ vcl::PDFWriter::StructAttributeValue role;
+ switch (pPDFControl->Type)
+ {
+ case vcl::PDFWriter::PushButton:
+ role = vcl::PDFWriter::Pb;
+ break;
+ case vcl::PDFWriter::RadioButton:
+ role = vcl::PDFWriter::Rb;
+ break;
+ case vcl::PDFWriter::CheckBox:
+ role = vcl::PDFWriter::Cb;
+ break;
+ default: // there is a paucity of roles, tv is the catch-all one
+ role = vcl::PDFWriter::Tv;
+ break;
+ }
+ // ISO 14289-1:2014, Clause: 7.18.4
+ mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Role, role);
+ // ISO 14289-1:2014, Clause: 7.18.1
if (!rAltText.isEmpty())
{
mpPDFExtOutDevData->SetAlternateText(rAltText);