diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-12-17 11:50:02 +0000 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-12-19 11:37:15 +0100 |
commit | 0c6756652fe9a189aca80774eb167439b5b087eb (patch) | |
tree | 858b9d60bceb02b0976d58b488f5c65b4c12b5f9 | |
parent | 2ddb4fee047c49bac1d831ee8320fb4662b21b4c (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/+/178672
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-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 7d0e6c4c0233..e3ccec3caf8e 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4831,7 +4831,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) { @@ -4843,7 +4843,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)) @@ -4853,7 +4853,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); } |