dev/null |binary sc/qa/unit/subsequent_export_test.cxx | 27 --------------------------- sc/qa/unit/subsequent_export_test3.cxx | 6 +++++- sc/qa/unit/subsequent_export_test4.cxx | 10 ++++++++++ sc/source/filter/excel/xestyle.cxx | 2 +- sc/source/filter/excel/xetable.cxx | 2 +- 6 files changed, 17 insertions(+), 30 deletions(-)
New commits: commit dafb629f4f5739e326fdf6b3f072fe139ed27c3b Author: Justin Luth <jl...@mail.com> AuthorDate: Wed Oct 2 19:17:46 2024 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Thu Oct 3 03:05:05 2024 +0200 tdf#161453 tdf#158252 tdf#159690 Revert "sc: Fix wrapText ... ...not being applied correctly on export" This reverts 24.2 commit 1760ee4d328cfb6ba22a5b3c84016625b12adb25 which was presumably made for tdf#158460. There are two bug reports in QA statistics - Regressions with most dups that relate to the chain of commits started by this patch. So just revert everything and let any initial fixes start again fresh. make CppunitTest_sc_subsequent_export_test3 \ CPPUNIT_TEST_NAME=testCustomXml make CppunitTest_sc_subsequent_export_test4 \ CPPUNIT_TEST_NAME=testTdf152980 Change-Id: I3df533daa67dfec0080c99dcdc2f593b1b6da8f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174401 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sc/qa/unit/data/xlsx/wrap-text.xlsx b/sc/qa/unit/data/xlsx/wrap-text.xlsx deleted file mode 100644 index 961cfcbdc02e..000000000000 Binary files a/sc/qa/unit/data/xlsx/wrap-text.xlsx and /dev/null differ diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index 7adb5e90bf34..9472fcca9993 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -1800,33 +1800,6 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testRichTextCellFormatXLSX) assertXPath(pStyles, aXPath3, "val"_ostr, u"true"_ustr); } -CPPUNIT_TEST_FIXTURE(ScExportTest, testWrapText) -{ - createScDoc("xlsx/wrap-text.xlsx"); - - save(u"Calc Office Open XML"_ustr); - - xmlDocUniquePtr pStyles = parseExport(u"xl/styles.xml"_ustr); - CPPUNIT_ASSERT(pStyles); - - assertXPath(pStyles, "/x:styleSheet/x:cellXfs"_ostr, "count"_ostr, u"7"_ustr); - - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment"_ostr, "wrapText"_ostr, - u"false"_ustr); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment"_ostr, "wrapText"_ostr, - u"false"_ustr); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment"_ostr, "wrapText"_ostr, - u"false"_ustr); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[4]/x:alignment"_ostr, "wrapText"_ostr, - u"false"_ustr); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[5]/x:alignment"_ostr, "wrapText"_ostr, - u"true"_ustr); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[6]/x:alignment"_ostr, "wrapText"_ostr, - u"true"_ustr); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[7]/x:alignment"_ostr, "wrapText"_ostr, - u"true"_ustr); -} - CPPUNIT_TEST_FIXTURE(ScExportTest, testFormulaRefSheetNameODS) { createScDoc("ods/formula-quote-in-sheet-name.ods"); diff --git a/sc/qa/unit/subsequent_export_test3.cxx b/sc/qa/unit/subsequent_export_test3.cxx index e537595b6cee..37957d10aafa 100644 --- a/sc/qa/unit/subsequent_export_test3.cxx +++ b/sc/qa/unit/subsequent_export_test3.cxx @@ -929,7 +929,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testCustomXml) // Load document and export it to a temporary file createScDoc("xlsx/customxml.xlsx"); - save(u"Calc Office Open XML"_ustr); + saveAndReload(u"Calc Office Open XML"_ustr); xmlDocUniquePtr pXmlDoc = parseExport(u"customXml/item1.xml"_ustr); CPPUNIT_ASSERT(pXmlDoc); xmlDocUniquePtr pRelsDoc = parseExport(u"customXml/_rels/item1.xml.rels"_ustr); @@ -943,6 +943,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testCustomXml) std::unique_ptr<SvStream> pStream = parseExportStream(maTempFile.GetURL(), u"ddp/ddpfile.xen"_ustr); CPPUNIT_ASSERT(pStream); + + // tdf#161453: ensure E1's wrap text attribute was round-tripped + ScDocument* pDoc = getScDoc(); + CPPUNIT_ASSERT(pDoc->GetAttr(4, 0, 0, ATTR_LINEBREAK)->GetValue()); } #ifdef _WIN32 diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index fbf31673ada3..e194568803c0 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -31,6 +31,7 @@ #include <comphelper/scopeguard.hxx> #include <formula/grammar.hxx> #include <tools/fldunit.hxx> +#include <tools/UnitConversion.hxx> #include <svl/numformat.hxx> #include <svl/zformat.hxx> #include <svx/svdocapt.hxx> @@ -1831,6 +1832,15 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf152980) CPPUNIT_ASSERT_EQUAL(u"a b"_ustr, pDoc->GetString(0, 5, 0)); CPPUNIT_ASSERT_EQUAL(u"a b"_ustr, pDoc->GetString(0, 6, 0)); CPPUNIT_ASSERT_EQUAL(u"a b"_ustr, pDoc->GetString(0, 7, 0)); + + // LO doesn't require "wrap text" to display multiline content. Excel does. + // tdf#161453: ensure A8 was set to wrap text, so Excel doesn't display as single line + SCTAB nTab = 0; + SCROW nRow = 7; + CPPUNIT_ASSERT(pDoc->GetAttr(0, nRow, nTab, ATTR_LINEBREAK)->GetValue()); + // Without the fix, this was a single line high (446). It should be 3 lines high (1236). + int nHeight = convertTwipToMm100(pDoc->GetRowHeight(nRow, nTab, false)); + CPPUNIT_ASSERT_GREATER(1000, nHeight); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf100034) diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index bea89f7d23ad..48cf7d8b2cc2 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -1510,7 +1510,7 @@ bool XclExpCellAlign::FillFromItemSet(const XclRoot& rRoot, const SfxItemSet& rI case EXC_BIFF3: // attributes new in BIFF3 { // text wrap - mbLineBreak = bForceLineBreak; + mbLineBreak = bForceLineBreak || rItemSet.Get( ATTR_LINEBREAK ).GetValue(); bUsed |= bForceLineBreak || ScfTools::CheckItem( rItemSet, ATTR_LINEBREAK, bStyle ); [[fallthrough]]; diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 90ea25795f43..a5cddfc86ff1 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -745,7 +745,7 @@ void XclExpLabelCell::Init( const XclExpRoot& rRoot, if( GetXFId() == EXC_XFID_NOTFOUND ) { OSL_ENSURE( nXclFont != EXC_FONT_NOTFOUND, "XclExpLabelCell::Init - leading font not found" ); - bool bForceLineBreak = pPattern->GetItem(ATTR_LINEBREAK ).GetValue(); + bool bForceLineBreak = mxText->IsWrapped(); SetXFId( rRoot.GetXFBuffer().InsertWithFont( pPattern, ApiScriptType::WEAK, nXclFont, bForceLineBreak ) ); }