diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-18 10:16:32 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-23 21:08:21 -0400 |
commit | e729c45b6cc9b1c8d683787aa05d670ac16efbc0 (patch) | |
tree | 869032d298cfad2955a4da04ee582c3d05a7564e /sc | |
parent | 4004ceeb39e14c6ef1cfef7925623ccfa02ecb35 (diff) |
Correctly set the positions of sorted formula cells.
Change-Id: I21cc7aa2cc521203f4da6f754a2ad7b4e985dd67
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/cellvalues.hxx | 2 | ||||
-rw-r--r-- | sc/inc/formulacell.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/cellvalues.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 3 |
5 files changed, 11 insertions, 4 deletions
diff --git a/sc/inc/cellvalues.hxx b/sc/inc/cellvalues.hxx index 37eac7cd133f..f68ce5a0f69a 100644 --- a/sc/inc/cellvalues.hxx +++ b/sc/inc/cellvalues.hxx @@ -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; diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 8c79ddae8523..71389eaf9c19 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -160,6 +160,7 @@ public: virtual ~ScFormulaCell(); ScFormulaCell* Clone() const; + ScFormulaCell* Clone( const ScAddress& rPos ) const; ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos ); diff --git a/sc/source/core/data/cellvalues.cxx b/sc/source/core/data/cellvalues.cxx index 43c251cc9a91..0740ab5e384c 100644 --- a/sc/source/core/data/cellvalues.cxx +++ b/sc/source/core/data/cellvalues.cxx @@ -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); diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 363edb0ce11e..45ff1646e2e6 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -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(); diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 4642cf69dddb..bb793dc0c515 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -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) |