[Libreoffice-commits] core.git: Branch 'private/kohei/calc-sort-fix' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Fri Apr 18 07:16:29 PDT 2014
sc/inc/cellvalues.hxx | 2 +-
sc/inc/formulacell.hxx | 1 +
sc/source/core/data/cellvalues.cxx | 4 ++--
sc/source/core/data/formulacell.cxx | 5 +++++
sc/source/core/data/table3.cxx | 3 ++-
5 files changed, 11 insertions(+), 4 deletions(-)
New commits:
commit 818e441318205eb2a26b872c27376f7a66b7711e
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Apr 18 10:16:32 2014 -0400
Correctly set the positions of sorted formula cells.
Change-Id: I21cc7aa2cc521203f4da6f754a2ad7b4e985dd67
diff --git a/sc/inc/cellvalues.hxx b/sc/inc/cellvalues.hxx
index 8de0b04..c2bf1d3 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 57f249d..8e067a80 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 43c251c..0740ab5 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 9a21066..56d0a78 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 4642cf6..bb793dc 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)
More information about the Libreoffice-commits
mailing list