sc/qa/unit/data/ods/tdf103829_textTab.ods |binary sc/qa/unit/subsequent_export_test2.cxx | 22 ++++++++++++++++++++++ sc/source/filter/xml/celltextparacontext.cxx | 4 ++++ 3 files changed, 26 insertions(+)
New commits: commit 690a35680adad07c4ab79d82cd1531bb82fe4bc1 Author: Justin Luth <jl...@mail.com> AuthorDate: Sat Sep 10 16:32:46 2022 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Tue Sep 13 01:42:54 2022 +0200 tdf#103829 ods import: parse <text:tab/> regression since LO 4.1 Change-Id: I65e847a45b8b233c558bf7bc90b554ba8b4b7763 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139757 Tested-by: Justin Luth <jl...@mail.com> Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sc/qa/unit/data/ods/tdf103829_textTab.ods b/sc/qa/unit/data/ods/tdf103829_textTab.ods new file mode 100644 index 000000000000..7f5256ebe739 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf103829_textTab.ods differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 11d069c632b1..2d1ecb212ae6 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -125,6 +125,7 @@ public: void testTdf91634XLSX(); void testTdf115159(); void testTdf112567(); + void testTdf103829(); void testTdf122191(); void testTdf142881(); void testTdf112567b(); @@ -248,6 +249,7 @@ public: CPPUNIT_TEST(testTdf91634XLSX); CPPUNIT_TEST(testTdf115159); CPPUNIT_TEST(testTdf112567); + CPPUNIT_TEST(testTdf103829); CPPUNIT_TEST(testTdf122191); CPPUNIT_TEST(testTdf142881); CPPUNIT_TEST(testTdf112567b); @@ -1437,6 +1439,26 @@ void ScExportTest2::testTdf112567() xDocSh->DoClose(); } +void ScExportTest2::testTdf103829() +{ + // The problem was that tabspaces were not imported or exported at all. + // These strings match the current implementations of CELLTYPE_EDIT and CELLTYPE_STRING. + const OUString sA1("\x001Leading tab\nTHREE tabs inside: [\x001\x001\x001]"); + const OUString sA2("\tLeading tab. THREE tabs inside: [\t\t\t]"); + + ScDocShellRef xShell = loadDoc(u"tdf103829_textTab.", FORMAT_ODS); + ScDocument& rDoc = xShell->GetDocument(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("load a1", sA1, rDoc.GetString(0, 0, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("load a1", sA1, rDoc.GetString(0, 0, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("load a2", sA2, rDoc.GetString(0, 1, 0)); + + xShell = saveAndReload(*xShell, FORMAT_ODS); + ScDocument& rDoc2 = xShell->GetDocument(); + //CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1.getLength(), rDoc2.GetString(0, 0, 0).getLength()); + //CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1, rDoc2.GetString(0, 0, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a2", sA2, rDoc2.GetString(0, 1, 0)); +} + void ScExportTest2::testTdf122191() { // Set the system locale to Hungarian diff --git a/sc/source/filter/xml/celltextparacontext.cxx b/sc/source/filter/xml/celltextparacontext.cxx index 5bbe5f20dea2..ff36a99cae92 100644 --- a/sc/source/filter/xml/celltextparacontext.cxx +++ b/sc/source/filter/xml/celltextparacontext.cxx @@ -63,7 +63,11 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLCellTextParaContex return new ScXMLCellFieldURLContext(GetScImport(), *this); case XML_ELEMENT( TEXT, XML_RUBY ): return new ScXMLCellTextRubyContext(GetScImport(), *this); + case XML_ELEMENT(TEXT, XML_TAB): + maContent += "\t"; + break; default: + assert(false && "unknown cell text: element"); ; }