summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-11-21 11:47:16 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-11-25 16:42:06 +0100
commitc3ceb66ffc354a6fccd5d5d9fbc32b8c14d6b79e (patch)
treeb6f30caa61437e0b1e01d28f9e843a2ce541f817 /svx
parent8abf381416e4cad90027542c1d230736cc1b4d96 (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> (cherry picked from commit 6e5d59c2ca6969e9491f97cd7a00d094fc62cfb3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143112 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/sdr/contact/viewobjectcontact.cxx10
-rw-r--r--svx/source/svdraw/svdobj.cxx5
2 files changed, 14 insertions, 1 deletions
diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx
index 4ef5dc498563..ac5d6131930b 100644
--- a/svx/source/sdr/contact/viewobjectcontact.cxx
+++ b/svx/source/sdr/contact/viewobjectcontact.cxx
@@ -412,13 +412,21 @@ drawinglayer::primitive2d::Primitive2DContainer const & ViewObjectContact::getPr
{
const bool bBackground(pSdrPage->IsMasterPage());
const bool bImage(SdrObjKind::Graphic == pSdrObj->GetObjIdentifier());
+ // note: there must be output device here, in PDF export
+ sal_Int32 nAnchorId(-1);
+ if (auto const pUserCall = pSdrObj->GetUserCall())
+ {
+ nAnchorId = pUserCall->GetPDFAnchorStructureElementId(
+ *pSdrObj, *GetObjectContact().TryToGetOutputDevice());
+ }
drawinglayer::primitive2d::Primitive2DReference xReference(
new drawinglayer::primitive2d::StructureTagPrimitive2D(
eElement,
bBackground,
bImage,
- std::move(xNewPrimitiveSequence)));
+ std::move(xNewPrimitiveSequence),
+ nAnchorId));
xNewPrimitiveSequence = drawinglayer::primitive2d::Primitive2DContainer { xReference };
}
}
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index e8d41c51b39d..4f13059a7314 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -136,6 +136,11 @@ void SdrObjUserCall::Changed(const SdrObject& /*rObj*/, SdrUserCallType /*eType*
{
}
+sal_Int32 SdrObjUserCall::GetPDFAnchorStructureElementId(SdrObject const&, OutputDevice const&)
+{
+ return -1;
+}
+
SdrObjMacroHitRec::SdrObjMacroHitRec() :
pVisiLayer(nullptr),
pPageView(nullptr),