[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - 2 commits - sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Fri Mar 15 07:56:14 PDT 2013
sc/source/core/data/column2.cxx | 26 +++++++++++++++++++++++++-
sc/source/core/data/column3.cxx | 9 +++++++++
2 files changed, 34 insertions(+), 1 deletion(-)
New commits:
commit c03d6f6e0a202e6a1d01f956e12f299b8fc29b5e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Mar 15 10:57:42 2013 -0400
Better consistency checking.
Change-Id: I096282ebb9a10d212affbab32aaa49ca1815b1a7
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 19e5e9c..f96515a 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1392,18 +1392,42 @@ SCROW ScColumn::FindNextVisibleRowWithContent(SCROW nRow, bool bForward) const
void ScColumn::CellStorageModified()
{
#if DEBUG_COLUMN_STORAGE
+ if (maItems.empty())
+ {
+ if (maTextWidths.empty())
+ {
+ cout << "ScColumn::CellStorageModified: Text width array is empty, but shouldn't." << endl;
+ abort();
+ }
+
+ if (maTextWidths.block_size() != 1 || maTextWidths.begin()->type != mdds::mtv::element_type_empty)
+ {
+ cout << "ScColumn::CellStorageModified: When the cell array is empty, the text with array should consist of one empty block." << endl;
+ abort();
+ }
+
+ return;
+ }
+
+ cout << "-- begin" << endl;
+ std::vector<ColEntry>::const_iterator it = maItems.begin(), itEnd = maItems.end();
+ for (; it != itEnd; ++it)
+ cout << "ScColumn::CellStorageModified: entry: row = " << it->nRow << "; cell = " << it->pCell << endl;
+
ScColumnTextWidthIterator aIter(*this, 0, MAXROW);
for (; aIter.hasCell(); aIter.next())
{
SCROW nRow = aIter.getPos();
ScBaseCell* pCell = GetCell(nRow);
+ cout << "ScColumn::CellStorageModified: row = " << nRow << "; cell = " << pCell << endl;
if (!pCell)
{
- cout << "Cell and text width storages are out of sync!" << endl;
+ cout << "ScColumn::CellStorageModified: Cell and text width storages are out of sync!" << endl;
cout.flush();
abort();
}
}
+ cout << "-- end" << endl;
#endif
}
commit 819384d0e2a3152492c8b4e5ed7bd1a3d77254d1
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Mar 15 10:55:40 2013 -0400
Fix the text width array going out of sync when shifting row positions.
Change-Id: I7b9c5554e38a25dd4ff6980e6ae0d1eff241a746
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 6116780..62f0135 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -200,7 +200,9 @@ void ScColumn::FreeAll()
maItems[i].pCell->Delete();
maItems.clear();
+ // Text width should keep a logical empty range of 0-MAXROW when the cell array is empty.
maTextWidths.clear();
+ maTextWidths.resize(MAXROW);
CellStorageModified();
}
@@ -257,6 +259,12 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
else
i = nFirstIndex;
+ // There are cells below the deletion point. Shift their row positions.
+
+ // Shift the text width array too (before the broadcast).
+ maTextWidths.erase(nStartRow, nSize);
+ maTextWidths.resize(MAXROW);
+
ScAddress aAdr( nCol, 0, nTab );
ScHint aHint( SC_HINT_DATACHANGED, aAdr, NULL ); // only areas (ScBaseCell* == NULL)
ScAddress& rAddress = aHint.GetAddress();
@@ -300,6 +308,7 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
pDocument->AreaBroadcastInRange( aRange, aHint );
}
+ CellStorageModified();
pDocument->SetAutoCalc( bOldAutoCalc );
}
More information about the Libreoffice-commits
mailing list