tdf#165886 sc: parse various quote characters
Otherwise roundtripped formulas in XLSX containing them can end up with extra parenthesis, eg: - Expected: OR(D1=0,D1<>““) - Actual : OR(D1=0,D1<>““)) Change-Id: I6d296687cc2467ca0cdee329f9b04f6c956d2de0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183987 Reviewed-by: Aron Budea <aron.budea@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -672,6 +672,26 @@ ParserFlags cclass_Unicode::getFlagsExtended(sal_uInt32 const c, const cclass_Un
|
||||
ParserFlags::WORD : ParserFlags::ILLEGAL;
|
||||
}
|
||||
break;
|
||||
case U_START_PUNCTUATION:
|
||||
// left angle, double angle and corner brackets
|
||||
if (c != 0x3008 && c != 0x300a && c != 0x300c && c != 0x300e)
|
||||
return ParserFlags::ILLEGAL;
|
||||
return bStart ? ParserFlags::CHAR_WORD : ParserFlags::WORD;
|
||||
case U_END_PUNCTUATION:
|
||||
// right angle, double angle and corner brackets
|
||||
if (c != 0x3009 && c != 0x300b && c != 0x300d && c != 0x300f)
|
||||
return ParserFlags::ILLEGAL;
|
||||
return bStart ? ParserFlags::CHAR_WORD : ParserFlags::WORD;
|
||||
case U_INITIAL_PUNCTUATION:
|
||||
// left single / double quotation marks
|
||||
if (c != 0x2018 && c != 0x201c)
|
||||
return ParserFlags::ILLEGAL;
|
||||
return bStart ? ParserFlags::CHAR_WORD : ParserFlags::WORD;
|
||||
case U_FINAL_PUNCTUATION:
|
||||
// right single / double quotation marks
|
||||
if (c != 0x2019 && c != 0x201d)
|
||||
return ParserFlags::ILLEGAL;
|
||||
return bStart ? ParserFlags::CHAR_WORD : ParserFlags::WORD;
|
||||
}
|
||||
|
||||
return ParserFlags::ILLEGAL;
|
||||
|
||||
Binary file not shown.
@@ -2209,6 +2209,38 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf165655)
|
||||
CPPUNIT_ASSERT_EQUAL(3, aNodes);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf165886)
|
||||
{
|
||||
createScDoc("xlsx/tdf165886.xlsx");
|
||||
|
||||
save(u"Calc Office Open XML"_ustr);
|
||||
|
||||
xmlDocUniquePtr pSheet = parseExport(u"xl/worksheets/sheet1.xml"_ustr);
|
||||
CPPUNIT_ASSERT(pSheet);
|
||||
|
||||
assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row[1]/x:c[1]/x:f", u"“");
|
||||
// Without the accompanying fix in place, this test would have failed with
|
||||
// - Expected: OR(D1=0,D1<>““)
|
||||
// - Actual : OR(D1=0,D1<>““))
|
||||
assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row[1]/x:c[2]/x:f", u"OR(D1=0,D1<>““)");
|
||||
// Similarly
|
||||
// - Expected: OR(E1=0,E1<>“)
|
||||
// - Actual : OR(E1=0,E1<>“))
|
||||
assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row[1]/x:c[3]/x:f", u"OR(E1=0,E1<>“)");
|
||||
// Similarly
|
||||
// - Expected: OR(D2=0,D2<>””)
|
||||
// - Actual : OR(D2=0,D2<>””))
|
||||
assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row[2]/x:c[2]/x:f", u"OR(D2=0,D2<>””)");
|
||||
// Similarly
|
||||
// - Expected: OR(D3=0,D3<>‘‘)
|
||||
// - Actual : OR(D3=0,D3<>‘‘))
|
||||
assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row[3]/x:c[2]/x:f", u"OR(D3=0,D3<>‘‘)");
|
||||
// Similarly
|
||||
// - Expected: OR(D4=0,D4<>’’)
|
||||
// - Actual : OR(D4=0,D4<>’’))
|
||||
assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]/x:f", u"OR(D4=0,D4<>’’)");
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
Reference in New Issue
Block a user