summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-07-05 16:08:36 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-07-05 16:14:55 -0400
commit6747dd33754a15e7d9f5aae01bb8299b6a05e365 (patch)
treee84615b6e9750930aaf0809b22c2ded08b2a248f /sc
parent46776932d8118ae0f64945a9a1ee6ff46094067e (diff)
Use correct row indices to keep track of empty rows.
In pivot table cache, data rows are always zero-based, and are different from the rows of cells from which the data are pulled. This error resulted in incorrect pivot table result when the "skip empty rows" option was set. Change-Id: I4fccb37a8667f7e40d6130ac641d7b2a1daa7694
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/dpcache.cxx22
1 files changed, 21 insertions, 1 deletions
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 9163dde2f934..d04adf15d94f 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -412,7 +412,7 @@ bool ScDPCache::InitFromDoc(ScDocument* pDoc, const ScRange& rRange)
if (!aData.IsEmpty())
{
- maEmptyRows.insert_back(nRow, nRow+1, false);
+ maEmptyRows.insert_back(i, i+1, false);
rField.mnNumFormat = nNumFormat;
}
}
@@ -1212,6 +1212,26 @@ void ScDPCache::Dump() const
}
{
+ struct { SCROW start; SCROW end; bool empty; } aRange;
+ cout << "* empty rows: " << endl;
+ mdds::flat_segment_tree<SCROW, bool>::const_iterator it = maEmptyRows.begin(), itEnd = maEmptyRows.end();
+ if (it != itEnd)
+ {
+ aRange.start = it->first;
+ aRange.empty = it->second;
+ ++it;
+ }
+
+ for (; it != itEnd; ++it)
+ {
+ aRange.end = it->first-1;
+ cout << " rows " << aRange.start << "-" << aRange.end << ": " << (aRange.empty ? "empty" : "not-empty") << endl;
+ aRange.start = it->first;
+ aRange.empty = it->second;
+ }
+ }
+
+ {
GroupFieldsType::const_iterator it = maGroupFields.begin(), itEnd = maGroupFields.end();
for (size_t i = maFields.size(); it != itEnd; ++it, ++i)
{