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

Kohei Yoshida kohei.yoshida at gmail.com
Fri May 17 19:43:43 PDT 2013


 sc/source/core/data/column3.cxx |   73 ++++++++++++++++++++--------------------
 1 file changed, 38 insertions(+), 35 deletions(-)

New commits:
commit 3d636ac17f37da247a803ae20d84660d2ff3ad3d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri May 17 22:45:43 2013 -0400

    Prefer early bail-out.
    
    Change-Id: I112a4be56910c07007b28715336fcd82d56bb313

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index f573011..70d007d 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1103,38 +1103,40 @@ ScAttrIterator* ScColumn::CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) c
 
 void ScColumn::StartAllListeners()
 {
-    if ( !maItems.empty() )
-        for (SCSIZE i = 0; i < maItems.size(); i++)
+    if (maItems.empty())
+        return;
+
+    for (SCSIZE i = 0; i < maItems.size(); i++)
+    {
+        ScBaseCell* pCell = maItems[i].pCell;
+        if ( pCell->GetCellType() == CELLTYPE_FORMULA )
         {
-            ScBaseCell* pCell = maItems[i].pCell;
-            if ( pCell->GetCellType() == CELLTYPE_FORMULA )
-            {
-                SCROW nRow = maItems[i].nRow;
-                ((ScFormulaCell*)pCell)->StartListeningTo( pDocument );
-                if ( nRow != maItems[i].nRow )
-                    Search( nRow, i ); // Insert Listener?
-            }
+            SCROW nRow = maItems[i].nRow;
+            ((ScFormulaCell*)pCell)->StartListeningTo( pDocument );
+            if ( nRow != maItems[i].nRow )
+                Search( nRow, i ); // Insert Listener?
         }
+    }
 }
 
 
 void ScColumn::StartNeededListeners()
 {
-    if ( !maItems.empty() )
+    if (maItems.empty())
+        return;
+
+    for (SCSIZE i = 0; i < maItems.size(); i++)
     {
-        for (SCSIZE i = 0; i < maItems.size(); i++)
+        ScBaseCell* pCell = maItems[i].pCell;
+        if ( pCell->GetCellType() == CELLTYPE_FORMULA )
         {
-            ScBaseCell* pCell = maItems[i].pCell;
-            if ( pCell->GetCellType() == CELLTYPE_FORMULA )
+            ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
+            if (pFCell->NeedsListening())
             {
-                ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
-                if (pFCell->NeedsListening())
-                {
-                    SCROW nRow = maItems[i].nRow;
-                    pFCell->StartListeningTo( pDocument );
-                    if ( nRow != maItems[i].nRow )
-                        Search( nRow, i ); // Insert Listener?
-                }
+                SCROW nRow = maItems[i].nRow;
+                pFCell->StartListeningTo( pDocument );
+                if ( nRow != maItems[i].nRow )
+                    Search( nRow, i ); // Insert Listener?
             }
         }
     }
@@ -1166,20 +1168,21 @@ void ScColumn::BroadcastInArea( SCROW nRow1, SCROW nRow2 )
 
 void ScColumn::StartListeningInArea( SCROW nRow1, SCROW nRow2 )
 {
-    if ( !maItems.empty() )
+    if (maItems.empty())
+        return;
+
+    SCROW nRow;
+    SCSIZE nIndex;
+    Search( nRow1, nIndex );
+    while ( nIndex < maItems.size() && (nRow = maItems[nIndex].nRow) <= nRow2 )
     {
-        SCROW nRow;
-        SCSIZE nIndex;
-        Search( nRow1, nIndex );
-        while ( nIndex < maItems.size() && (nRow = maItems[nIndex].nRow) <= nRow2 )
-        {
-            ScBaseCell* pCell = maItems[nIndex].pCell;
-            if ( pCell->GetCellType() == CELLTYPE_FORMULA )
-                ((ScFormulaCell*)pCell)->StartListeningTo( pDocument );
-            if ( nRow != maItems[nIndex].nRow )
-                Search( nRow, nIndex ); // Inserted via Listening
-            nIndex++;
-        }
+        ScBaseCell* pCell = maItems[nIndex].pCell;
+        if ( pCell->GetCellType() == CELLTYPE_FORMULA )
+            ((ScFormulaCell*)pCell)->StartListeningTo( pDocument );
+        if ( nRow != maItems[nIndex].nRow )
+            Search( nRow, nIndex ); // Inserted via Listening
+
+        ++nIndex;
     }
 }
 


More information about the Libreoffice-commits mailing list