Move this code into ScDocument, for later refactoring.

Change-Id: I4c34cd4b352dfafe7f423ab8e85f0d93c0368349
This commit is contained in:
Kohei Yoshida 2013-05-13 14:18:17 -04:00
parent 7476ad63d1
commit 180c2fe743
3 changed files with 15 additions and 15 deletions

View file

@ -1753,6 +1753,9 @@ public:
SvtListener* pListener );
void EndListeningCell( const ScAddress& rAddress,
SvtListener* pListener );
void EndListeningFormulaCells( std::vector<ScFormulaCell*>& rCells );
void PutInFormulaTree( ScFormulaCell* pCell );
void RemoveFromFormulaTree( ScFormulaCell* pCell );

View file

@ -331,8 +331,7 @@ void ScColumn::DeleteRange(
drawing undo. */
// cache all formula cells, they will be deleted at end of this function
typedef ::std::vector< ScFormulaCell* > FormulaCellVector;
FormulaCellVector aDelCells;
std::vector<ScFormulaCell*> aDelCells;
aDelCells.reserve( nEndIndex - nStartIndex + 1 );
typedef mdds::flat_segment_tree<SCSIZE, bool> RemovedSegments_t;
@ -437,19 +436,8 @@ void ScColumn::DeleteRange(
}
}
// *** delete all formula cells ***
if (!aDelCells.empty())
{
// First, all cells stop listening, may save unneeded broadcasts and
// recalcualtions.
// NOTE: this actually may remove ScNoteCell entries from maItems if
// the last listener is removed from a broadcaster.
for ( FormulaCellVector::iterator aIt = aDelCells.begin(), aEnd = aDelCells.end(); aIt != aEnd; ++aIt )
{
(*aIt)->EndListeningTo( pDocument );
(*aIt)->Delete();
}
}
pDocument->EndListeningFormulaCells(aDelCells);
std::for_each(aDelCells.begin(), aDelCells.end(), ScDeleteObjectByPtr<ScFormulaCell>());
}
void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag)

View file

@ -200,6 +200,15 @@ void ScDocument::EndListeningCell( const ScAddress& rAddress,
maTabs[nTab]->EndListening( rAddress, pListener );
}
void ScDocument::EndListeningFormulaCells( std::vector<ScFormulaCell*>& rCells )
{
if (rCells.empty())
return;
std::vector<ScFormulaCell*>::iterator it = rCells.begin(), itEnd = rCells.end();
for (; it != itEnd; ++it)
(*it)->EndListeningTo(this);
}
void ScDocument::PutInFormulaTree( ScFormulaCell* pCell )
{