From 78681cd0829dcb6a73690e1a63ae3808d297677a Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 23 Nov 2022 19:08:14 +0100 Subject: tdf#57423 drawinglayer: PDF/UA export: more Alt texts for SdrObjects Currently /Alt texts are generated from ObjectInfoPrimitive2D, but this is only evaluated in VclMetafileProcessor2D::processGraphicPrimitive2D() so while it's created for every SdrObject, it's ignored in most cases. There doesn't appear to be a reason why this is done in processGraphicPrimitive2D() and not a more generic location, the special conditions that are checked there don't have anything to do with Alt texts, they effectively guard some optimisation done to bitmaps in PageSyncData::PlaySyncPageAct(). There is another issue in that not every SdrObject gets a StructureTagPrimitive2D, and even if there is a StructureTagPrimitive2D it may be ignored if it's in the background. The Alt text must only be produced if there is a structure element for the same SdrObject, else it would end up on some unrelated structure element. Fix all this by moving processing to a new function which checks that there is a current StructureTagPrimitive2D for a SdrObject in effect. The only problem with this is that previously Writer images produced Alt text, and now they don't - but Writer needs some fixing anyway. Change-Id: I2a362e8a9cd93e5bc817c6eed546c46b46e14980 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143189 Tested-by: Jenkins Reviewed-by: Michael Stahl --- drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx') diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx index 0393039f4455..730b7aac11f2 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx @@ -63,6 +63,7 @@ class PolyPolygonColorPrimitive2D; class MaskPrimitive2D; class UnifiedTransparencePrimitive2D; class TransparencePrimitive2D; +class ObjectInfoPrimitive2D; class StructureTagPrimitive2D; } @@ -142,6 +143,8 @@ private: const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate); void processTransparencePrimitive2D( const primitive2d::TransparencePrimitive2D& rTransparenceCandidate); + void + processObjectInfoPrimitive2D(const primitive2d::ObjectInfoPrimitive2D& rObjectInfoPrimitive2D); void processStructureTagPrimitive2D( const primitive2d::StructureTagPrimitive2D& rStructureTagCandidate); @@ -191,6 +194,8 @@ private: std::stack maListElements; + primitive2d::StructureTagPrimitive2D const* mpCurrentStructureTag = nullptr; + protected: /* the local processor for BasePrimitive2D-Implementation based primitives, called from the common process()-implementation -- cgit