sc/source/ui/view/viewfun4.cxx |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 6c73ca4671958cb066beecade5661e124c497e25
Author: Eike Rathke <er...@redhat.com>
Date:   Wed Apr 19 11:14:42 2017 +0200

    Resolves: tdf#102525 handle array/matrix formula in cycle cell reference 
types
    
    Change-Id: Ib2443d5bda0c9b1268835f08e4931d5dec2d7f1b

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;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to