dev/null |binary sc/qa/unit/subsequent_export_test.cxx | 27 --------------------------- sc/qa/unit/subsequent_export_test3.cxx | 8 +++++++- 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, 19 insertions(+), 30 deletions(-)
New commits: commit a6bc95646b0b872375d710afbea953189d2a117a Author: Justin Luth <jl...@mail.com> AuthorDate: Wed Oct 2 19:17:46 2024 -0400 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Oct 3 16:07:08 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> (cherry picked from commit dafb629f4f5739e326fdf6b3f072fe139ed27c3b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174337 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174422 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 30600191d54a..4cfb72366020 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -1810,33 +1810,6 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testRichTextCellFormatXLSX) assertXPath(pStyles, aXPath3, "val"_ostr, "true"); } -CPPUNIT_TEST_FIXTURE(ScExportTest, testWrapText) -{ - createScDoc("xlsx/wrap-text.xlsx"); - - save("Calc Office Open XML"); - - xmlDocUniquePtr pStyles = parseExport("xl/styles.xml"); - CPPUNIT_ASSERT(pStyles); - - assertXPath(pStyles, "/x:styleSheet/x:cellXfs"_ostr, "count"_ostr, "7"); - - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment"_ostr, "wrapText"_ostr, - "false"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment"_ostr, "wrapText"_ostr, - "false"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment"_ostr, "wrapText"_ostr, - "false"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[4]/x:alignment"_ostr, "wrapText"_ostr, - "false"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[5]/x:alignment"_ostr, "wrapText"_ostr, - "true"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[6]/x:alignment"_ostr, "wrapText"_ostr, - "true"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[7]/x:alignment"_ostr, "wrapText"_ostr, - "true"); -} - 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 1c4f5760bf06..71d7dd012f1a 100644 --- a/sc/qa/unit/subsequent_export_test3.cxx +++ b/sc/qa/unit/subsequent_export_test3.cxx @@ -14,9 +14,11 @@ #include "helper/qahelper.hxx" #include "helper/shared_test_impl.hxx" +#include <attrib.hxx> #include <userdat.hxx> #include <tokenstringcontext.hxx> #include <chgtrack.hxx> +#include <scitems.hxx> #include <scmod.hxx> #include <svx/svdpage.hxx> @@ -933,7 +935,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testCustomXml) // Load document and export it to a temporary file createScDoc("xlsx/customxml.xlsx"); - save("Calc Office Open XML"); + saveAndReload(u"Calc Office Open XML"_ustr); xmlDocUniquePtr pXmlDoc = parseExport("customXml/item1.xml"); CPPUNIT_ASSERT(pXmlDoc); xmlDocUniquePtr pRelsDoc = parseExport("customXml/_rels/item1.xml.rels"); @@ -946,6 +948,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testCustomXml) std::unique_ptr<SvStream> pStream = parseExportStream(maTempFile.GetURL(), "ddp/ddpfile.xen"); 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 95c7057aef2d..9129844a0348 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -32,6 +32,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> @@ -1799,6 +1800,15 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf152980) CPPUNIT_ASSERT_EQUAL(OUString("a b"), pDoc->GetString(0, 5, 0)); CPPUNIT_ASSERT_EQUAL(OUString("a b"), pDoc->GetString(0, 6, 0)); CPPUNIT_ASSERT_EQUAL(OUString("a b"), 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 678327bd1a58..900f2eb60636 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -1507,7 +1507,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 f7b9a81be9f0..022da6cd754f 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->GetItemSet().Get(ATTR_LINEBREAK ).GetValue(); + bool bForceLineBreak = mxText->IsWrapped(); SetXFId( rRoot.GetXFBuffer().InsertWithFont( pPattern, ApiScriptType::WEAK, nXclFont, bForceLineBreak ) ); }