diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-03 00:50:46 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-03 00:55:41 -0400 |
commit | af7df25bcc8bc95462e2b3bf8c003d035111a479 (patch) | |
tree | bf7bdeba603cdaeec0e371081cfc6b10ceb2a8ee /sc/source/core/data/columnspanset.cxx | |
parent | 41062189f78990f7aa42949484b58de64b0dce79 (diff) |
fdo#78062: Broadcast only on non-empty cells within deleted range.
We don't want to broadcast over the whole selected range, which may be
the whole sheet which is well over 1 billion cells !
Change-Id: I7c139ce5efe09312cf824e35f0efe551184032eb
Diffstat (limited to 'sc/source/core/data/columnspanset.cxx')
-rw-r--r-- | sc/source/core/data/columnspanset.cxx | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx index 1aa57ba11c94..b06f9f7ed2c1 100644 --- a/sc/source/core/data/columnspanset.cxx +++ b/sc/source/core/data/columnspanset.cxx @@ -21,6 +21,29 @@ namespace sc { +namespace { + +class ColumnScanner +{ + ColumnSpanSet::ColumnSpansType& mrRanges; + bool mbVal; +public: + ColumnScanner(ColumnSpanSet::ColumnSpansType& rRanges, bool bVal) : + mrRanges(rRanges), mbVal(bVal) {} + + void operator() (const sc::CellStoreType::value_type& node, size_t nOffset, size_t nDataSize) + { + if (node.type == sc::element_type_empty) + return; + + size_t nRow = node.position + nOffset; + size_t nEndRow = nRow + nDataSize; // Last row of current block plus 1 + mrRanges.insert_back(nRow, nEndRow, mbVal); + } +}; + +} + RowSpan::RowSpan(SCROW nRow1, SCROW nRow2) : mnRow1(nRow1), mnRow2(nRow2) {} ColRowSpan::ColRowSpan(SCCOLROW nStart, SCCOLROW nEnd) : mnStart(nStart), mnEnd(nEnd) {} @@ -97,6 +120,30 @@ void ColumnSpanSet::set(const ScRange& rRange, bool bVal) } } +void ColumnSpanSet::scan( + const ScDocument& rDoc, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bVal) +{ + if (!ValidColRow(nCol1, nRow1) || !ValidColRow(nCol2, nRow2)) + return; + + if (nCol1 > nCol2 || nRow1 > nRow2) + return; + + const ScTable* pTab = rDoc.FetchTable(nTab); + if (!pTab) + return; + + for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) + { + ColumnType& rCol = getColumn(nTab, nCol); + + const CellStoreType& rSrcCells = pTab->aCol[nCol].maCells; + + ColumnScanner aScanner(rCol.maSpans, bVal); + ParseBlock(rSrcCells.begin(), rSrcCells, aScanner, nRow1, nRow2); + } +} + void ColumnSpanSet::executeAction(Action& ac) const { for (size_t nTab = 0; nTab < maDoc.size(); ++nTab) |