Resolves: tdf#160804 sc: ResizeMatrix: Use document grammar

API grammar (old GRAM_PODF_A1) here was always wrong and could
never had matched the formula string obtained from the document,
but in earlier days array separators weren't configurable so this
may have worked accidentally.. Likely GRAM_PODF_A1 was introduced
being confused by existance of older bApi parameter that never was
true though and got eliminated later.

Change-Id: Ie77ad4047c21d999bea1ff97c7c2b451f01121eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167844
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 556cd6e..d47f6f0 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5521,11 +5521,11 @@ void ScDocFunc::ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd

    if ( DeleteContents( aMark, InsertDeleteFlags::CONTENTS, true, false/*bApi*/ ) )
    {
        // GRAM_API for API compatibility.
        if (!EnterMatrix( aNewRange, &aMark, nullptr, aFormula, false/*bApi*/, false, OUString(), formula::FormulaGrammar::GRAM_API ))
        // Formula string was obtained in document grammar.
        if (!EnterMatrix( aNewRange, &aMark, nullptr, aFormula, false/*bApi*/, false, OUString(), rDoc.GetGrammar() ))
        {
            // try to restore the previous state
            EnterMatrix( rOldRange, &aMark, nullptr, aFormula, false/*bApi*/, false, OUString(), formula::FormulaGrammar::GRAM_API );
            EnterMatrix( rOldRange, &aMark, nullptr, aFormula, false/*bApi*/, false, OUString(), rDoc.GetGrammar() );
        }
    }