summaryrefslogtreecommitdiffstats
path: root/sc/inc/columnspanset.hxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-05-24 11:52:18 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-06-24 16:51:25 -0400
commitc008dc483f8c6840803983e7e351cec6fdd32070 (patch)
tree7c88eeabde57ea4a3c1a760d1c02ea2fd37bd721 /sc/inc/columnspanset.hxx
parentAdd new cell container to ScColumn. (diff)
downloadcore-c008dc483f8c6840803983e7e351cec6fdd32070.tar.gz
core-c008dc483f8c6840803983e7e351cec6fdd32070.zip
Switch to using multi_type_vector for cell storage.
The old style cell storage is no more. Currently the code is buildable, but crashes during unit test. Change-Id: Ie688e22e95c7fb02b9e97b23df0fc1883a97945f
Diffstat (limited to 'sc/inc/columnspanset.hxx')
-rw-r--r--sc/inc/columnspanset.hxx54
1 files changed, 54 insertions, 0 deletions
diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx
index ab248285cfd8..55c3f57507e9 100644
--- a/sc/inc/columnspanset.hxx
+++ b/sc/inc/columnspanset.hxx
@@ -16,8 +16,13 @@
#include <mdds/flat_segment_tree.hpp>
#include <boost/noncopyable.hpp>
+class ScColumn;
+class ScMarkData;
+
namespace sc {
+struct ColumnBlockConstPosition;
+
/**
* Structure that stores segments of boolean flags per column, and perform
* custom action on those segments.
@@ -49,6 +54,55 @@ public:
void executeFromTop(Action& ac) const;
};
+/**
+ * Keep track of spans in a single column only.
+ */
+class SingleColumnSpanSet
+{
+public:
+ typedef mdds::flat_segment_tree<SCROW, bool> ColumnSpansType;
+
+ struct Span
+ {
+ SCROW mnRow1;
+ SCROW mnRow2;
+
+ Span(SCROW nRow1, SCROW nRow2) : mnRow1(nRow1), mnRow2(nRow2) {}
+ };
+
+ typedef std::vector<Span> SpansType;
+
+ SingleColumnSpanSet();
+
+ /**
+ * Scan an entire column and tag all non-empty cell positions.
+ */
+ void scan(const ScColumn& rColumn);
+
+ /**
+ * Scan a column between specified range, and tag all non-empty cell
+ * positions.
+ */
+ void scan(const ScColumn& rColumn, SCROW nStart, SCROW nEnd);
+
+ void scan(
+ ColumnBlockConstPosition& rBlockPos, const ScColumn& rColumn, SCROW nStart, SCROW nEnd);
+
+ /**
+ * Scan all marked data and tag all marked segments in specified column.
+ */
+ void scan(const ScMarkData& rMark, SCTAB nTab, SCCOL nCol);
+
+ void set(SCROW nRow1, SCROW nRow2, bool bVal);
+
+ void getRows(std::vector<SCROW> &rRows) const;
+
+ void getSpans(SpansType& rSpans) const;
+
+private:
+ ColumnSpansType maSpans;
+};
+
}
#endif