[Libreoffice-commits] core.git: sc/inc sc/source

Tor Lillqvist tml at collabora.com
Tue Aug 15 09:04:45 UTC 2017


 sc/inc/document.hxx                 |    8 ++++----
 sc/source/core/data/bcaslot.cxx     |    8 ++++----
 sc/source/core/data/documen2.cxx    |    2 +-
 sc/source/core/data/documen7.cxx    |    8 ++++----
 sc/source/core/data/document.cxx    |    2 +-
 sc/source/core/data/formulacell.cxx |    8 ++++----
 sc/source/core/inc/bcaslot.hxx      |    2 +-
 sc/source/ui/docshell/docsh.cxx     |    4 ++--
 sc/source/ui/docshell/docsh4.cxx    |    2 +-
 9 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit a69850bc0bb8ff90d5676259c42c5e98a7f11150
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Aug 15 11:51:33 2017 +0300

    Change HardRecalcState to enum class
    
    Change-Id: I8b20ce6b58915c37e6d4caa11d2f4c724864a257

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 0e6cf79b1b6a..f0f417baf9bd 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -299,11 +299,11 @@ friend class sc::TableColumnBlockPositionSet;
     typedef std::vector<ScTable*> TableContainer;
 
 public:
-    enum HardRecalcState
+    enum class HardRecalcState
     {
-        HARDRECALCSTATE_OFF = 0,    /// normal calculation of dependencies
-        HARDRECALCSTATE_TEMPORARY,  /// CalcAll() without broadcast/notify but setting up new listeners
-        HARDRECALCSTATE_ETERNAL     /// no new listeners are setup, no broadcast/notify
+        OFF,        /// normal calculation of dependencies
+        TEMPORARY,  /// CalcAll() without broadcast/notify but setting up new listeners
+        ETERNAL     /// no new listeners are setup, no broadcast/notify
     };
 
 private:
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index 294e5a3eb5dd..0882619f66f3 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -145,7 +145,7 @@ ScBroadcastAreaSlot::~ScBroadcastAreaSlot()
 ScDocument::HardRecalcState ScBroadcastAreaSlot::CheckHardRecalcStateCondition() const
 {
     ScDocument::HardRecalcState eState = pDoc->GetHardRecalcState();
-    if (eState == ScDocument::HARDRECALCSTATE_OFF)
+    if (eState == ScDocument::HardRecalcState::OFF)
     {
         if (aBroadcastAreaTbl.size() >= aBroadcastAreaTbl.max_size())
         {   // this is more hypothetical now, check existed for old SV_PTRARR_SORT
@@ -156,7 +156,7 @@ ScDocument::HardRecalcState ScBroadcastAreaSlot::CheckHardRecalcStateCondition()
                 pShell->SetError(SCWARN_CORE_HARD_RECALC);
 
             pDoc->SetAutoCalc( false );
-            eState = ScDocument::HARDRECALCSTATE_ETERNAL;
+            eState = ScDocument::HardRecalcState::ETERNAL;
             pDoc->SetHardRecalcState( eState );
         }
     }
@@ -168,7 +168,7 @@ bool ScBroadcastAreaSlot::StartListeningArea(
 {
     bool bNewArea = false;
     OSL_ENSURE(pListener, "StartListeningArea: pListener Null");
-    if (CheckHardRecalcStateCondition() == ScDocument::HARDRECALCSTATE_ETERNAL)
+    if (CheckHardRecalcStateCondition() == ScDocument::HardRecalcState::ETERNAL)
         return false;
     if ( !rpArea )
     {
@@ -209,7 +209,7 @@ bool ScBroadcastAreaSlot::StartListeningArea(
 void ScBroadcastAreaSlot::InsertListeningArea( ScBroadcastArea* pArea )
 {
     OSL_ENSURE( pArea, "InsertListeningArea: pArea NULL");
-    if (CheckHardRecalcStateCondition() == ScDocument::HARDRECALCSTATE_ETERNAL)
+    if (CheckHardRecalcStateCondition() == ScDocument::HardRecalcState::ETERNAL)
         return;
     if (aBroadcastAreaTbl.insert( pArea).second)
         pArea->IncRef();
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index ac44da5278d2..cf35dd866f5c 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -179,7 +179,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
         nInterpreterTableOpLevel(0),
         nSrcVer( SC_CURRENT_VERSION ),
         nFormulaTrackCount(0),
-        eHardRecalcState(HARDRECALCSTATE_OFF),
+        eHardRecalcState(HardRecalcState::OFF),
         nVisibleTab( 0 ),
         eLinkMode(LM_UNKNOWN),
         bAutoCalc( eMode == SCDOCMODE_DOCUMENT ),
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index dd4134965ad8..b613166eac1a 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -58,7 +58,7 @@ void ScDocument::Broadcast( const ScHint& rHint )
 {
     if ( !pBASM )
         return ;    // Clipboard or Undo
-    if ( eHardRecalcState == HARDRECALCSTATE_OFF )
+    if ( eHardRecalcState == HardRecalcState::OFF )
     {
         ScBulkBroadcast aBulkBroadcast( pBASM, rHint.GetId());     // scoped bulk broadcast
         bool bIsBroadcasted = false;
@@ -94,7 +94,7 @@ void ScDocument::BroadcastCells( const ScRange& rRange, SfxHintId nHint, bool bB
     SCCOL nCol1 = rRange.aStart.Col();
     SCCOL nCol2 = rRange.aEnd.Col();
 
-    if (eHardRecalcState == HARDRECALCSTATE_OFF)
+    if (eHardRecalcState == HardRecalcState::OFF)
     {
         ScBulkBroadcast aBulkBroadcast( pBASM, nHint);     // scoped bulk broadcast
         bool bIsBroadcasted = false;
@@ -222,7 +222,7 @@ void ScDocument::AreaBroadcast( const ScHint& rHint )
 {
     if ( !pBASM )
         return ;    // Clipboard or Undo
-    if (eHardRecalcState == HARDRECALCSTATE_OFF)
+    if (eHardRecalcState == HardRecalcState::OFF)
     {
         ScBulkBroadcast aBulkBroadcast( pBASM, rHint.GetId());     // scoped bulk broadcast
         if ( pBASM->AreaBroadcast( rHint ) )
@@ -370,7 +370,7 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
     //ATTENTION: _not_ SetAutoCalc( true ) because this might call CalcFormulaTree( true )
     //ATTENTION: if it was disabled before and bHasForcedFormulas is set
     bAutoCalc = true;
-    if (eHardRecalcState == HARDRECALCSTATE_ETERNAL)
+    if (eHardRecalcState == HardRecalcState::ETERNAL)
         CalcAll();
     else
     {
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 3dd1bd5ffc8e..fcd05c554135 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3915,7 +3915,7 @@ void ScDocument::CalcAll()
     // In eternal hard recalc state caches were not added as listeners,
     // invalidate them so the next non-CalcAll() normal lookup will not be
     // presented with outdated data.
-    if (GetHardRecalcState() == HARDRECALCSTATE_ETERNAL)
+    if (GetHardRecalcState() == HardRecalcState::ETERNAL)
         ClearLookupCaches();
 }
 
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 293e00d9f0e2..32841a41d93a 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2254,7 +2254,7 @@ void ScFormulaCell::Notify( const SfxHint& rHint )
         return;
     }
 
-    if ( pDocument->GetHardRecalcState() == ScDocument::HARDRECALCSTATE_OFF )
+    if ( pDocument->GetHardRecalcState() == ScDocument::HardRecalcState::OFF )
     {
         if (nHint == SfxHintId::ScDataChanged || nHint == SfxHintId::ScTableOpDirty || (bSubTotal && nHint == SfxHintId::ScHiddenRowsChanged))
         {
@@ -2311,7 +2311,7 @@ void ScFormulaCell::SetDirty( bool bDirtyFlag )
     if (IsInChangeTrack())
         return;
 
-    if ( pDocument->GetHardRecalcState() != ScDocument::HARDRECALCSTATE_OFF )
+    if ( pDocument->GetHardRecalcState() != ScDocument::HardRecalcState::OFF )
     {
         SetDirtyVar();
         pDocument->SetStreamValid(aPos.Tab(), false);
@@ -2354,7 +2354,7 @@ void ScFormulaCell::SetDirtyVar()
 void ScFormulaCell::SetDirtyAfterLoad()
 {
     bDirty = true;
-    if ( pDocument->GetHardRecalcState() == ScDocument::HARDRECALCSTATE_OFF )
+    if ( pDocument->GetHardRecalcState() == ScDocument::HardRecalcState::OFF )
         pDocument->PutInFormulaTree( this );
 }
 
@@ -2367,7 +2367,7 @@ void ScFormulaCell::SetTableOpDirty()
 {
     if ( !IsInChangeTrack() )
     {
-        if ( pDocument->GetHardRecalcState() != ScDocument::HARDRECALCSTATE_OFF )
+        if ( pDocument->GetHardRecalcState() != ScDocument::HardRecalcState::OFF )
             bTableOpDirty = true;
         else
         {
diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx
index af2fdaf540b0..5e543c8eaae7 100644
--- a/sc/source/core/inc/bcaslot.hxx
+++ b/sc/source/core/inc/bcaslot.hxx
@@ -164,7 +164,7 @@ private:
         whether there would be an overflow when adding an area, setting the
         proper state if so.
 
-        @return HARDRECALCSTATE_ETERNAL if a HardRecalcState is effective and
+        @return HardRecalcState::ETERNAL if a HardRecalcState is effective and
                 area is not to be added.
       */
     ScDocument::HardRecalcState CheckHardRecalcStateCondition() const;
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 8d6352c7b112..f51db7d69225 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -363,8 +363,8 @@ void ScDocShell::AfterXMLLoading(bool bRet)
         // Temporarily set hard-recalc to prevent calling
         // ScFormulaCell::Notify() during destruction of the Modificator which
         // will set the cells dirty.
-        if (eRecalcState == ScDocument::HARDRECALCSTATE_OFF)
-            aDocument.SetHardRecalcState(ScDocument::HARDRECALCSTATE_TEMPORARY);
+        if (eRecalcState == ScDocument::HardRecalcState::OFF)
+            aDocument.SetHardRecalcState(ScDocument::HardRecalcState::TEMPORARY);
         delete pModificator;
         pModificator = nullptr;
         aDocument.SetHardRecalcState(eRecalcState);
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 030b7b476104..009f8b987436 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1806,7 +1806,7 @@ void ScDocShell::GetState( SfxItemSet &rSet )
         switch (nWhich)
         {
             case FID_AUTO_CALC:
-                if ( aDocument.GetHardRecalcState() != ScDocument::HARDRECALCSTATE_OFF )
+                if ( aDocument.GetHardRecalcState() != ScDocument::HardRecalcState::OFF )
                     rSet.DisableItem( nWhich );
                 else
                     rSet.Put( SfxBoolItem( nWhich, aDocument.GetAutoCalc() ) );


More information about the Libreoffice-commits mailing list