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 c5d5c7e8c385f8a7e6ab824095e61aeeca4ab8c7 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Apr 15 17:55:21 2022 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Apr 15 19:17:54 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> 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 75b483e7d239..960bb3f16d8b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -158,6 +158,18 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlExport) assertXPath(pXmlDoc, "//w:sdt/w:sdtContent", 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 72bdc213f4b3..b9c71e4433ae 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -3300,8 +3300,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 );