summaryrefslogtreecommitdiff
path: root/sc/source/core/data/column4.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-11-20 21:43:25 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-11-20 22:12:16 -0500
commit01e14bd403e749116844b6ab0b0a7afc66347e90 (patch)
tree25180d441c3a37b5fcbe22d0aca01f3545639bed /sc/source/core/data/column4.cxx
parent061e80fb866d7d6b2a7348ed6eb1852835857ec4 (diff)
Adjust InsertRow() for group area listeners.
Change-Id: I813b45d015eb1ae8dc7bd1242152ef734b5fe08c
Diffstat (limited to 'sc/source/core/data/column4.cxx')
-rw-r--r--sc/source/core/data/column4.cxx70
1 files changed, 70 insertions, 0 deletions
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index ba6d01546f0e..43946e53503c 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1357,4 +1357,74 @@ void ScColumn::EndListeningFormulaCells(
*pEndRow = aFunc.getEndRow();
}
+void ScColumn::EndListeningIntersectedGroups(
+ sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2, std::vector<ScAddress>* pGroupPos )
+{
+ // Only end the intersected group.
+ sc::CellStoreType::position_type aPos = maCells.position(nRow1);
+ sc::CellStoreType::iterator it = aPos.first;
+ if (it->type == sc::element_type_formula)
+ {
+ ScFormulaCell* pFC = sc::formula_block::at(*it->data, aPos.second);
+ ScFormulaCellGroupRef xGroup = pFC->GetCellGroup();
+ if (xGroup && !pFC->IsSharedTop())
+ {
+ // End listening.
+ pFC->EndListeningTo(rCxt);
+ if (pGroupPos)
+ // Record the position of the top cell of the group.
+ pGroupPos->push_back(xGroup->mpTopCell->aPos);
+ }
+ }
+
+ aPos = maCells.position(it, nRow2);
+ it = aPos.first;
+ if (it->type == sc::element_type_formula)
+ {
+ ScFormulaCell* pFC = sc::formula_block::at(*it->data, aPos.second);
+ ScFormulaCellGroupRef xGroup = pFC->GetCellGroup();
+ if (xGroup && !pFC->IsSharedTop())
+ {
+ // End listening.
+ pFC->EndListeningTo(rCxt);
+ if (pGroupPos)
+ {
+ // Record the position of the bottom cell of the group.
+ ScAddress aPosLast = xGroup->mpTopCell->aPos;
+ aPosLast.IncRow(xGroup->mnLength-1);
+ pGroupPos->push_back(aPosLast);
+ }
+ }
+ }
+}
+
+void ScColumn::SetNeedsListeningGroup( SCROW nRow )
+{
+ sc::CellStoreType::position_type aPos = maCells.position(nRow);
+ if (aPos.first->type != sc::element_type_formula)
+ // not a formula cell.
+ return;
+
+ ScFormulaCell** pp = &sc::formula_block::at(*aPos.first->data, aPos.second);
+
+ ScFormulaCellGroupRef xGroup = (*pp)->GetCellGroup();
+ if (!xGroup)
+ {
+ // not a formula group.
+ (*pp)->SetNeedsListening(true);
+ return;
+ }
+
+ // Move back to the top cell.
+ SCROW nTopDelta = (*pp)->aPos.Row() - xGroup->mpTopCell->aPos.Row();
+ for (SCROW i = 0; i < nTopDelta; ++i)
+ --pp;
+
+ // Set the needs listening flag to all cells in the group.
+ assert(*pp == xGroup->mpTopCell);
+ ScFormulaCell** ppEnd = pp + xGroup->mnLength;
+ for (; pp != ppEnd; ++pp)
+ (*pp)->SetNeedsListening(true);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */