diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-12-17 11:50:02 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-12-17 17:48:03 +0100 |
commit | 3bc4e8eb33223ff566c0b86ab77afc951466f2aa (patch) | |
tree | d9471d581ee6f6e2aeab35c045146e2a3fbcab09 | |
parent | 68c3c643bb3142908c7370b1dea4b636d905cbb6 (diff) |
crashtesting: unable to import rtf export of forum-mso-en-14843.doc
user field names have control chars in them and import from rtf hits
the code added by:
commit a6516c76c01b92f7d35bfb352b63af7de42b5707
CommitDate: Wed Oct 30 14:44:09 2019 +0100
writerfilter: rtftok: filter control characters
so control chars are stripped out, which results in a duplicate
user field name which throws. Filtering out at doc import time
seems to work better, so lets do that as well.
Change-Id: I463e30b223bfb5639de23c696d112eda2c27b428
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178657
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
(cherry picked from commit 7c2d94c6b41a71e0440953d753f6a7092626bc9c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178671
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index d2f67900b412..8d57a43297ca 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4835,7 +4835,7 @@ void SwWW8ImplReader::ReadDocVars() uno::Reference< container::XNameAccess > xFieldMasterAccess = xFieldsSupplier->getTextFieldMasters(); for(size_t i = 0; i < aDocVarStrings.size(); i++) { - const OUString &rName = aDocVarStrings[i]; + const OUString sName = sw::FilterControlChars(aDocVarStrings[i]); uno::Any aValue; if (aDocValueStrings.size() > i) { @@ -4847,7 +4847,7 @@ void SwWW8ImplReader::ReadDocVars() } uno::Reference< beans::XPropertySet > xMaster; - OUString sFieldMasterService("com.sun.star.text.FieldMaster.User." + rName); + OUString sFieldMasterService("com.sun.star.text.FieldMaster.User." + sName); // Find or create Field Master if (xFieldMasterAccess->hasByName(sFieldMasterService)) @@ -4857,7 +4857,7 @@ void SwWW8ImplReader::ReadDocVars() else { xMaster.set(xTextFactory->createInstance(u"com.sun.star.text.FieldMaster.User"_ustr), uno::UNO_QUERY_THROW); - xMaster->setPropertyValue(u"Name"_ustr, uno::Any(rName)); + xMaster->setPropertyValue(u"Name"_ustr, uno::Any(sName)); } xMaster->setPropertyValue(u"Content"_ustr, aValue); } |