• Armin Le Grand's avatar
    Enhance tagged PDF export for a11y · 2840352b
    Armin Le Grand yazdı
    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
    2840352b
vclprocessor2d.hxx 6.49 KB