Enhance tagged PDF export for a11y
commit2840352ba56a212d191cc16e08378c87672d7b73
authorArmin Le Grand <Armin.Le.Grand@cib.de>
Thu, 20 Dec 2018 16:31:32 +0000 (20 17:31 +0100)
committerThorsten Behrens <Thorsten.Behrens@CIB.de>
Wed, 6 Feb 2019 15:46:08 +0000 (6 16:46 +0100)
treeb61423212519ebc9e2afc0e780aca1661f42403f
parentcdfa8b27f28328612b6734533981c1b363ced0a0
Enhance tagged PDF export for a11y

The current tagged PDF export does not well support
quite some internal structures. This includes all
apps (Draw/Impress/Writer/Calc) and some areas.

-= AlternativeText ('/Alt'):

Only writer currently at least adds Title information,
but we also have Description (MS does add) and Name.
Target is to add this information when available to
content frames.
Writer did that by manually adding that tag using
PDFExtOutDevData::SetAlternateText, but only used
Title so far.
To make this work as broad as possible, better add
this to primitives. There is already a primitive called
ObjectInfoPrimitive2D that encapsulates any content
adding Name/Title/Description using GroupPrimitive
functionality.
Changed Writer to use that way. Draw/Impress already
uses it, all apps now use graphic paint using primitives,
so we have a natural target to encapsulate. Add support
to VclMetafileProcessor2D to interpret it and add
- if mpPDFExtOutDevData->GetIsExportTaggedPDF() - that
data using a combination of Name/Title/Description and
add using mpPDFExtOutDevData->SetAlternateText.
This works for Draw/Impress/Writer, but not for Calc
because Calc does not create more complex data structures,
so SetAlternateText does not work (see
PDFWriterImpl::setAlternateText for more infos).

-= Area tagged ListContent (use 'L', 'LI', 'LBody' PDF tags):

To support this in Draw/Impress, we can also use a similar
way to support in primitives. For this I evaluated how to
add needed OutlineLevel information to the existing (and
already used to write 'P') TextHierarchyParagraphPrimitive2D.
Added this and now ready to use in VclMetafileProcessor2D
::processTextHierarchyParagraphPrimitive2D.
Added now using the OutlineLevel information at the
TextHierarchyParagraphPrimitive2D. Made sure there are
fallbacks to unchanged old behaviour when no PDF export
or no Tagged-PDF used. Creating now '/L', '/LI' and '/LBody'
statements as tagged PDF wants us to do.
Exported PDF still works well while additionally a verifier
as 'PAC 3' shows the expected and wanted structure.
This will work now for any text in Draw/Impress and for
Draw-Objects using Lists in Calc. Need to check for direct
text in Calc cells and Writer - and guess how big the
effort would be for these to make it work there, too.

-= Area '/Artifact':

Target is to avoid too much ScreenReader hassle when
Impress uses Pictures/FillPatterns etc. in Background
- what means on MasterPage in Impress.
Experimented with different possibilities. Decided to use
existing StructureTagPrimitive2D and extend for info if
encapsulated data is 'Background' data -> on MasterPage.
Can be created in ImplRenderPaintProc in method
createRedirectedPrimitive2DSeque as needed by checking
for MasterPage member (remember: primitives need to be
as independent from model data as possible, never include
e.g. a SdrObject reference in any way).
Tried different ways to use this in VclMetafileProcessor2D
processStructureTagPrimitive2D, see comments there. Current
best solution is to just *not* create StuctureTag information
for these objects.

Change-Id: Ib2a578b02c1256758cda6d15ce37799803d8205c
14 files changed:
drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx
drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx
drawinglayer/source/processor2d/vclprocessor2d.cxx
drawinglayer/source/processor2d/vclprocessor2d.hxx
include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx
sd/source/ui/unoidl/unomodel.cxx
svx/source/svdraw/svdotextdecomposition.cxx
sw/source/core/doc/notxtfrm.cxx
sw/source/core/inc/frmtool.hxx
sw/source/core/layout/paintfrm.cxx
sw/source/core/text/EnhancedPDFExportHelper.cxx