diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-11-21 11:47:16 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-11-22 13:05:07 +0100 |
commit | 6e5d59c2ca6969e9491f97cd7a00d094fc62cfb3 (patch) | |
tree | f32fb1a4c4056b6204e409d9f743a02e844a0d9a /include | |
parent | 3d5e3cb4c033cc7b03c18851d56ca529f025038b (diff) |
tdf#135638 drawinglayer,svx,sw: PDF/UA export: put SdrObjects on anchor
... frame in the structure tree.
The problem is that in sw, the anchored objects are painted
outside of the call to paint the page frame, which is what generates the
/Document structure element.
For Writer fly frames, this is handled via their SwFlyDrawObj painting,
where SwTaggedPDFHelper::CheckReopenTag() finds the anchor frame and
temporarily sets it as the structure parent, even if it's on a previous
page.
But all the SdrObjects on a page are painted by 2 calls to PaintLayer()
and there isn't a call back into Writer now.
Somehow this even causes a spurious line like "/Document<</MCID 7>>BDC"
to be emitted outside any PDF object, which looks clearly wrong.
Try to extend the SdrObjUserCall to get a way to retrieve the anchor
frame's structure element index.
Another option would be to extend ViewObjectContactRedirector to return
the PDF Id in its subclass SwViewObjectContactRedirector, and it seems
possible since its only one caller is
ViewObjectContact::getPrimitive2DSequence(), but Armin adivses that the
ViewObjectContactRedirector might go away in the future so it's better
to use SdrObjUserCall.
It's annoying that the mapping is a static members of
SwEnhancedPDFExportHelper; possibly it could be in OutputDevice's
PDFExtOutDevData instead?
Change-Id: Id61faae469aba4f0bd278ab2324aae06c1fdde64
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143027
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/drawinglayer/primitive2d/structuretagprimitive2d.hxx | 6 | ||||
-rw-r--r-- | include/svx/svdobj.hxx | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx index c129e49d7800..bf8a48f98748 100644 --- a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx @@ -49,6 +49,8 @@ namespace drawinglayer::primitive2d bool mbBackground; /// flag for image (OBJ_GRAF) bool mbIsImage; + /// anchor structure element (Writer) + sal_Int32 m_nAnchorStructureElementId; public: /// constructor @@ -56,12 +58,14 @@ namespace drawinglayer::primitive2d const vcl::PDFWriter::StructElement& rStructureElement, bool bBackground, bool bIsImage, - Primitive2DContainer&& aChildren); + Primitive2DContainer&& aChildren, + sal_Int32 nAnchorStructureElementId = -1); /// data read access const vcl::PDFWriter::StructElement& getStructureElement() const { return maStructureElement; } bool isBackground() const { return mbBackground; } bool isImage() const { return mbIsImage; } + sal_Int32 GetAnchorStructureElementId() const { return m_nAnchorStructureElementId; } /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 3c30c479dc80..3cc030c0b293 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -130,6 +130,7 @@ class SVXCORE_DLLPUBLIC SdrObjUserCall public: virtual ~SdrObjUserCall(); virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& rOldBoundRect); + virtual sal_Int32 GetPDFAnchorStructureElementId(SdrObject const& rObj, OutputDevice const&); }; class SVXCORE_DLLPUBLIC SdrObjMacroHitRec |