summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-08-10 16:59:31 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-08-11 20:49:02 +0200
commit12ea892df9ca1691c406b4c98f996456e3b69307 (patch)
treec9193da10cd3fc1253c49933c1bf7e609d3f1213
parent8aa125c0f27520d9c6938084f3fb4f97fefcc720 (diff)
tdf#119197: import some symbols as symbols, not as Math functions
... to avoid broken formulas due to missing arguments Change-Id: If86737450a16a257528cfb9d5f52915ec930f6a8 Reviewed-on: https://gerrit.libreoffice.org/58835 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--starmath/source/mathtype.cxx50
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf119200.docxbin0 -> 20728 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx13
3 files changed, 29 insertions, 34 deletions
diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx
index 14f6ce75e016..9bd8c4e69ed7 100644
--- a/starmath/source/mathtype.cxx
+++ b/starmath/source/mathtype.cxx
@@ -311,14 +311,12 @@ bool MathType::LookupChar(sal_Unicode nChar,OUStringBuffer &rRet,sal_uInt8 nVers
case 0x2207:
pC = " nabla ";
break;
- case 0x2208:
- pC = " in ";
+ case 0x2208: // in
+ case 0x2209: // notin
+ rRet.append(" func ").append(OUStringLiteral1(nChar)).append(" ");
break;
- case 0x2209:
- pC = " notin ";
- break;
- case 0x220d:
- pC = " owns ";
+ case 0x220d: // owns
+ rRet.append(" func ").append(OUStringLiteral1(0x220b)).append(" ");
break;
case 0x220f:
pC = " prod ";
@@ -421,33 +419,17 @@ bool MathType::LookupChar(sal_Unicode nChar,OUStringBuffer &rRet,sal_uInt8 nVers
pC = " nsucc ";
break;
- case 0x2282:
- pC = " subset ";
- break;
- case 0x2283:
- pC = " supset ";
- break;
- case 0x2284:
- pC = " nsubset ";
- break;
- case 0x2285:
- pC = " nsupset ";
- break;
- case 0x2286:
- pC = " subseteq ";
- break;
- case 0x2287:
- pC = " supseteq ";
- break;
- case 0x2288:
- pC = " nsubseteq ";
- break;
- case 0x2289:
- pC = " nsupseteq ";
- break;
- case 0x22b2:
- case 0x22b3:
- rRet.append(" ").append(OUStringLiteral1(nChar)).append(" ");
+ case 0x2282: // subset
+ case 0x2283: // supset
+ case 0x2284: // nsubset
+ case 0x2285: // nsupset
+ case 0x2286: // subseteq
+ case 0x2287: // supseteq
+ case 0x2288: // nsubseteq
+ case 0x2289: // nsupseteq
+ case 0x22b2: // NORMAL SUBGROUP OF
+ case 0x22b3: // CONTAINS AS NORMAL SUBGROUP
+ rRet.append(" func ").append(OUStringLiteral1(nChar)).append(" ");
break;
case 0x22a5:
pC = " ortho ";
diff --git a/sw/qa/extras/ooxmlimport/data/tdf119200.docx b/sw/qa/extras/ooxmlimport/data/tdf119200.docx
new file mode 100644
index 000000000000..eafe186fd27e
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf119200.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 7b34c98c3dd3..7f548f47e65d 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -210,6 +210,19 @@ DECLARE_OOXMLIMPORT_TEST(testTdf116486, "tdf116486.docx")
CPPUNIT_ASSERT_EQUAL(OUString("4006"), aTop);
}
+DECLARE_OOXMLIMPORT_TEST(testTdf119200, "tdf119200.docx")
+{
+ auto xPara = getParagraph(1);
+ // Check that we import MathType functional symbols as symbols, not functions with missing args
+ CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2208 } {}"), getFormula(getRun(xPara, 1)));
+ CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2209 } {}"), getFormula(getRun(xPara, 2)));
+ CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2282 } {}"), getFormula(getRun(xPara, 3)));
+ CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2283 } {}"), getFormula(getRun(xPara, 4)));
+ CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2284 } {}"), getFormula(getRun(xPara, 5)));
+ CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2286 } {}"), getFormula(getRun(xPara, 6)));
+ CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2287 } {}"), getFormula(getRun(xPara, 7)));
+}
+
// tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
CPPUNIT_PLUGIN_IMPLEMENT();