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 c723758d0540bdb4846eefb4b50b4bde212f1985
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Tue Feb 6 21:08:36 2024 -0500
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Feb 8 08:31:15 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>
    (cherry picked from commit 9778d499df3d081314295ae099463870146b7a9c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163027

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 dd63f0b8a973..2b8ff43962bb 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 b1fca78c86be..1fe1f5344d0a 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