diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-07-12 18:34:24 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2023-07-14 14:56:52 +0200 |
commit | d467f1aa3d028f399826c97e2eecedcd79efcf65 (patch) | |
tree | 070cfd0431fc032240580145d0add2d4b2a9dcc1 /drawinglayer | |
parent | 07d790ca473cd6e71f0343419b819fa6b485dc01 (diff) |
tdf#154982 drawinglayer,svx,sw,vcl: PDF export: hell flys and shapes...
... should be below their anchor paragraph in the structure tree.
Refactor SwEnhancedPDFExportHelper (etc.) to use the new
EnsureStructureElement()/InitStructureElement() functions instead of
SetCurrentStructureElement() for the frames, and allow it for flys that
don't have their anchor paragraphs created yet because the hell layer is
exported before the document body.
Change-Id: I1be3b54002e8196772e6f9d81dd0fd0c85b6e34b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154399
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/primitive2d/structuretagprimitive2d.cxx | 4 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 27 |
2 files changed, 10 insertions, 21 deletions
diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx index 62da91ecc00f..47af55ab9b57 100644 --- a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx @@ -31,13 +31,13 @@ namespace drawinglayer::primitive2d bool bBackground, bool bIsImage, Primitive2DContainer&& aChildren, - sal_Int32 const nAnchorStructureElementId, + void const*const pAnchorStructureElementKey, ::std::vector<sal_Int32> const*const pAnnotIds) : GroupPrimitive2D(std::move(aChildren)), maStructureElement(rStructureElement), mbBackground(bBackground), mbIsImage(bIsImage) - , m_nAnchorStructureElementId(nAnchorStructureElementId) + , m_pAnchorStructureElementKey(pAnchorStructureElementKey) { if (pAnnotIds) { diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index b2045a5e18c0..1a7beb8affc6 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -2527,7 +2527,7 @@ void VclMetafileProcessor2D::processStructureTagPrimitive2D( // structured tag primitive const vcl::PDFWriter::StructElement& rTagElement(rStructureTagCandidate.getStructureElement()); bool bTagUsed((vcl::PDFWriter::NonStructElement != rTagElement)); - sal_Int32 nPreviousElement(-1); + bool bNeedEndAnchor(false); if (!rStructureTagCandidate.isTaggedSdrObject()) { @@ -2539,19 +2539,12 @@ void VclMetafileProcessor2D::processStructureTagPrimitive2D( // foreground object: tag as regular structure element if (!rStructureTagCandidate.isBackground()) { - if (rStructureTagCandidate.GetAnchorStructureElementId() != -1) + if (rStructureTagCandidate.GetAnchorStructureElementKey() != nullptr) { - auto const nTemp = mpPDFExtOutDevData->GetCurrentStructureElement(); - bool const bSuccess = mpPDFExtOutDevData->SetCurrentStructureElement( - rStructureTagCandidate.GetAnchorStructureElementId()); - if (bSuccess) - { - nPreviousElement = nTemp; - } - else - { - SAL_WARN("drawinglayer", "anchor structure element not found?"); - } + sal_Int32 const id = mpPDFExtOutDevData->EnsureStructureElement( + rStructureTagCandidate.GetAnchorStructureElementKey()); + mpPDFExtOutDevData->BeginStructureElement(id); + bNeedEndAnchor = true; } mpPDFExtOutDevData->WrapBeginStructureElement(rTagElement); switch (rTagElement) @@ -2627,13 +2620,9 @@ void VclMetafileProcessor2D::processStructureTagPrimitive2D( { // write end tag mpPDFExtOutDevData->EndStructureElement(); - if (nPreviousElement != -1) + if (bNeedEndAnchor) { -#ifndef NDEBUG - bool const bSuccess = -#endif - mpPDFExtOutDevData->SetCurrentStructureElement(nPreviousElement); - assert(bSuccess); + mpPDFExtOutDevData->EndStructureElement(); } } } |