summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsw/qa/extras/ooxmlexport/data/tdf124986.docxbin0 -> 12108 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx21
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx8
3 files changed, 27 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf124986.docx b/sw/qa/extras/ooxmlexport/data/tdf124986.docx
new file mode 100755
index 000000000000..e5bb8f4966b8
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf124986.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 12950c8451a7..98ee2ab45c48 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -67,6 +67,27 @@ DECLARE_OOXMLIMPORT_TEST(testTdf125038, "tdf125038.docx")
CPPUNIT_ASSERT_EQUAL(OUString("phone: \t1234567890"), aActual);
}
+DECLARE_OOXMLIMPORT_TEST(testTdf124986, "tdf124986.docx")
+{
+ // Load a document with SET fields, where the SET fields contain leading/trailing quotation marks and spaces.
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
+ uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+
+ while (xFields->hasMoreElements())
+ {
+ uno::Reference<lang::XServiceInfo> xServiceInfo(xFields->nextElement(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPropertySet(xServiceInfo, uno::UNO_QUERY);
+ OUString aValue;
+ if (xServiceInfo->supportsService("com.sun.star.text.TextField.SetExpression"))
+ {
+ xPropertySet->getPropertyValue("Content") >>= aValue;
+ CPPUNIT_ASSERT_EQUAL(OUString("demo"), aValue);
+ }
+ }
+}
+
DECLARE_OOXMLIMPORT_TEST(testTdf125038b, "tdf125038b.docx")
{
// Load a document with an IF field, where the IF field command contains a paragraph break.
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 732099649ae4..19f3e67aee73 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3650,9 +3650,13 @@ void DomainMapper_Impl::handleFieldSet
sVariable = lcl_ExctractVariableAndHint(pContext->GetCommand(), sHint);
// remove surrounding "" if exists
- if( sHint.getLength() >= 2 && sHint.startsWith("\"") )
+ if(sHint.getLength() >= 2)
{
- sHint = sHint.trim().copy(1, sHint.getLength() - 2);
+ OUString sTmp = sHint.trim();
+ if (sTmp.startsWith("\"") && sTmp.endsWith("\""))
+ {
+ sHint = sTmp.copy(1, sTmp.getLength() - 2);
+ }
}
// determine field master name