[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Wed Mar 13 10:53:42 PDT 2013


 sc/inc/document.hxx               |    6 +++---
 sc/inc/progress.hxx               |    2 +-
 sc/source/core/data/documen2.cxx  |    2 +-
 sc/source/core/data/documen3.cxx  |    6 +++---
 sc/source/core/data/documen7.cxx  |    6 +++---
 sc/source/core/data/documen8.cxx  |    9 +++++----
 sc/source/core/tool/interpr2.cxx  |    6 +++---
 sc/source/core/tool/progress.cxx  |    8 ++++----
 sc/source/filter/xml/xmlexprt.cxx |    6 +++---
 sc/source/ui/docshell/docsh.cxx   |   16 ++++++++--------
 sc/source/ui/inc/docsh.hxx        |    2 +-
 sc/source/ui/inc/spelldialog.hxx  |    2 +-
 sc/source/ui/view/output.cxx      |    6 +++---
 sc/source/ui/view/output2.cxx     |    6 +++---
 sc/source/ui/view/spelldialog.cxx |   10 +++++-----
 sc/source/ui/view/viewfun4.cxx    |    6 +++---
 16 files changed, 50 insertions(+), 49 deletions(-)

New commits:
commit 0a28dee3f3d7fc1aaafa11f51a412b20c8b4672c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Mar 13 13:55:13 2013 -0400

    Reverse the logic of enable / disable idle flag...
    
    so that true -> enabled and false -> disabled.  This is much easier
    for human brain to process.
    
    Change-Id: I51059ee9090610ad8455a072b165860527cd9d50

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 67be28a..8c3fac2 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -356,7 +356,7 @@ private:
     bool                bCalcingAfterLoad;              // in CalcAfterLoad TRUE
     // don't construct/destruct listeners temporarily
     bool                bNoListening;
-    bool                bIdleDisabled;
+    bool                mbIdleEnabled;
     bool                bInLinkUpdate;                  // TableLink or AreaLink
     bool                bChartListenerCollectionNeedsUpdate;
     // are/were there RC_FORCED formula cells in the document (if set once to TRUE then set forever)
@@ -1538,8 +1538,8 @@ public:
     void            RepaintRange( const ScRange& rRange );
     void            RepaintRange( const ScRangeList& rRange );
 
-    bool        IsIdleDisabled() const      { return bIdleDisabled; }
-    void            DisableIdle(bool bDo)   { bIdleDisabled = bDo; }
+    bool IsIdleEnabled() const { return mbIdleEnabled; }
+    void EnableIdle(bool bDo) { mbIdleEnabled = bDo; }
 
     bool            IsDetectiveDirty() const     { return bDetectiveDirty; }
     void            SetDetectiveDirty(bool bSet) { bDetectiveDirty = bSet; }
diff --git a/sc/inc/progress.hxx b/sc/inc/progress.hxx
index 0607c05..52c1fe2 100644
--- a/sc/inc/progress.hxx
+++ b/sc/inc/progress.hxx
@@ -48,7 +48,7 @@ private:
     static  sal_uLong           nInterpretProgress;
     static  sal_Bool            bAllowInterpretProgress;
     static  ScDocument*     pInterpretDoc;
-    static  sal_Bool            bIdleWasDisabled;
+    static  bool            bIdleWasEnabled;
 
             SfxProgress*    pProgress;
 
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 10428e8..1d159db 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -181,7 +181,7 @@ ScDocument::ScDocument( ScDocumentMode  eMode,
         bXMLFromWrapper( false ),
         bCalcingAfterLoad( false ),
         bNoListening( false ),
-        bIdleDisabled( false ),
+        mbIdleEnabled(true),
         bInLinkUpdate( false ),
         bChartListenerCollectionNeedsUpdate( false ),
         bHasForcedFormulas( false ),
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 5fa9f7a..55e01eb 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1340,10 +1340,10 @@ void ScDocument::Sort(SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery
 {
     if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
     {
-        bool bOldDisableIdle = IsIdleDisabled();
-        DisableIdle( true );
+        bool bOldEnableIdle = IsIdleEnabled();
+        EnableIdle(false);
         maTabs[nTab]->Sort(rSortParam, bKeepQuery, pProgress);
-        DisableIdle( bOldDisableIdle );
+        EnableIdle(bOldEnableIdle);
     }
 }
 
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 5a8bed3..56eb5651 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -280,8 +280,8 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
     bCalculatingFormulaTree = true;
 
     SetForcedFormulaPending( false );
-    bool bOldIdleDisabled = IsIdleDisabled();
-    DisableIdle( true );
+    bool bOldIdleEnabled = IsIdleEnabled();
+    EnableIdle(false);
     bool bOldAutoCalc = GetAutoCalc();
     //! _nicht_ SetAutoCalc( true ) weil das evtl. CalcFormulaTree( true )
     //! aufruft, wenn vorher disabled war und bHasForcedFormulas gesetzt ist
@@ -373,7 +373,7 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
             ScProgress::DeleteInterpretProgress();
     }
     bAutoCalc = bOldAutoCalc;
-    DisableIdle( bOldIdleDisabled );
+    EnableIdle(bOldIdleEnabled);
     bCalculatingFormulaTree = false;
 }
 
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 896848c..4592d13 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -446,9 +446,10 @@ void ScDocument::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress
 bool ScDocument::IdleCalcTextWidth()            // true = demnaechst wieder versuchen
 {
     // #i75610# if a printer hasn't been set or created yet, don't create one for this
-    if ( bIdleDisabled || IsInLinkUpdate() || GetPrinter(false) == NULL )
+    if (!mbIdleEnabled || IsInLinkUpdate() || GetPrinter(false) == NULL)
         return false;
-    bIdleDisabled = true;
+
+    mbIdleEnabled = false;
 
     const sal_uLong         nStart   = Time::GetSystemTicks();
     OutputDevice*       pDev     = NULL;
@@ -623,7 +624,7 @@ bool ScDocument::IdleCalcTextWidth()            // true = demnaechst wieder vers
     aCurTextWidthCalcPos.SetCol( (SCCOL)nCol );
 
     pStylePool->SetSearchMask( eOldFam, nOldMask );
-    bIdleDisabled = false;
+    mbIdleEnabled = true;
 
     return bNeedMore;
 }
@@ -819,7 +820,7 @@ bool ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe
 
 bool ScDocument::ContinueOnlineSpelling()
 {
-    if ( bIdleDisabled || !pDocOptions->IsAutoSpell() || (pShell && pShell->IsReadOnly()) )
+    if (!mbIdleEnabled || !pDocOptions->IsAutoSpell() || (pShell && pShell->IsReadOnly()))
         return false;
 
     // #i48433# set bInsertingFromOtherDoc flag so there are no broadcasts when PutCell is called
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 85d599c..39e780f 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2277,8 +2277,8 @@ void ScInterpreter::ScDde()
             //  solange der Link nicht ausgewertet ist, Idle abklemmen
             //  (um zirkulaere Referenzen zu vermeiden)
 
-        bool bOldDis = pDok->IsIdleDisabled();
-        pDok->DisableIdle( true );
+        bool bOldEnabled = pDok->IsIdleEnabled();
+        pDok->EnableIdle(false);
 
             //  Link-Objekt holen / anlegen
 
@@ -2337,7 +2337,7 @@ void ScInterpreter::ScDde()
         else
             PushNA();
 
-        pDok->DisableIdle( bOldDis );
+        pDok->EnableIdle(bOldEnabled);
         pLinkMgr->CloseCachedComps();
     }
 }
diff --git a/sc/source/core/tool/progress.cxx b/sc/source/core/tool/progress.cxx
index 0c43616..8085727 100644
--- a/sc/source/core/tool/progress.cxx
+++ b/sc/source/core/tool/progress.cxx
@@ -44,7 +44,7 @@ ScProgress*     ScProgress::pOldInterpretProgress = NULL;
 sal_uLong           ScProgress::nInterpretProgress = 0;
 sal_Bool            ScProgress::bAllowInterpretProgress = sal_True;
 ScDocument*     ScProgress::pInterpretDoc;
-sal_Bool            ScProgress::bIdleWasDisabled = false;
+bool            ScProgress::bIdleWasEnabled = false;
 
 
 static sal_Bool lcl_IsHiddenDocument( SfxObjectShell* pObjSh )
@@ -145,8 +145,8 @@ void ScProgress::CreateInterpretProgress( ScDocument* pDoc, sal_Bool bWait )
         else if ( pDoc->GetAutoCalc() )
         {
             nInterpretProgress = 1;
-            bIdleWasDisabled = pDoc->IsIdleDisabled();
-            pDoc->DisableIdle( sal_True );
+            bIdleWasEnabled = pDoc->IsIdleEnabled();
+            pDoc->EnableIdle(false);
             // Interpreter may be called in many circumstances, also if another
             // progress bar is active, for example while adapting row heights.
             // Keep the dummy interpret progress.
@@ -180,7 +180,7 @@ void ScProgress::DeleteInterpretProgress()
                 delete pTmpProgress;
             }
             if ( pInterpretDoc )
-                pInterpretDoc->DisableIdle( bIdleWasDisabled );
+                pInterpretDoc->EnableIdle(bIdleWasEnabled);
         }
         --nInterpretProgress;
     }
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 7d7be79..175a6c6 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -4694,10 +4694,10 @@ sal_Bool SAL_CALL ScXMLExport::filter( const ::com::sun::star::uno::Sequence< ::
 {
     SolarMutexGuard aGuard;
     if (pDoc)
-        pDoc->DisableIdle(true);
+        pDoc->EnableIdle(false);
     bool bReturn(SvXMLExport::filter(aDescriptor));
     if (pDoc)
-        pDoc->DisableIdle(false);
+        pDoc->EnableIdle(true);
     return bReturn;
 }
 
@@ -4706,7 +4706,7 @@ void SAL_CALL ScXMLExport::cancel()
 {
     SolarMutexGuard aGuard;
     if (pDoc)
-        pDoc->DisableIdle(false);
+        pDoc->EnableIdle(true);
     SvXMLExport::cancel();
 }
 
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index a9707de..c56d010 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -250,7 +250,7 @@ sal_uInt16 ScDocShell::GetHiddenInformationState( sal_uInt16 nStates )
 
 void ScDocShell::BeforeXMLLoading()
 {
-    aDocument.DisableIdle( sal_True );
+    aDocument.EnableIdle(false);
 
     // prevent unnecessary broadcasts and updates
     OSL_ENSURE(pModificator == NULL, "The Modificator should not exist");
@@ -367,7 +367,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
         OSL_FAIL("The Modificator should exist");
     }
 
-    aDocument.DisableIdle( false );
+    aDocument.EnableIdle(true);
 }
 
 namespace {
@@ -479,7 +479,7 @@ sal_Bool ScDocShell::SaveXML( SfxMedium* pSaveMedium, const ::com::sun::star::un
 {
     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "sb99857", "ScDocShell::SaveXML" );
 
-    aDocument.DisableIdle( sal_True );
+    aDocument.EnableIdle(false);
 
     ScXMLImportWrapper aImport( aDocument, pSaveMedium, xStor );
     sal_Bool bRet(false);
@@ -488,7 +488,7 @@ sal_Bool ScDocShell::SaveXML( SfxMedium* pSaveMedium, const ::com::sun::star::un
     else
         bRet = aImport.Export(sal_True);
 
-    aDocument.DisableIdle( false );
+    aDocument.EnableIdle(true);
 
     return bRet;
 }
@@ -2443,7 +2443,7 @@ sal_uInt16 ScDocShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
 
     sal_uInt16 nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing );
     if (nRet == sal_True)                       // sal_True = schliessen
-        aDocument.DisableIdle(sal_True);        // nicht mehr drin rumpfuschen !!!
+        aDocument.EnableIdle(false);        // nicht mehr drin rumpfuschen !!!
 
     return nRet;
 }
@@ -2976,9 +2976,9 @@ ScDocShellModificator::ScDocShellModificator( ScDocShell& rDS )
 {
     ScDocument* pDoc = rDocShell.GetDocument();
     bAutoCalcShellDisabled = pDoc->IsAutoCalcShellDisabled();
-    bIdleDisabled = pDoc->IsIdleDisabled();
+    bIdleEnabled = pDoc->IsIdleEnabled();
     pDoc->SetAutoCalcShellDisabled( sal_True );
-    pDoc->DisableIdle( sal_True );
+    pDoc->EnableIdle(false);
 }
 
 
@@ -2988,7 +2988,7 @@ ScDocShellModificator::~ScDocShellModificator()
     pDoc->SetAutoCalcShellDisabled( bAutoCalcShellDisabled );
     if ( !bAutoCalcShellDisabled && rDocShell.IsDocumentModifiedPending() )
         rDocShell.SetDocumentModified();    // last one shuts off the lights
-    pDoc->DisableIdle( bIdleDisabled );
+    pDoc->EnableIdle(bIdleEnabled);
 }
 
 
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index ade8dfb..010ea82 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -454,7 +454,7 @@ class SC_DLLPUBLIC ScDocShellModificator
             ScDocShell&     rDocShell;
     ScRefreshTimerProtector aProtector;
             sal_Bool            bAutoCalcShellDisabled;
-            sal_Bool            bIdleDisabled;
+            bool            bIdleEnabled;
 
                             // not implemented
                             ScDocShellModificator( const ScDocShellModificator& );
diff --git a/sc/source/ui/inc/spelldialog.hxx b/sc/source/ui/inc/spelldialog.hxx
index b0bf42f..4eaf656 100644
--- a/sc/source/ui/inc/spelldialog.hxx
+++ b/sc/source/ui/inc/spelldialog.hxx
@@ -89,7 +89,7 @@ private:
     ScDocShell*         mpDocShell;
     ScDocument*         mpDoc;
     bool                mbNeedNextObj;
-    bool                mbOldIdleDisabled;
+    bool                mbOldIdleEnabled;
 };
 
 // ============================================================================
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index c8018cf..18325cd 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1949,8 +1949,8 @@ void ScOutputData::FindChanged()
     SCCOL   nX;
     SCSIZE  nArrY;
 
-    bool bWasIdleDisabled = mpDoc->IsIdleDisabled();
-    mpDoc->DisableIdle(true);
+    bool bWasIdleEnabled = mpDoc->IsIdleEnabled();
+    mpDoc->EnableIdle(false);
     for (nArrY=0; nArrY<nArrCount; nArrY++)
         pRowInfo[nArrY].bChanged = false;
 
@@ -1997,7 +1997,7 @@ void ScOutputData::FindChanged()
     }
     if ( bProgress )
         ScProgress::DeleteInterpretProgress();
-    mpDoc->DisableIdle( bWasIdleDisabled );
+    mpDoc->EnableIdle(bWasIdleEnabled);
 }
 
 void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 0158f17..6caa4e2 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1413,8 +1413,8 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic )
 
     vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, mpDev->GetExtOutDevData() );
 
-    sal_Bool bWasIdleDisabled = mpDoc->IsIdleDisabled();
-    mpDoc->DisableIdle( true );
+    bool bWasIdleEnabled = mpDoc->IsIdleEnabled();
+    mpDoc->EnableIdle(false);
 
     ScDrawStringsVars aVars( this, bPixelToLogic );
 
@@ -2015,7 +2015,7 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic )
     }
     if ( bProgress )
         ScProgress::DeleteInterpretProgress();
-    mpDoc->DisableIdle( bWasIdleDisabled );
+    mpDoc->EnableIdle(bWasIdleEnabled);
 }
 
 //  -------------------------------------------------------------------------------
diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx
index 8b24d51..1839f26 100644
--- a/sc/source/ui/view/spelldialog.cxx
+++ b/sc/source/ui/view/spelldialog.cxx
@@ -47,7 +47,7 @@ ScSpellDialogChildWindow::ScSpellDialogChildWindow( Window* pParentP, sal_uInt16
     mpDocShell( 0 ),
     mpDoc( 0 ),
     mbNeedNextObj( false ),
-    mbOldIdleDisabled( false )
+    mbOldIdleEnabled(true)
 {
     Init();
 }
@@ -141,7 +141,7 @@ void ScSpellDialogChildWindow::Reset()
         mpViewShell->KillEditView( sal_True );
         mpDocShell->PostPaintGridAll();
         mpViewShell->UpdateInputHandler();
-        mpDoc->DisableIdle( mbOldIdleDisabled );
+        mpDoc->EnableIdle(mbOldIdleEnabled);
     }
     mxEngine.reset();
     mxUndoDoc.reset();
@@ -153,7 +153,7 @@ void ScSpellDialogChildWindow::Reset()
     mpDocShell = 0;
     mpDoc = 0;
     mbNeedNextObj = false;
-    mbOldIdleDisabled = false;
+    mbOldIdleEnabled = true;
 }
 
 void ScSpellDialogChildWindow::Init()
@@ -214,8 +214,8 @@ void ScSpellDialogChildWindow::Init()
             OSL_FAIL( "ScSpellDialogChildWindow::Init - unknown selection type" );
     }
 
-    mbOldIdleDisabled = mpDoc->IsIdleDisabled();
-    mpDoc->DisableIdle( true );   // stop online spelling
+    mbOldIdleEnabled = mpDoc->IsIdleEnabled();
+    mpDoc->EnableIdle(false);   // stop online spelling
 
     // *** create Undo/Redo documents *** -------------------------------------
 
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 0b3158c..cd48942 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -511,8 +511,8 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam, sal_Boo
 
     //  ab hier kein return mehr
 
-    sal_Bool bOldDis = pDoc->IsIdleDisabled();
-    pDoc->DisableIdle( true );   // stop online spelling
+    bool bOldEnabled = pDoc->IsIdleEnabled();
+    pDoc->EnableIdle(false);   // stop online spelling
 
     // *** create and init the edit engine *** --------------------------------
 
@@ -579,7 +579,7 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam, sal_Boo
     delete pEngine;
     pDocSh->PostPaintGridAll();
     rViewData.GetViewShell()->UpdateInputHandler();
-    pDoc->DisableIdle(bOldDis);
+    pDoc->EnableIdle(bOldEnabled);
 }
 
 // Pasten von FORMAT_FILE-Items


More information about the Libreoffice-commits mailing list