sw/qa/extras/ooxmlexport/ooxmlexport5.cxx    |    5 ++++-
 sw/source/filter/ww8/docxattributeoutput.cxx |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit c136249982345b205da83d1907e21da0c7bab7dd
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Thu Apr 7 09:28:42 2022 +0200
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Mon Apr 18 05:18:48 2022 +0200

    tdf#148380 docx export: use content of unknown fields, not name
    
    This used to be GetCntnt, but then out of the blue in a huge
    squashed commit, it changed to GetFieldName. So I assume that
    was just debugging code that got accidentally committed.
    It just doesn't make any sense to export the field name
    as the plain text content instead of the field's value.
    
    commit ed40f62e64564d2b22c9285cfdc6778aeac8fd68
    Author: Michael Meeks on Mon Mar 14 16:51:14 2011 +0000
        Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
    
    NOTE: DOC also does a .replace(0x0A, 0x0B),
    //replace LF 0x0A with VT 0x0B
    //#i19604# convert hard line breaks inside fields to word equivalent
    
    After taking care of SAVEDATE, PRINTDATE, I tested this with
    assert(rInfos.pField->GetFieldName() == "Sender");
    and found no other examples.
    
    Change-Id: Ie24b8c176fe6df4015be221c87aa249fe9b8ce92
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132666
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index c4bcd2b23da1..2cf70462cbe9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -319,9 +319,12 @@ CPPUNIT_TEST_FIXTURE(Test, testOldComplexMergeTableInTable)
 
 CPPUNIT_TEST_FIXTURE(Test, testHyperlinkContainingPlaceholderField)
 {
-    loadAndSave("hyperlink-field.odt");
+    loadAndReload("hyperlink-field.odt");
     CPPUNIT_ASSERT_EQUAL(1, getShapes());
     parseExport("word/document.xml");
+
+    // tdf#148380 output unknown field's contents("") instead of field 
name("Sender" aka e-mail)
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), 
getParagraph(1)->getString().indexOf("Sender"));
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTablePreferredWidth)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6daca466f1ff..88df3b95f46d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2403,7 +2403,7 @@ void DocxAttributeOutput::StartField_Impl( const 
SwTextNode* pNode, sal_Int32 nP
     if ( rInfos.pField && rInfos.eType == ww::eUNKNOWN )
     {
         // Expand unsupported fields
-        RunText( rInfos.pField->GetFieldName() );
+        RunText(rInfos.pField->ExpandField(/*bCached=*/true, nullptr));
         return;
     }
     else if ( rInfos.eType == ww::eFORMDATE )

Reply via email to