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 <jluth@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 0000000..8df7720
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf159581_optimalRowHeight.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx
index dd63f0b8..2b8ff43 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 b1fca78..1fe1f53 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))