summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-06-17 00:04:30 +0200
committerAndras Timar <andras.timar@collabora.com>2015-06-18 11:19:49 +0200
commit533225f98576ad33efbf0ead638872821db2ed3a (patch)
treeb26be949ad2ba9e803c582a4e49348c4a46bab14 /sc/source
parent4d0b68128824651478c1119e2649dabb81f8aea0 (diff)
Resolves: tdf#86305 clone upper left of matrix result if double token
Change-Id: I541577e0b99b0144a755e5755adc890c0ca8d204 (cherry picked from commit ffc1ffed11dc63a69fc2db04f12b3ea266b580fe) Reviewed-on: https://gerrit.libreoffice.org/16326 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/tool/token.cxx19
1 files changed, 14 insertions, 5 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 1e5c7d2ec35a..b4d1dd02fc12 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -918,7 +918,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) {}
@@ -926,10 +929,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();
}
bool ScMatrixFormulaCellToken::operator==( const FormulaToken& r ) const
@@ -939,9 +939,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 )
@@ -963,6 +971,7 @@ void ScMatrixFormulaCellToken::Assign( const formula::FormulaToken& r )
{
xUpperLeft = &r;
xMatrix = NULL;
+ CloneUpperLeftIfNecessary();
}
}
}