sc/source/core/data/table3.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
New commits: commit 84d9fcf751d4b4c9982c088e618779a1bbc4927b Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Mon Apr 21 21:50:44 2014 -0400 Handle cell formats correctly during sort. Unfortunately sorting becomes noticeably slower when cell format is enabled. Perhaps a future project. Change-Id: Ieb02b207b62df343d1f667a8075874b7688ee9a7 diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 88e693e..b1a40d0 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -229,8 +229,9 @@ public: const sc::CellTextAttr* mpAttr; const SvtBroadcaster* mpBroadcaster; const ScPostIt* mpNote; + const ScPatternAttr* mpPattern; - Cell() : mpAttr(NULL), mpBroadcaster(NULL), mpNote(NULL) {} + Cell() : mpAttr(NULL), mpBroadcaster(NULL), mpNote(NULL), mpPattern(NULL) {} }; typedef std::vector<Cell> RowType; @@ -361,6 +362,9 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 ) rCell.mpAttr = rCol.GetCellTextAttr(aBlockPos, nRow); rCell.mpBroadcaster = rCol.GetBroadcaster(aBlockPos, nRow); rCell.mpNote = rCol.GetCellNote(aBlockPos, nRow); + + if (aSortParam.bIncludePattern) + rCell.mpPattern = rCol.GetPattern(nRow); } } } @@ -471,6 +475,8 @@ void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress* pProgress ) ScSortInfoArray::RowType* pRow = (*pRows)[i]; for (size_t j = 0; j < pRow->size(); ++j) { + ScAddress aCellPos(aSortParam.nCol1 + j, nRow1 + i, nTab); + ScSortInfoArray::Cell& rCell = (*pRow)[j]; sc::CellStoreType& rCellStore = aSortedCols.at(j).maCells; @@ -492,9 +498,9 @@ void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress* pProgress ) { assert(rCell.mpAttr); size_t n = rCellStore.size(); - ScAddress aCellPos(aSortParam.nCol1 + j, nRow1 + i, nTab); sc::CellStoreType::iterator itBlk = rCellStore.push_back(rCell.maCell.mpFormula->Clone(aCellPos)); + // Join the formula cells as we fill the container. size_t nOffset = n - itBlk->position; sc::CellStoreType::position_type aPos(itBlk, nOffset); sc::SharedFormulaUtil::joinFormulaCellAbove(aPos); @@ -527,6 +533,10 @@ void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress* pProgress ) rNoteStore.push_back(const_cast<ScPostIt*>(rCell.mpNote)); else rNoteStore.push_back_empty(); + + // Set formats to the document directly. + if (rCell.mpPattern) + aCol[aCellPos.Col()].SetPattern(aCellPos.Row(), *rCell.mpPattern, true); } if (pProgress) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits