diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-01-20 10:03:20 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-01-20 10:52:24 +0100 |
commit | 31bbaf478783e3a2c21bd3ea94ddf39299a63d1e (patch) | |
tree | b655ec9d425b7c7f44a6e681321670616b4412e9 /filter/source | |
parent | 972aa39fb976e30ce73065b1eba69f4c78c17855 (diff) |
tdf#141340 PDF export: fix hyperlinks on the wrong page with page num range
Regression from commit 01dbb38680aa39a4d3bc7afd05d44a4b2c9bc6ab
(tdf#61274 sd PDF export: fix links ending up on wrong pages with hidden
slides, 2020-03-10), the problem was that the sd/ code that mapped page
numbers between the model and the PDF output only handled hidden slides,
but not partial exports.
Fix this by revisiting the decision to handle hidden slides in sd/, the
filter/ code at the end does have enough information to correctly do
this mapping at the end, and this way both tdf#61274 and tdf#141340 can
work at the same time.
Change-Id: I5679743ca67fab562e14c73e32f1a06ead8e7a31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128643
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'filter/source')
-rw-r--r-- | filter/source/pdf/pdfexport.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 43d2b97167fd..604326b4bdbf 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -220,6 +220,7 @@ bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, aMtf.Stop(); aMtf.WindStart(); + bool bEmptyPage = false; if( aMtf.GetActionSize() && ( !mbSkipEmptyPages || aPageSize.Width || aPageSize.Height ) ) { @@ -244,6 +245,10 @@ bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, ImplExportPage(rPDFWriter, rPDFExtOutDevData, aMtf); bRet = true; } + else + { + bEmptyPage = true; + } pOut->Pop(); @@ -253,7 +258,12 @@ bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, *pFirstPage <<= false; ++mnProgressValue; - ++nCurrentPage; + if (!bEmptyPage) + { + // Calculate the page number in the PDF output, which may be smaller than the page number in + // case of hidden slides or a partial export. + ++nCurrentPage; + } } } else |