summaryrefslogtreecommitdiff
path: root/sc/source/core/data/column3.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-05-17 22:45:43 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-05-20 20:19:27 -0400
commitc2e28f50354d4e95b2202aebe1764d81fdbfd27e (patch)
tree1bd76c276c4635a092b80346adbec4ef832388b0 /sc/source/core/data/column3.cxx
parent0e25fe33f0114dc8723a7a9af4cdd11f07a55ec5 (diff)
Prefer early bail-out.
Change-Id: I112a4be56910c07007b28715336fcd82d56bb313
Diffstat (limited to 'sc/source/core/data/column3.cxx')
-rw-r--r--sc/source/core/data/column3.cxx73
1 files changed, 38 insertions, 35 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index f5730118d1e2..70d007dca056 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;
}
}