sc/source/core/data/documen2.cxx | 1 + sc/source/core/data/document.cxx | 9 +++++++++ 2 files changed, 10 insertions(+)
New commits: commit 52f24a3a1e2ff7f0a599df7bb9caefc8543f7dc4 Author: Luboš Luňák <[email protected]> AuthorDate: Sat Mar 5 22:43:31 2022 +0100 Commit: Luboš Luňák <[email protected]> CommitDate: Sun Mar 6 08:20:19 2022 +0100 don't destroy and recreate broadcasters on large changes (tdf#131894) Change-Id: If5377687e7bcfab00af37887d3aaf302fa615690 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131070 Tested-by: Jenkins Reviewed-by: Luboš Luňák <[email protected]> diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 9c2bbc7c9970..60dd807cdfd0 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -726,6 +726,7 @@ bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress ) if (maTabs[nOldPos]) { sc::AutoCalcSwitch aACSwitch(*this, false); + sc::DelayDeletingBroadcasters delayDeletingBroadcasters(*this); SetNoListening( true ); if (nNewPos == SC_TAB_APPEND || nNewPos >= nTabCount) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index a7fabf46d1df..5973bf913366 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -682,6 +682,7 @@ bool ScDocument::DeleteTab( SCTAB nTab ) { sc::AutoCalcSwitch aACSwitch(*this, false); sc::RefUpdateDeleteTabContext aCxt( *this, nTab, 1); + sc::DelayDeletingBroadcasters delayDeletingBroadcasters(*this); ScRange aRange( 0, 0, nTab, MaxCol(), MaxRow(), nTab ); DelBroadcastAreasInRange( aRange ); @@ -770,6 +771,7 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets ) { sc::AutoCalcSwitch aACSwitch(*this, false); sc::RefUpdateDeleteTabContext aCxt( *this, nTab, nSheets); + sc::DelayDeletingBroadcasters delayDeletingBroadcasters(*this); for (SCTAB aTab = 0; aTab < nSheets; ++aTab) { @@ -1256,6 +1258,8 @@ bool ScDocument::InsertRow( SCCOL nStartCol, SCTAB nStartTab, bool bRet = false; bool bOldAutoCalc = GetAutoCalc(); SetAutoCalc( false ); // avoid multiple calculations + bool oldDelayedDeleteBroadcasters = IsDelayedDeletingBroadcasters(); + EnableDelayDeletingBroadcasters( true ); for ( i = nStartTab; i <= nEndTab && bTest && i < static_cast<SCTAB>(maTabs.size()); i++) if (maTabs[i] && (!pTabMark || pTabMark->GetTableSelect(i))) bTest &= maTabs[i]->TestInsertRow(nStartCol, nEndCol, nStartRow, nSize); @@ -1343,6 +1347,7 @@ bool ScDocument::InsertRow( SCCOL nStartCol, SCTAB nStartTab, } bRet = true; } + EnableDelayDeletingBroadcasters( oldDelayedDeleteBroadcasters ); SetAutoCalc( bOldAutoCalc ); if ( bRet && pChartListenerCollection ) pChartListenerCollection->UpdateDirtyCharts(); @@ -1507,6 +1512,8 @@ bool ScDocument::InsertCol( SCROW nStartRow, SCTAB nStartTab, bool bRet = false; bool bOldAutoCalc = GetAutoCalc(); SetAutoCalc( false ); // avoid multiple calculations + bool oldDelayedDeleteBroadcasters = IsDelayedDeletingBroadcasters(); + EnableDelayDeletingBroadcasters( true ); for ( i = nStartTab; i <= nEndTab && bTest && i < static_cast<SCTAB>(maTabs.size()); i++) if (maTabs[i] && (!pTabMark || pTabMark->GetTableSelect(i))) bTest &= maTabs[i]->TestInsertCol( nStartRow, nEndRow, nSize ); @@ -1565,6 +1572,7 @@ bool ScDocument::InsertCol( SCROW nStartRow, SCTAB nStartTab, } bRet = true; } + EnableDelayDeletingBroadcasters( oldDelayedDeleteBroadcasters ); SetAutoCalc( bOldAutoCalc ); if ( bRet && pChartListenerCollection ) pChartListenerCollection->UpdateDirtyCharts(); @@ -2103,6 +2111,7 @@ void ScDocument::CopyToDocument(const ScRange& rRange, sc::AutoCalcSwitch aACSwitch(rDestDoc, false); // avoid multiple calculations ScBulkBroadcast aBulkBroadcast(rDestDoc.GetBASM(), SfxHintId::ScDataChanged); + sc::DelayDeletingBroadcasters delayDeletingBroadcasters(*this); sc::CopyToDocContext aCxt(rDestDoc); aCxt.setStartListening(false);
