diff options
author | Eike Rathke <erack@redhat.com> | 2015-06-17 00:04:30 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-06-17 00:57:51 +0200 |
commit | ab6be8b2b01f9657f105d5ec9b027c9fa99d4325 (patch) | |
tree | 8667992ccb75fc2c1a03a0718d74a1ddb6d99ff2 /sc/source/core/tool/token.cxx | |
parent | 5fbf5b10ca45528a075aba5d5f8e3f6af08c287f (diff) |
Resolves: tdf#86305 clone upper left of matrix result if double token
Change-Id: I541577e0b99b0144a755e5755adc890c0ca8d204
(cherry picked from commit ffc1ffed11dc63a69fc2db04f12b3ea266b580fe)
Diffstat (limited to 'sc/source/core/tool/token.cxx')
-rw-r--r-- | sc/source/core/tool/token.cxx | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index f9e0cc058cfe..00f1d459613e 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1022,7 +1022,10 @@ void ScMatrixCellResultToken::Assign( const ScMatrixCellResultToken & r ) ScMatrixFormulaCellToken::ScMatrixFormulaCellToken( SCCOL nC, SCROW nR, const ScConstMatrixRef& pMat, formula::FormulaToken* pUL ) : - ScMatrixCellResultToken(pMat, pUL), nRows(nR), nCols(nC) {} + ScMatrixCellResultToken(pMat, pUL), nRows(nR), nCols(nC) +{ + CloneUpperLeftIfNecessary(); +} ScMatrixFormulaCellToken::ScMatrixFormulaCellToken( SCCOL nC, SCROW nR ) : ScMatrixCellResultToken(NULL, NULL), nRows(nR), nCols(nC) {} @@ -1030,10 +1033,7 @@ ScMatrixFormulaCellToken::ScMatrixFormulaCellToken( SCCOL nC, SCROW nR ) : ScMatrixFormulaCellToken::ScMatrixFormulaCellToken( const ScMatrixFormulaCellToken& r ) : ScMatrixCellResultToken(r), nRows(r.nRows), nCols(r.nCols) { - // xUpperLeft is modifiable through - // SetUpperLeftDouble(), so clone it. - if (xUpperLeft) - xUpperLeft = xUpperLeft->Clone(); + CloneUpperLeftIfNecessary(); } ScMatrixFormulaCellToken::~ScMatrixFormulaCellToken() {} @@ -1045,9 +1045,17 @@ bool ScMatrixFormulaCellToken::operator==( const FormulaToken& r ) const nCols == p->nCols && nRows == p->nRows; } +void ScMatrixFormulaCellToken::CloneUpperLeftIfNecessary() +{ + if (xUpperLeft && xUpperLeft->GetType() == svDouble) + xUpperLeft = xUpperLeft->Clone(); +} + void ScMatrixFormulaCellToken::Assign( const ScMatrixCellResultToken & r ) { ScMatrixCellResultToken::Assign( r); + + CloneUpperLeftIfNecessary(); } void ScMatrixFormulaCellToken::Assign( const formula::FormulaToken& r ) @@ -1069,6 +1077,7 @@ void ScMatrixFormulaCellToken::Assign( const formula::FormulaToken& r ) { xUpperLeft = &r; xMatrix = NULL; + CloneUpperLeftIfNecessary(); } } } |