summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-07-12 15:26:25 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-07-14 14:56:24 +0200
commit07d790ca473cd6e71f0343419b819fa6b485dc01 (patch)
treecdca4b6e130675323362012a2ef23f37a9a70489 /filter
parent9a148e4fb402d203ab0d2683dc316aa8217b576c (diff)
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 <michael.stahl@allotropia.de>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/pdf/pdfexport.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index f9c5fb44af6b..8199132b66b4 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -1263,7 +1263,9 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi
rWriter.Push();
// tdf#152235 tag around the reference to the XObject on the page
- rWriter.BeginStructureElement(vcl::PDFWriter::NonStructElement, ::std::u16string_view());
+ sal_Int32 const id = rWriter.EnsureStructureElement();
+ rWriter.InitStructureElement(id, vcl::PDFWriter::NonStructElement, ::std::u16string_view());
+ rWriter.BeginStructureElement(id);
rWriter.SetStructureAttribute(vcl::PDFWriter::Type, vcl::PDFWriter::Pagination);
rWriter.SetStructureAttribute(vcl::PDFWriter::Subtype, vcl::PDFWriter::Watermark);
// HACK: this should produce *nothing* itself but is necessary to output
@@ -1359,7 +1361,9 @@ void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rP
rWriter.Push();
// tdf#152235 tag around the reference to the XObject on the page
- rWriter.BeginStructureElement(vcl::PDFWriter::NonStructElement, ::std::u16string_view());
+ sal_Int32 const id = rWriter.EnsureStructureElement();
+ rWriter.InitStructureElement(id, vcl::PDFWriter::NonStructElement, ::std::u16string_view());
+ rWriter.BeginStructureElement(id);
rWriter.SetStructureAttribute(vcl::PDFWriter::Type, vcl::PDFWriter::Pagination);
rWriter.SetStructureAttribute(vcl::PDFWriter::Subtype, vcl::PDFWriter::Watermark);
// HACK: this should produce *nothing* itself but is necessary to output