tdf#75702 ODS import: send text:line-break to editeng
A cell with a line-break specified is no longer a simple string,
so send the string to editeng where it can be properly displayed.
This already works fine for XLS and XLSX.
This change effectively means that text:line-break
will disappear, and become two separate paragraphs.
Given the nature of spreadsheets, the precidence in
various other patches and the failure to properly
display without this, I think I'm fine with
unilaterally changing one paragraph into two.
Change-Id: I7abcbc6f698a4cb319aea5465a8b0393cf63f31f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140262
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx
index 7bbb908..cadc2da 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -1456,7 +1456,7 @@ void ScExportTest2::testTdf75702()
xmlDocUniquePtr pContent
= XPathHelper::parseExport2(*this, *xShell, m_xSFactory, "content.xml", FORMAT_ODS);
assertXPath(pContent, "//table:table-row[1]/table:table-cell/text:p/text:line-break");
assertXPath(pContent, "//table:table-row[1]/table:table-cell/text:p", 2);
}
void ScExportTest2::testTdf103829()
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index e7a8037..2945040 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -47,6 +47,7 @@
#include "editattributemap.hxx"
#include <tokenarray.hxx>
#include <scmatrix.hxx>
#include <stringutil.hxx>
#include <documentimport.hxx>
#include <externalrefmgr.hxx>
@@ -612,7 +613,7 @@ void ScXMLTableRowCellContext::PushParagraphEnd()
}
mpEditEngine->InsertParagraph(mpEditEngine->GetParagraphCount(), maParagraph.makeStringAndClear());
}
else if (mbHasFormatRuns)
else if (mbHasFormatRuns || ScStringUtil::isMultiline(maParagraph))
{
mpEditEngine->Clear();
mpEditEngine->SetTextCurrentDefaults(maParagraph.makeStringAndClear());