summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-06-18 23:16:00 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-06-24 16:51:30 -0400
commit6ea53929245eb496d6954ab266636978653f1784 (patch)
tree826945cf18a05a00a20b87a7800b907f0678fbff /sc
parentDon't bail out on good condition. (diff)
downloadcore-6ea53929245eb496d6954ab266636978653f1784.tar.gz
core-6ea53929245eb496d6954ab266636978653f1784.zip
When deleting cells, be sure to delete the corresponding cell attrs as well.
The cell and cell attr arrays must - be - in - sync - at - all - times. Change-Id: I2854c977eada389e5b9d908b97dd3fa78fc62097
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/column3.cxx20
1 files changed, 16 insertions, 4 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 885d94848b5f..f345c50a18eb 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -573,15 +573,18 @@ public:
class EmptyCells
{
+ sc::ColumnBlockPosition& mrPos;
sc::CellStoreType::iterator miPos;
sc::CellStoreType& mrCells;
+ sc::CellTextAttrStoreType& mrAttrs;
public:
- EmptyCells(sc::CellStoreType::iterator itPos, sc::CellStoreType& rCells) :
- miPos(itPos), mrCells(rCells) {}
+ EmptyCells(sc::ColumnBlockPosition& rPos, sc::CellStoreType& rCells, sc::CellTextAttrStoreType& rAttrs) :
+ mrPos(rPos), mrCells(rCells), mrAttrs(rAttrs) {}
void operator() (const sc::SingleColumnSpanSet::Span& rSpan)
{
- miPos = mrCells.set_empty(miPos, rSpan.mnRow1, rSpan.mnRow2);
+ mrPos.miCellPos = mrCells.set_empty(mrPos.miCellPos, rSpan.mnRow1, rSpan.mnRow2);
+ mrPos.miCellTextAttrPos = mrAttrs.set_empty(mrPos.miCellTextAttrPos, rSpan.mnRow1, rSpan.mnRow2);
}
};
@@ -599,15 +602,24 @@ void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag)
if (!IsEmptyData() && nContFlag)
{
+ // There are cells to delete. Determine which cells to delete based on the deletion flags.
DeleteAreaHandler aFunc(*pDocument, nDelFlag);
sc::CellStoreType::iterator itPos = maCells.position(nStartRow).first;
sc::ProcessBlock(itPos, maCells, aFunc, nStartRow, nEndRow);
aFunc.endFormulas(); // Have the formula cells stop listening.
aFunc.getSpans().getRows(aDeletedRows);
+ // Get the deletion spans.
sc::SingleColumnSpanSet::SpansType aSpans;
aFunc.getSpans().getSpans(aSpans);
- std::for_each(aSpans.begin(), aSpans.end(), EmptyCells(itPos, maCells));
+
+ sc::ColumnBlockPosition aBlockPos;
+ aBlockPos.miCellPos = itPos;
+ aBlockPos.miCellTextAttrPos = maCellTextAttrs.begin();
+
+ // Delete the cells for real.
+ std::for_each(aSpans.begin(), aSpans.end(), EmptyCells(aBlockPos, maCells, maCellTextAttrs));
+ CellStorageModified();
}
if ( nDelFlag & IDF_EDITATTR )