From 07d790ca473cd6e71f0343419b819fa6b485dc01 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 12 Jul 2023 15:26:25 +0200 Subject: tdf#154982 vcl: PDF Export: split BeginStructureElement ... into 3 parts: EnsureStructureElement/InitStructureElement/BeginStructureElement So EnsureStructureElement and BeginStructureElement/EndStructureElement can be called multiple times for the same object, passing in a unique key and PDFExtOutDevData will only create the element once. InitStructureElement will be used exactly once for each object when its actual content is exported. In PDFExtOutDevData rely on the indexes being the same here and in PDFWriterImpl, because then only PDFExtOutDevData needs to maintain the map from key to index. Change-Id: Idea6e34627fe559038cf13cf01dafe84b759e3c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154357 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/source/core/text/EnhancedPDFExportHelper.cxx | 2 +- sw/source/core/text/itrform2.cxx | 2 +- sw/source/uibase/docvw/AnnotationWin2.cxx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'sw') diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 7b5732e925da..e48774f2b2c2 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -459,7 +459,7 @@ void SwTaggedPDFHelper::CheckRestoreTag() const void SwTaggedPDFHelper::BeginTag( vcl::PDFWriter::StructElement eType, const OUString& rString ) { // write new tag - const sal_Int32 nId = mpPDFExtOutDevData->BeginStructureElement( eType, rString ); + const sal_Int32 nId = mpPDFExtOutDevData->WrapBeginStructureElement( eType, rString ); ++m_nEndStructureElement; #if OSL_DEBUG_LEVEL > 1 diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 5895825bf668..2f5abb9a5c6b 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1094,7 +1094,7 @@ bool SwContentControlPortion::DescribePDFControl(const SwTextPaintInfo& rInf) co aLocation.Union(aEndRect); pDescriptor->Location = aLocation.SVRect(); - pPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Form); + pPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Form); pPDFExtOutDevData->CreateControl(*pDescriptor); pPDFExtOutDevData->EndStructureElement(); diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 047afe5e63d5..885c19877dc1 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -166,7 +166,7 @@ void SwAnnotationWin::DrawForPage(OutputDevice* pDev, const Point& rPt) dynamic_cast(pDev->GetExtOutDevData())); if (pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportTaggedPDF()) { - pPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::NonStructElement, OUString()); + pPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement, OUString()); } pDev->Push(); -- cgit