Resolves: tdf#66409 CELL() 2nd argument range take top-left cell

... instead of the otherwise usual intersecting position.

Change-Id: I0edbf32b39e45e1c8fe8fcd7af2c84380aa4cd6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110951
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 0d86f2c..6520091 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2243,7 +2243,6 @@ void ScInterpreter::ScCell()
        return;

    ScAddress aCellPos( aPos );
    bool bError = false;
    if( nParamCount == 2 )
    {
        switch (GetStackType())
@@ -2255,13 +2254,25 @@ void ScInterpreter::ScCell()
                ScCellExternal();
                return;
            }
            case svDoubleRef:
            {
                // Exceptionally not an intersecting position but top left.
                // See ODF v1.3 part 4 OpenFormula 6.13.3 CELL
                ScRange aRange;
                PopDoubleRef( aRange);
                aCellPos = aRange.aStart;
            }
            break;
            case svSingleRef:
                PopSingleRef( aCellPos);
            break;
            default:
                ;
                PopError();
                SetError( FormulaError::NoRef);
        }
        bError = !PopDoubleRefOrSingleRef( aCellPos );
    }
    OUString aInfoType = GetString().getString();
    if( bError || nGlobalError != FormulaError::NONE )
    if (nGlobalError != FormulaError::NONE)
        PushIllegalParameter();
    else
    {