sc/qa/unit/data/xlsx/tdf159581_optimalRowHeight.xlsx |binary
 sc/qa/unit/subsequent_filters_test2.cxx              |   11 +++++++++++
 sc/source/core/data/dociter.cxx                      |    2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 648c7c0f17125fd77d29be3c0611e1ab92f36b7f
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Tue Feb 6 21:08:36 2024 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed Feb 7 17:40:16 2024 +0100

    tdf#159581 sc: fix multi-sheet ScDocRowHeightUpdater
    
    Apparently it was caching the first sheet's
    row height, and applying it to every other sheet.
    
    AFAICS, the only time this ever ran against multiple sheets
    was during import time, so that is why it wasn't easily noticed
    before 24.2 when XLSX started using it on import.
    
    make CppunitTest_sc_subsequent_filters_test2 \
        CPPUNIT_TEST_NAME=testTdf159581_optimalRowHeight
    
    Change-Id: Ic4e4dd335fa48d02acbc85cfad35feb8eca7597b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163066
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sc/qa/unit/data/xlsx/tdf159581_optimalRowHeight.xlsx 
b/sc/qa/unit/data/xlsx/tdf159581_optimalRowHeight.xlsx
new file mode 100644
index 000000000000..8df77208045f
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/tdf159581_optimalRowHeight.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index b0042d9878d6..7f6dae6df6ee 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -159,6 +159,17 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, 
testTdf123026_optimalRowHeight)
     CPPUNIT_ASSERT_GREATER(2000, nHeight);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testTdf159581_optimalRowHeight)
+{
+    createScDoc("xlsx/tdf159581_optimalRowHeight.xlsx");
+    SCTAB nTab = 1;
+    SCROW nRow = 0; // row 1
+    int nHeight = convertTwipToMm100(getScDoc()->GetRowHeight(nRow, nTab, 
false));
+
+    // Without the fix, this was 2027. It should be 450.
+    CPPUNIT_ASSERT_LESS(500, nHeight);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testCustomNumFormatHybridCellODS)
 {
     createScDoc("ods/custom-numfmt-hybrid-cell.ods");
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 4fcbcb792cd9..bb4e77d27f1d 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1683,13 +1683,13 @@ void ScDocRowHeightUpdater::updateAll(const bool 
bOnlyUsedRows)
     ScProgress aProgress(mrDoc.GetDocumentShell(), 
ScResId(STR_PROGRESS_HEIGHTING), nCellCount, true);
 
     Fraction aZoom(1, 1);
-    sc::RowHeightContext aCxt(mrDoc.MaxRow(), mfPPTX, mfPPTY, aZoom, aZoom, 
mpOutDev);
     sal_uInt64 nProgressStart = 0;
     for (SCTAB nTab = 0; nTab < mrDoc.GetTableCount(); ++nTab)
     {
         if (!ValidTab(nTab) || !mrDoc.maTabs[nTab])
             continue;
 
+        sc::RowHeightContext aCxt(mrDoc.MaxRow(), mfPPTX, mfPPTY, aZoom, 
aZoom, mpOutDev);
         SCCOL nEndCol = 0;
         SCROW nEndRow = mrDoc.MaxRow();
         if (!bOnlyUsedRows || mrDoc.GetPrintArea(nTab, nEndCol, nEndRow))

Reply via email to