Kaydet (Commit) e729c45b authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Correctly set the positions of sorted formula cells.

Change-Id: I21cc7aa2cc521203f4da6f754a2ad7b4e985dd67
üst 4004ceeb
......@@ -49,7 +49,7 @@ public:
void copyTo( ScColumn& rCol, SCROW nRow ) const;
void assign( const std::vector<double>& rVals );
void append( ScRefCellValue& rVal, const CellTextAttr* pAttr );
void append( ScRefCellValue& rVal, const CellTextAttr* pAttr, const ScAddress& rPos );
size_t size() const;
......
......@@ -160,6 +160,7 @@ public:
virtual ~ScFormulaCell();
ScFormulaCell* Clone() const;
ScFormulaCell* Clone( const ScAddress& rPos ) const;
ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos );
......
......@@ -65,7 +65,7 @@ void CellValues::assign( const std::vector<double>& rVals )
mpImpl->maCellTextAttrs.set(0, aDefaults.begin(), aDefaults.end());
}
void CellValues::append( ScRefCellValue& rVal, const CellTextAttr* pAttr )
void CellValues::append( ScRefCellValue& rVal, const CellTextAttr* pAttr, const ScAddress& rPos )
{
assert(mpImpl->maCells.size() == mpImpl->maCellTextAttrs.size());
......@@ -96,7 +96,7 @@ void CellValues::append( ScRefCellValue& rVal, const CellTextAttr* pAttr )
case CELLTYPE_FORMULA:
{
mpImpl->maCells.resize(n+1);
CellStoreType::iterator itBlk = mpImpl->maCells.set(n, rVal.mpFormula->Clone());
CellStoreType::iterator itBlk = mpImpl->maCells.set(n, rVal.mpFormula->Clone(rPos));
size_t nOffset = n - itBlk->position;
CellStoreType::position_type aPos(itBlk, nOffset);
......
......@@ -841,6 +841,11 @@ ScFormulaCell* ScFormulaCell::Clone() const
return new ScFormulaCell(*this, *pDocument, aPos);
}
ScFormulaCell* ScFormulaCell::Clone( const ScAddress& rPos ) const
{
return new ScFormulaCell(*this, *pDocument, rPos);
}
size_t ScFormulaCell::GetHash() const
{
return pCode->GetHash();
......
......@@ -437,7 +437,8 @@ void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress* pProgress )
{
ScSortInfoArray::Cell& rCell = (*pRow)[nCol];
sc::CellValues& rStore = aSortedCols.at(nCol);
rStore.append(rCell.maCell, rCell.mpAttr);
ScAddress aCellPos(aSortParam.nCol1 + nCol, aSortParam.nRow1 + i, nTab);
rStore.append(rCell.maCell, rCell.mpAttr, aCellPos);
}
if (pProgress)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment