summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-04-15 17:55:21 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-04-15 19:17:54 +0200
commitc5d5c7e8c385f8a7e6ab824095e61aeeca4ab8c7 (patch)
treea5b9837902034b44c6841de9d6e88df647b255e1 /sw
parentb2b821715a3745718a941fa99dda92137c0f0c86 (diff)
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 <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf148494.docxbin0 -> 11605 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport17.cxx12
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx4
3 files changed, 14 insertions, 2 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf148494.docx
Binary files 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 );