Kaydet (Commit) c2e28f50 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Prefer early bail-out.

Change-Id: I112a4be56910c07007b28715336fcd82d56bb313
üst 0e25fe33
......@@ -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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment