summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/dociter.hxx4
-rw-r--r--sc/qa/unit/subsequent_filters_test2.cxx7
-rw-r--r--sc/source/core/data/dociter.cxx11
-rw-r--r--sc/source/filter/oox/workbookhelper.cxx1
-rw-r--r--sc/source/ui/docshell/docsh5.cxx10
-rw-r--r--sc/source/ui/inc/docsh.hxx1
6 files changed, 21 insertions, 13 deletions
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index b73d175a000f..6be5a77e5e5b 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -457,10 +457,10 @@ public:
ScDocument& rDoc, OutputDevice* pOutDev, double fPPTX, double fPPTY,
const ::std::vector<TabRanges>* pTabRangesArray);
- void update();
+ void update(const bool bOnlyUsedRows = false);
private:
- void updateAll();
+ void updateAll(const bool bOnlyUsedRows);
private:
ScDocument& mrDoc;
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx
index d5ce977b3a4e..790ab5c99057 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -148,13 +148,6 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testOptimalHeightReset)
CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testTdf123026_optimalRowHeight)
{
createScDoc("xlsx/tdf123026_optimalRowHeight.xlsx");
-
- dispatchCommand(mxComponent, ".uno:SelectColumn", {});
- dispatchCommand(
- mxComponent, ".uno:SetOptimalRowHeight",
- comphelper::InitPropertySequence({ { "aExtraHeight", uno::Any(sal_uInt16(0)) } }));
- Scheduler::ProcessEventsToIdle();
-
SCTAB nTab = 0;
SCROW nRow = 4;
int nHeight = convertTwipToMm100(getScDoc()->GetRowHeight(nRow, nTab, false));
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index fd4fa7afe42f..267d814daf76 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1615,12 +1615,12 @@ ScDocRowHeightUpdater::ScDocRowHeightUpdater(ScDocument& rDoc, OutputDevice* pOu
{
}
-void ScDocRowHeightUpdater::update()
+void ScDocRowHeightUpdater::update(const bool bOnlyUsedRows)
{
if (!mpTabRangesArray || mpTabRangesArray->empty())
{
// No ranges defined. Update all rows in all tables.
- updateAll();
+ updateAll(bOnlyUsedRows);
return;
}
@@ -1668,7 +1668,7 @@ void ScDocRowHeightUpdater::update()
}
}
-void ScDocRowHeightUpdater::updateAll()
+void ScDocRowHeightUpdater::updateAll(const bool bOnlyUsedRows)
{
sal_uInt64 nCellCount = 0;
for (SCTAB nTab = 0; nTab < mrDoc.GetTableCount(); ++nTab)
@@ -1689,7 +1689,10 @@ void ScDocRowHeightUpdater::updateAll()
if (!ValidTab(nTab) || !mrDoc.maTabs[nTab])
continue;
- mrDoc.maTabs[nTab]->SetOptimalHeight(aCxt, 0, mrDoc.MaxRow(), true, &aProgress, nProgressStart);
+ SCCOL nEndCol = 0;
+ SCROW nEndRow = mrDoc.MaxRow();
+ if (!bOnlyUsedRows || mrDoc.GetPrintArea(nTab, nEndCol, nEndRow))
+ mrDoc.maTabs[nTab]->SetOptimalHeight(aCxt, 0, nEndRow, true, &aProgress, nProgressStart);
nProgressStart += mrDoc.maTabs[nTab]->GetWeightedCount();
}
}
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 3a542df0313e..817340afb341 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -628,6 +628,7 @@ void WorkbookGlobals::finalize()
mpDoc->EnableExecuteLink(true);
// #i79826# enable updating automatic row height after loading the document
mpDoc->UnlockAdjustHeight();
+ mpDocShell->UpdateAllRowHeights(/*bOnlyUsedRows=*/true);
// #i76026# enable Undo after loading the document
mpDoc->EnableUndo(true);
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index d1749fee1e1b..f7c35ba29598 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
+#include <dociter.hxx>
#include <docsh.hxx>
#include <global.hxx>
#include <globstr.hrc>
@@ -429,6 +430,15 @@ void ScDocShell::UpdateAllRowHeights( const ScMarkData* pTabMark )
m_pDocument->UpdateAllRowHeights(aCxt, pTabMark);
}
+void ScDocShell::UpdateAllRowHeights(const bool bOnlyUsedRows)
+{
+ // update automatic roow heights on all sheets using the newer ScDocRowHeightUpdater
+ ScSizeDeviceProvider aProv(this);
+ ScDocRowHeightUpdater aUpdater(*m_pDocument, aProv.GetDevice(), aProv.GetPPTX(),
+ aProv.GetPPTY(), nullptr);
+ aUpdater.update(bOnlyUsedRows);
+}
+
void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore )
{
bool bIsUndoEnabled = m_pDocument->IsUndoEnabled();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 096c219f89a6..58741d563737 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -267,6 +267,7 @@ public:
bool AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab );
void UpdateAllRowHeights( const ScMarkData* pTabMark = nullptr );
+ void UpdateAllRowHeights(const bool bOnlyUsedRows);
void UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore = false );
void RefreshPivotTables( const ScRange& rSource );