summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/viewfun4.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-04-19 11:14:42 +0200
committerEike Rathke <erack@redhat.com>2017-04-19 11:16:59 +0200
commit6c73ca4671958cb066beecade5661e124c497e25 (patch)
treee744657d62f1443feefd76055590d297abebd566 /sc/source/ui/view/viewfun4.cxx
parentc72b9c1dc5683a132bf00659e0c8556253340c97 (diff)
Resolves: tdf#102525 handle array/matrix formula in cycle cell reference types
Change-Id: Ib2443d5bda0c9b1268835f08e4931d5dec2d7f1b
Diffstat (limited to 'sc/source/ui/view/viewfun4.cxx')
-rw-r--r--sc/source/ui/view/viewfun4.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 1f8bdf5fd9fc..e947747539d7 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -248,9 +248,19 @@ void ScViewFunc::DoRefConversion()
continue;
ScFormulaCell* pCell = aIter.getFormulaCell();
+ ScMatrixMode eMatrixMode = pCell->GetMatrixFlag();
+ if (eMatrixMode == ScMatrixMode::Reference)
+ continue;
+
OUString aOld;
pCell->GetFormula(aOld);
sal_Int32 nLen = aOld.getLength();
+ if (eMatrixMode == ScMatrixMode::Formula)
+ {
+ assert(nLen >= 3 && aOld[0] == '{' && aOld[1] == '=' && aOld[aOld.getLength()-1] == '}');
+ nLen -= 3;
+ aOld = aOld.copy( 2, nLen);
+ }
ScRefFinder aFinder( aOld, aIter.GetPos(), pDoc, pDoc->GetAddressConvention() );
aFinder.ToggleRel( 0, nLen );
if (aFinder.GetFound())
@@ -262,7 +272,7 @@ void ScViewFunc::DoRefConversion()
std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aNew));
ScFormulaCell* pNewCell =
new ScFormulaCell(
- pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::NONE);
+ pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, eMatrixMode);
pDoc->SetFormulaCell(aPos, pNewCell);
bOk = true;