summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-14 22:57:56 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-15 11:37:06 -0400
commit927da98a2a4860f926968b4704e02d58d7cf0eea (patch)
tree7afad7bd55d44ec068e5448dc2a6f76f91031f33
parent632290663a9d2bc722ddfb96aec049d7362204d6 (diff)
Add integrity check after column cell storage is modified.
Change-Id: I8d2bd7616e0428e4e881ef0dc1012c4973e636a9
-rw-r--r--sc/inc/column.hxx8
-rw-r--r--sc/source/core/data/column2.cxx21
2 files changed, 29 insertions, 0 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index ca68e7fd55c0..666d067b0b20 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -28,6 +28,14 @@
#include <set>
#include <vector>
+#define DEBUG_COLUMN_STORAGE 1
+
+#if DEBUG_COLUMN_STORAGE
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+#endif
+
#include <mdds/multi_type_vector.hpp>
#include <mdds/multi_type_vector_trait.hpp>
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 9190b313b7dd..19e5e9cab211 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -56,6 +56,13 @@
#include <math.h>
+#if DEBUG_COLUMN_STORAGE
+#include "columniterator.hxx"
+#include <iostream>
+using std::cout;
+using std::endl;
+#endif
+
// -----------------------------------------------------------------------
// factor from font size to optimal cell height (text width)
@@ -1384,6 +1391,20 @@ SCROW ScColumn::FindNextVisibleRowWithContent(SCROW nRow, bool bForward) const
void ScColumn::CellStorageModified()
{
+#if DEBUG_COLUMN_STORAGE
+ ScColumnTextWidthIterator aIter(*this, 0, MAXROW);
+ for (; aIter.hasCell(); aIter.next())
+ {
+ SCROW nRow = aIter.getPos();
+ ScBaseCell* pCell = GetCell(nRow);
+ if (!pCell)
+ {
+ cout << "Cell and text width storages are out of sync!" << endl;
+ cout.flush();
+ abort();
+ }
+ }
+#endif
}
unsigned short ScColumn::GetTextWidth(SCROW nRow) const