summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgy Litvinov <git@litvinovg.pro>2021-06-12 15:01:48 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-13 16:27:37 +0200
commit51d1952cf05381a48e6b0797d5e001452181b1ec (patch)
tree1307f1f44db440a4bc0114c0558268df45b5e7fd
parent07021596acb3d104ba129d371b1ae0b79f67a6a4 (diff)
tdf#142741 and tdf#38187 Set valid pages for footnote links PDF export.
Change-Id: I7c00e1a522a51796c9f543a74bd8abcee6792faf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117078 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx38
1 files changed, 17 insertions, 21 deletions
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 258c0313b981..f3d9e69ad51b 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1969,39 +1969,35 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Goto footnote text:
if ( mrSh.GotoFootnoteText() )
{
- // Link PageNums
- std::vector<sal_Int32> aLinkPageNums = CalcOutputPageNums( aLinkRect );
-
// Destination Rectangle
const SwRect& rDestRect = mrSh.GetCharRect();
+ const sal_Int32 nDestPageNum = CalcOutputPageNum( rDestRect );
+ if ( -1 != nDestPageNum )
+ {
+ const SwPageFrame* pCurrPage = static_cast<const SwPageFrame*>( mrSh.GetLayout()->Lower() );
+ // Destination PageNum
+ tools::Rectangle aRect = SwRectToPDFRect(pCurrPage, rDestRect.SVRect());
+ // Destination Export
+ const sal_Int32 nDestId = pPDFExtOutDevData->CreateDest(aRect, nDestPageNum);
+ mrSh.GotoFootnoteAnchor();
- const SwPageFrame* pCurrPage =
- static_cast<const SwPageFrame*>( mrSh.GetLayout()->Lower() );
+ // Link PageNums
+ sal_Int32 aLinkPageNum = CalcOutputPageNum( aLinkRect );
- // Destination PageNum
- const sal_Int32 nDestPageNum = CalcOutputPageNum( rDestRect );
+ pCurrPage = static_cast<const SwPageFrame*>( mrSh.GetLayout()->Lower() );
- for (sal_Int32 aLinkPageNum : aLinkPageNums)
- {
// Link Export
- tools::Rectangle aRect(SwRectToPDFRect(pCurrPage, aLinkRect.SVRect()));
- const sal_Int32 nLinkId =
- pPDFExtOutDevData->CreateLink(aRect, aLinkPageNum);
+ aRect = SwRectToPDFRect(pCurrPage, aLinkRect.SVRect());
+ const sal_Int32 nLinkId = pPDFExtOutDevData->CreateLink(aRect, aLinkPageNum);
// Store link info for tagged pdf output:
const IdMapEntry aLinkEntry( aLinkRect, nLinkId );
s_aLinkIdMap.push_back( aLinkEntry );
- if ( -1 != nDestPageNum )
- {
- aRect = SwRectToPDFRect(pCurrPage, rDestRect.SVRect());
- // Destination Export
- const sal_Int32 nDestId = pPDFExtOutDevData->CreateDest(rDestRect.SVRect(), nDestPageNum);
-
- // Connect Link and Destination:
- pPDFExtOutDevData->SetLinkDest( nLinkId, nDestId );
- }
+ // Connect Link and Destination:
+ pPDFExtOutDevData->SetLinkDest( nLinkId, nDestId );
}
+
}
}