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 15:24:43 +0100 |
commit | 7c2d94c6b41a71e0440953d753f6a7092626bc9c (patch) | |
tree | 1df8a2c7f53c575296553c61110b3daf4e89c6dd /sw/source | |
parent | fae1eb775d44438a2193ba1ec07261ea0a94fef4 (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
Diffstat (limited to 'sw/source')
-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); } |