[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Wed May 8 13:03:09 PDT 2013
sc/source/core/data/column.cxx | 31 ++++++++-----------------------
1 file changed, 8 insertions(+), 23 deletions(-)
New commits:
commit c5d188a7cbd4f0e85e4911ce3d97c606d07de4f2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed May 8 16:04:50 2013 -0400
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 );
-
- 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;
+ // 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();
+
+ maItems.erase(itBeg, maItems.end());
}
pDocument->SetAutoCalc( bOldAutoCalc );
More information about the Libreoffice-commits
mailing list