sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |    2 +-
 sw/source/filter/ww8/ww8atr.cxx               |    6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 17538ab4e5b644883292fc981801d363ebac5422
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Jan 20 15:09:22 2023 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Jan 31 14:54:17 2023 +0000

    sw: Word export: hyperlinks for ToX Figures/Objects/Tables
    
    This was missing, and lcl_IsHyperlinked() has a wrong termination check,
    which is noticable here because these have only 1 level (+ title at 0).
    
    Change-Id: I56a8622ee2c9df2167e26863cb3797b01434553c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145903
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 97cd92f3dee199d50856f24d51d7d7a236ae7bbe)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145951
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 96ba5e5a83e1..55d1a54b2b83 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -165,7 +165,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFDO77715)
     loadAndReload("FDO77715.docx");
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
 
-    assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:p[3]/w:r[2]/w:instrText[1]", " TOC \\c ");
+    assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:p[3]/w:r[2]/w:instrText[1]", " TOC \\c \\h ");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTOCFlag_u)
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 301b46e86319..77f0807ac93f 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2053,7 +2053,7 @@ static int lcl_CheckForm( const SwForm& rForm, sal_uInt8 
nLvl, OUString& rText )
 static bool lcl_IsHyperlinked(const SwForm& rForm, sal_uInt16 nTOXLvl)
 {
     bool bRes = false;
-    for (sal_uInt16 nI = 1; nI < nTOXLvl; ++nI)
+    for (sal_uInt16 nI = 1; nI <= nTOXLvl; ++nI)
     {
         // #i21237#
         SwFormTokens aPattern = rForm.GetPattern(nI);
@@ -2364,6 +2364,10 @@ void AttributeOutputBase::StartTOX( const SwSection& 
rSect )
                         sStr += "\\p \"" + aText + sEntryEnd;
                     }
                 }
+                if (lcl_IsHyperlinked(pTOX->GetTOXForm(), 1))
+                {
+                    sStr += "\\h ";
+                }
                 break;
 
             case TOX_AUTHORITIES:

Reply via email to