diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-06-26 18:59:57 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-06-27 15:50:06 -0400 |
commit | a8153482ad4f918f3501aed34c3131e970592575 (patch) | |
tree | 987dbcb2f2f334567de896b0b80f04d67aaa3106 /sc/source/core/data/column3.cxx | |
parent | 85ce60d4c43d35b9673ed22f4a4adaa4928349be (diff) |
Proper handling of formula cells in SwapRow().
Change-Id: Id295160b69cc5cb40cd9e0403928dac8b0e58807
Diffstat (limited to 'sc/source/core/data/column3.cxx')
-rw-r--r-- | sc/source/core/data/column3.cxx | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index b106ed6e92a4..bfb5590666bf 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -398,6 +398,17 @@ void ScColumn::JoinNewFormulaCell( } } +void ScColumn::DetouchFormulaCell( + const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell ) const +{ + if (!pDocument->IsClipOrUndo()) + // Have the dying formula cell stop listening. + rCell.EndListeningTo(pDocument); + + if (rCell.IsShared()) + UnshareFormulaCell(aPos, rCell); +} + void ScColumn::UnshareFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell ) const { @@ -498,12 +509,7 @@ sc::CellStoreType::iterator ScColumn::GetPositionToInsert( const sc::CellStoreTy if (itRet->type == sc::element_type_formula) { ScFormulaCell& rCell = *sc::formula_block::at(*itRet->data, aPos.second); - if (!pDocument->IsClipOrUndo()) - // Have the dying formula cell stop listening. - rCell.EndListeningTo(pDocument); - - if (rCell.IsShared()) - UnshareFormulaCell(aPos, rCell); + DetouchFormulaCell(aPos, rCell); } return itRet; @@ -512,9 +518,13 @@ sc::CellStoreType::iterator ScColumn::GetPositionToInsert( const sc::CellStoreTy void ScColumn::ActivateNewFormulaCell( const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell ) { - // See if this new formula cell can join an existing shared formula group. - sc::CellStoreType::position_type aPos = maCells.position(itPos, nRow); + ActivateNewFormulaCell(maCells.position(itPos, nRow), rCell); +} +void ScColumn::ActivateNewFormulaCell( + const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell ) +{ + // See if this new formula cell can join an existing shared formula group. JoinNewFormulaCell(aPos, rCell); // When we insert from the Clipboard we still have wrong (old) References! |