summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-08-02 19:55:08 +0200
committerCaolán McNamara <caolanm@redhat.com>2016-08-16 20:04:48 +0000
commit10195ce5563d6ac93177b67d484151c01a751922 (patch)
tree23f3fe7f4df0703e3d030e5dfea36680a125a411
parentupdate credits (diff)
downloadcore-10195ce5563d6ac93177b67d484151c01a751922.tar.gz
core-10195ce5563d6ac93177b67d484151c01a751922.zip
Resolves: tdf#100582 SetMatColsRows() when constructing matrix ScFormulaCell
... from an ScFormulaCellGroup token array, because ScFormulaResult that holds the matrix dimensions is not cloned in that case as we don't clone from an ScFormulaCell. Change-Id: I13ab1b29db71ae1618580de995fe12ec423d4dc7 (cherry picked from commit c82a81bbda104ef08dd9e18725a09475b2d65183) Reviewed-on: https://gerrit.libreoffice.org/27809 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/core/data/column4.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 4c42a7d387c2..bfcf257df217 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -483,6 +483,16 @@ void ScColumn::CloneFormulaCell(
sc::CellStoreType::iterator itPos = maCells.begin();
sc::CellTextAttrStoreType::iterator itAttrPos = maCellTextAttrs.begin();
+ SCCOL nMatrixCols = 0;
+ SCROW nMatrixRows = 0;
+ sal_uInt8 nMatrixFlag = rSrc.GetMatrixFlag();
+ if (nMatrixFlag == MM_FORMULA)
+ {
+ rSrc.GetMatColsRows( nMatrixCols, nMatrixRows);
+ SAL_WARN_IF( nMatrixCols != 1 || nMatrixRows != 1, "sc.core",
+ "ScColumn::CloneFormulaCell - cloning array/matrix with not exactly one column or row as single cell");
+ }
+
std::vector<ScFormulaCell*> aFormulas;
std::vector<sc::RowSpan>::const_iterator itSpan = rRanges.begin(), itSpanEnd = rRanges.end();
for (; itSpan != itSpanEnd; ++itSpan)
@@ -514,7 +524,9 @@ void ScColumn::CloneFormulaCell(
xGroup->compileCode(*pDocument, aPos, pDocument->GetGrammar());
for (size_t i = 0; i < nLen; ++i, aPos.IncRow())
{
- ScFormulaCell* pCell = new ScFormulaCell(pDocument, aPos, xGroup, pDocument->GetGrammar(), rSrc.GetMatrixFlag());
+ ScFormulaCell* pCell = new ScFormulaCell(pDocument, aPos, xGroup, pDocument->GetGrammar(), nMatrixFlag);
+ if (nMatrixFlag == MM_FORMULA)
+ pCell->SetMatColsRows( nMatrixCols, nMatrixRows);
if (i == 0)
{
xGroup->mpTopCell = pCell;