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 +-
 sc/source/ui/app/inputhdl.cxx          |   12 ------------
 7 files changed, 19 insertions(+), 42 deletions(-)

New commits:
commit 1764d6917510709b3d182cc19c3295ee31d277ff
Author:     Justin Luth <[email protected]>
AuthorDate: Wed Oct 2 12:15:31 2024 -0400
Commit:     Andras Timar <[email protected]>
CommitDate: Thu Nov 7 10:05:46 2024 +0100

    tdf#159690 tdf#159938 Revert "tdf#158252 sc: Enable text wrapping...
    
    ... when inputting line breaks in cell"
    
    This reverts 24.2 commit 17e362e56f9e15d0214c441e632c91d22e58519d
    because it was made as a regression fix
    for a commit that I just reverted,
    AS WELL AS having several (duplicate) regression bugs of its own.
    
    Duplicate Bug 163150 is a good example of why a linefeed shouldn't
    automatically imply wrap text - it specified "fit to cell size".
    
    Duplicate Bug 159834 complains about this happening on drag/drop.
    
    Change-Id: Iad5fb87f9ab71230221c402a84ca682dba0ed004
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174402
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <[email protected]>
    (cherry picked from commit 55a8fce5d76bba0657ed76c85439fac8d1d00c8d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174339
    Reviewed-by: Xisco Fauli <[email protected]>
    (cherry picked from commit c1d2902b64dc02026f7842a43e540283b67df13d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174445
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176142
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Andras Timar <[email protected]>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 9df0cef85609..06f046346e10 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -47,7 +47,6 @@
 #include <sfx2/printer.hxx>
 #include <svl/numformat.hxx>
 #include <svl/zforlist.hxx>
-#include <svx/svxids.hrc>
 #include <unotools/localedatawrapper.hxx>
 #include <unotools/charclass.hxx>
 #include <utility>
@@ -3170,17 +3169,6 @@ void ScInputHandler::EnterHandler( ScEnterMode 
nBlockMode, bool bBeforeSavingInL
     lcl_RemoveTabs(aString);
     lcl_RemoveTabs(aPreAutoCorrectString);
 
-    if (bModified && aString.indexOf('
') != -1)
-    {
-        // Cell contains line breaks, enable wrapping
-        ScLineBreakCell aBreakItem(true);
-        pActiveViewSh->ApplyAttr(aBreakItem);
-
-        SfxViewFrame* pViewFrm = SfxViewFrame::Current();
-        if (pViewFrm)
-            pViewFrm->GetBindings().Invalidate(SID_ATTR_ALIGN_LINEBREAK);
-    }
-
     // Test if valid (always with simple string)
     if (bModified && nValidation)
     {
commit 7df2088a55f629b1880ca7f1f8e435a043e2b863
Author:     Justin Luth <[email protected]>
AuthorDate: Wed Oct 2 19:17:46 2024 -0400
Commit:     Andras Timar <[email protected]>
CommitDate: Thu Nov 7 10:05:37 2024 +0100

    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 <[email protected]>
    (cherry picked from commit dafb629f4f5739e326fdf6b3f072fe139ed27c3b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174337
    Reviewed-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174422
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176141
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

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 0b4908fbe44c..16470753c8d2 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -1812,33 +1812,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 1130e1456fdd..9e6f997d214b 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 94ab1c1049cd..bfd3e1230f25 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 ) );
     }
 

Reply via email to