[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/source
Eike Rathke
erack at redhat.com
Thu Apr 27 20:18:33 UTC 2017
sc/source/ui/view/viewfun4.cxx | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
New commits:
commit ac15df592ea7acac7399c99f64539cab556d2fab
Author: Eike Rathke <erack at redhat.com>
Date: Wed Apr 19 11:14:42 2017 +0200
Resolves: tdf#102525 handle array/matrix formula in cycle cell reference types
(cherry picked from commit 6c73ca4671958cb066beecade5661e124c497e25)
Conflicts:
sc/source/ui/view/viewfun4.cxx
keep the leading '=' equal character, tdf#102525 follow-up
So to feed it to the compiler again in case it's a "==" force-always formula,
which theoretically would also be valid in matrix mode.
(cherry picked from commit c15f497b9a3463c7eeca1e8cc2c6f46ca293b9af)
e694e12a3bc4581469b7ad9cc06a23333a664d6f
Change-Id: Ib2443d5bda0c9b1268835f08e4931d5dec2d7f1b
Reviewed-on: https://gerrit.libreoffice.org/36669
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 614e2d98caba..c8ff808cc534 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();
+ sal_uInt8 eMatrixMode = pCell->GetMatrixFlag();
+ if (eMatrixMode == MM_REFERENCE)
+ continue;
+
OUString aOld;
pCell->GetFormula(aOld);
sal_Int32 nLen = aOld.getLength();
+ if (eMatrixMode == MM_FORMULA)
+ {
+ assert(nLen >= 2 && aOld[0] == '{' && aOld[nLen-1] == '}');
+ nLen -= 2;
+ aOld = aOld.copy( 1, 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, MM_NONE);
+ pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, eMatrixMode);
pDoc->SetFormulaCell(aPos, pNewCell);
bOk = true;
More information about the Libreoffice-commits
mailing list