Simplify this a bit.
By taking advantage of 1) cell array being std::vector, and 2) broadcasters
are no longer stored with cells.
Change-Id: I9ba1d3004e62d7bb7810d8fed0c4e8fd17605d0f
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 97b361e..af373d6 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1194,29 +1194,14 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
if (bCountChanged)
{
SCSIZE nDelCount = maItems.size() - nNewCount;
ScBaseCell** ppDelCells = new ScBaseCell*[nDelCount];
SCROW* pDelRows = new SCROW[nDelCount];
for (i = 0; i < nDelCount; i++)
{
ppDelCells[i] = maItems[nNewCount+i].pCell;
pDelRows[i] = maItems[nNewCount+i].nRow;
}
maItems.resize( nNewCount );
// Some cells in the lower part of the cell array have been pushed out
// beyond MAXROW. Delete them.
std::vector<ColEntry>::iterator itBeg = maItems.begin();
std::advance(itBeg, nNewCount);
for (std::vector<ColEntry>::iterator it = itBeg; it != maItems.end(); ++it)
it->pCell->Delete();
for (i = 0; i < nDelCount; i++)
{
SCROW nDelRow = pDelRows[i];
SvtBroadcaster* pBC = GetBroadcaster(nDelRow);
if (pBC)
{
MoveListeners( *pBC, pDelRows[i] - nSize );
ppDelCells[i]->Delete();
}
}
delete [] pDelRows;
delete [] ppDelCells;
maItems.erase(itBeg, maItems.end());
}
pDocument->SetAutoCalc( bOldAutoCalc );