summaryrefslogtreecommitdiff
path: root/sc/source/core/data/table3.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-07-01 23:08:14 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-07-02 13:19:32 -0400
commitcfb2ce587b097b407eb15699cff7ce9fb6844123 (patch)
tree9ca222bdaf03e11ae3c3951ac84d0b3a2ce92aeb /sc/source/core/data/table3.cxx
parentdb377e02c309c20419aef1360409be09fe50fc42 (diff)
Re-implement the COUNT function for efficiency.
By taking advantage of the block structure of the new cell storage. Change-Id: Ib953c14d364ccdff7df5caf70d57cec86189e3be
Diffstat (limited to 'sc/source/core/data/table3.cxx')
-rw-r--r--sc/source/core/data/table3.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index eff2cd6f0a77..99718164027f 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -55,6 +55,7 @@
#include "cellvalue.hxx"
#include "tokenarray.hxx"
#include "mtvcellfunc.hxx"
+#include "columnspanset.hxx"
#include <vector>
#include <boost/unordered_set.hpp>
@@ -1159,6 +1160,36 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
return bSpaceLeft;
}
+void ScTable::MarkSubTotalCells(
+ sc::ColumnSpanSet& rSet, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bVal ) const
+{
+ if (!ValidCol(nCol1) || !ValidCol(nCol2))
+ return;
+
+ // Pick up all subtotal formula cells.
+ for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
+ aCol[nCol].MarkSubTotalCells(rSet, nRow1, nRow2, bVal);
+
+ // Pick up all filtered rows.
+ ScFlatBoolRowSegments::RangeData aFilteredSpan;
+ SCROW nRow = nRow1;
+ while (nRow <= nRow2)
+ {
+ if (!mpFilteredRows->getRangeData(nRow, aFilteredSpan))
+ // Failed for whatever reason.
+ return;
+
+ if (aFilteredSpan.mbValue)
+ {
+ // Filtered span found.
+ for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
+ rSet.set(nTab, nCol, nRow, aFilteredSpan.mnRow2, bVal);
+ }
+
+ nRow = aFilteredSpan.mnRow2 + 1;
+ }
+}
+
namespace {
class QueryEvaluator