[Libreoffice-commits] core.git: sw/source

Georgy Litvinov (via logerrit) logerrit at kemper.freedesktop.org
Sun Jun 13 14:28:13 UTC 2021


 sw/source/core/text/EnhancedPDFExportHelper.cxx |   38 ++++++++++--------------
 1 file changed, 17 insertions(+), 21 deletions(-)

New commits:
commit 51d1952cf05381a48e6b0797d5e001452181b1ec
Author:     Georgy Litvinov <git at litvinovg.pro>
AuthorDate: Sat Jun 12 15:01:48 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jun 13 16:27:37 2021 +0200

    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 at collabora.co.uk>

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 );
                 }
+
             }
         }
 


More information about the Libreoffice-commits mailing list