sw/qa/extras/ooxmlexport/data/tdf148494.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   12 ++++++++++++
 sw/source/filter/ww8/ww8atr.cxx              |    4 ++--
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit dfacd800395b95837a24a1f33267b46f96efd5de
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Apr 15 17:55:21 2022 +0200
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Sat Apr 16 20:41:51 2022 +0200

    tdf#148494: export: Always add space separator
    
    Otherwise, the macro is saved as MACROBUTTONAllCaps
    instead of MACROBUTTON AllCaps
    
    Change-Id: Id1288e23f21ce72884bc1197f171e255ea7458f5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133077
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133082
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf148494.docx 
b/sw/qa/extras/ooxmlexport/data/tdf148494.docx
new file mode 100644
index 000000000000..c60c73a206fb
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf148494.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 51f0d9fb9345..c0b693247828 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -68,6 +68,18 @@ CPPUNIT_TEST_FIXTURE(Test, testParaStyleNumLevel)
     assertXPath(pXmlDoc, 
"/w:styles/w:style[@w:styleId='Mystyle']/w:pPr/w:numPr/w:ilvl", "val", "1");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf148494)
+{
+    loadAndSave("tdf148494.docx");
+
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+
+    // Without the fix in place, this test would have failed with
+    // - Expected:  MACROBUTTON AllCaps Hello World
+    // - Actual  :  MACROBUTTONAllCaps Hello World
+    assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[3]/w:instrText", " 
MACROBUTTON AllCaps Hello World ");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf137466, "tdf137466.docx")
 {
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index cbafa7a909a0..8d5ac4e888fa 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3312,8 +3312,8 @@ void AttributeOutputBase::TextField( const SwFormatField& 
rField )
         break;
     case SwFieldIds::Macro:
         {
-            const OUString sStr = " MACROBUTTON"
-                + 
pField->GetPar1().replaceFirst("StarOffice.Standard.Modul1.", " ")
+            const OUString sStr = " MACROBUTTON "
+                + 
pField->GetPar1().replaceFirst("StarOffice.Standard.Modul1.", "")
                 + " "
                 + lcl_GetExpandedField(*pField);
             GetExport().OutputField( pField, ww::eMACROBUTTON, sStr );

Reply via email to