sc/source/core/data/table2.cxx |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

New commits:
commit 0ca559cb8cc3b1af6c59066713bbed8e3ee76514
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Sun Dec 5 19:00:30 2021 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Mon Dec 6 12:22:11 2021 +0100

    use sc::AutoCalcSwitch
    
    Change-Id: Idea2206ace5c40b2b7c38b949f9d20feb4513974
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126390
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 46dab0217c27..b3250ff08f31 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2031,41 +2031,33 @@ void ScTable::SetAllFormulasDirty( const 
sc::SetFormulaDirtyContext& rCxt )
 
 void ScTable::SetDirty( const ScRange& rRange, ScColumn::BroadcastMode eMode )
 {
-    bool bOldAutoCalc = rDocument.GetAutoCalc();
-    rDocument.SetAutoCalc( false );    // avoid multiple recalculations
+    sc::AutoCalcSwitch aSwitch(rDocument, false);
     SCCOL nCol2 = rRange.aEnd.Col();
     nCol2 = ClampToAllocatedColumns(nCol2);
     for (SCCOL i=rRange.aStart.Col(); i<=nCol2; i++)
         aCol[i].SetDirty(rRange.aStart.Row(), rRange.aEnd.Row(), eMode);
-    rDocument.SetAutoCalc( bOldAutoCalc );
 }
 
 void ScTable::SetTableOpDirty( const ScRange& rRange )
 {
-    bool bOldAutoCalc = rDocument.GetAutoCalc();
-    rDocument.SetAutoCalc( false );    // no multiple recalculation
+    sc::AutoCalcSwitch aSwitch(rDocument, false);
     const SCCOL nCol2 = ClampToAllocatedColumns(rRange.aEnd.Col());
     for (SCCOL i=rRange.aStart.Col(); i<=nCol2; i++)
         aCol[i].SetTableOpDirty( rRange );
-    rDocument.SetAutoCalc( bOldAutoCalc );
 }
 
 void ScTable::SetDirtyAfterLoad()
 {
-    bool bOldAutoCalc = rDocument.GetAutoCalc();
-    rDocument.SetAutoCalc( false );    // avoid multiple recalculations
+    sc::AutoCalcSwitch aSwitch(rDocument, false);
     for (SCCOL i=0; i < aCol.size(); i++)
         aCol[i].SetDirtyAfterLoad();
-    rDocument.SetAutoCalc( bOldAutoCalc );
 }
 
 void ScTable::SetDirtyIfPostponed()
 {
-    bool bOldAutoCalc = rDocument.GetAutoCalc();
-    rDocument.SetAutoCalc( false );    // avoid multiple recalculations
+    sc::AutoCalcSwitch aSwitch(rDocument, false);
     for (SCCOL i=0; i < aCol.size(); i++)
         aCol[i].SetDirtyIfPostponed();
-    rDocument.SetAutoCalc( bOldAutoCalc );
 }
 
 void ScTable::BroadcastRecalcOnRefMove()

Reply via email to