sc/source/core/data/column3.cxx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
New commits: commit 4a01dc6db2ba07bb22b539e5f6c3373bd6e1ed4c Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Tue Jun 18 23:16:00 2013 -0400 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 diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 53eb88a..6edafee 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 ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits