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

Move this code into ScDocument, for later refactoring.

Change-Id: I4c34cd4b352dfafe7f423ab8e85f0d93c0368349
üst 7476ad63
...@@ -1753,6 +1753,9 @@ public: ...@@ -1753,6 +1753,9 @@ public:
SvtListener* pListener ); SvtListener* pListener );
void EndListeningCell( const ScAddress& rAddress, void EndListeningCell( const ScAddress& rAddress,
SvtListener* pListener ); SvtListener* pListener );
void EndListeningFormulaCells( std::vector<ScFormulaCell*>& rCells );
void PutInFormulaTree( ScFormulaCell* pCell ); void PutInFormulaTree( ScFormulaCell* pCell );
void RemoveFromFormulaTree( ScFormulaCell* pCell ); void RemoveFromFormulaTree( ScFormulaCell* pCell );
......
...@@ -331,8 +331,7 @@ void ScColumn::DeleteRange( ...@@ -331,8 +331,7 @@ void ScColumn::DeleteRange(
drawing undo. */ drawing undo. */
// cache all formula cells, they will be deleted at end of this function // cache all formula cells, they will be deleted at end of this function
typedef ::std::vector< ScFormulaCell* > FormulaCellVector; std::vector<ScFormulaCell*> aDelCells;
FormulaCellVector aDelCells;
aDelCells.reserve( nEndIndex - nStartIndex + 1 ); aDelCells.reserve( nEndIndex - nStartIndex + 1 );
typedef mdds::flat_segment_tree<SCSIZE, bool> RemovedSegments_t; typedef mdds::flat_segment_tree<SCSIZE, bool> RemovedSegments_t;
...@@ -437,19 +436,8 @@ void ScColumn::DeleteRange( ...@@ -437,19 +436,8 @@ void ScColumn::DeleteRange(
} }
} }
// *** delete all formula cells *** pDocument->EndListeningFormulaCells(aDelCells);
if (!aDelCells.empty()) std::for_each(aDelCells.begin(), aDelCells.end(), ScDeleteObjectByPtr<ScFormulaCell>());
{
// 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();
}
}
} }
void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag) void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag)
......
...@@ -200,6 +200,15 @@ void ScDocument::EndListeningCell( const ScAddress& rAddress, ...@@ -200,6 +200,15 @@ void ScDocument::EndListeningCell( const ScAddress& rAddress,
maTabs[nTab]->EndListening( rAddress, pListener ); 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 ) void ScDocument::PutInFormulaTree( ScFormulaCell* pCell )
{ {
......
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