[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/qa writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Jan 16 16:24:31 UTC 2019
sw/qa/extras/ooxmlimport/data/tdf122224.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 11 +++++++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 9 +++++++++
3 files changed, 20 insertions(+)
New commits:
commit b095e8f3b27331f0d646b1d33e51e17c37e43e2c
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Mon Jan 7 21:28:29 2019 +0100
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed Jan 16 17:24:08 2019 +0100
tdf#122224 DOCX import: fix formula field syntax
by removing the DOCX custom number format string
which caused a syntax error message here instead
of the formula calculation.
Change-Id: Ia643e966440117871f6b4ddceab610100ac34138
Reviewed-on: https://gerrit.libreoffice.org/65945
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 7209feef41c3c858476a2ae9795a7d2264c0ffc0)
Reviewed-on: https://gerrit.libreoffice.org/65959
Tested-by: Xisco Faulí <xiscofauli at libreoffice.org>
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/ooxmlimport/data/tdf122224.docx b/sw/qa/extras/ooxmlimport/data/tdf122224.docx
new file mode 100644
index 000000000000..14518403cae1
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf122224.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index c1e353a9243b..edf11956b293 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -287,6 +287,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf115094, "tdf115094.docx")
CPPUNIT_ASSERT_EQUAL(xText1.get(), xText2.get());
}
+DECLARE_OOXMLIMPORT_TEST(testTdf122224, "tdf122224.docx")
+{
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A2"), uno::UNO_QUERY_THROW);
+ // This was "** Expression is faulty **", because of the unnecessary DOCX number format string
+ CPPUNIT_ASSERT_EQUAL(OUString("2000"), xCell->getString());
+}
+
// tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 326fb0df9a89..f2a14ceb8f7a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3402,6 +3402,15 @@ void DomainMapper_Impl::handleFieldFormula
uno::Reference< beans::XPropertySet > const& xFieldProperties)
{
OUString command = pContext->GetCommand().trim();
+
+ // Remove number formatting from \# to end of command
+ // TODO: handle custom number formatting
+ sal_Int32 delimPos = command.indexOf("\\#");
+ if (delimPos != -1)
+ {
+ command = command.replaceAt(delimPos, command.getLength() - delimPos, "").trim();
+ }
+
// command must contains = and at least another char
if (command.getLength() < 2)
return;
More information about the Libreoffice-commits
mailing list