[Libreoffice-commits] core.git: sc/source
Eike Rathke (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 25 09:30:21 UTC 2019
sc/source/core/tool/interpr1.cxx | 12 ++++++++++++
1 file changed, 12 insertions(+)
New commits:
commit 445727d3bce84ef04719242745aac9446035c5bd
Author: Eike Rathke <erack at redhat.com>
AuthorDate: Fri Oct 25 00:31:52 2019 +0200
Commit: Eike Rathke <erack at redhat.com>
CommitDate: Fri Oct 25 11:29:43 2019 +0200
Resolves: tdf#128218 Let RAND() return a scalar double instead of a 1x1 matrix
... even if in array context, for FunctionAccess.callFunction()
compatibility.
Change-Id: Iddfb462dd1b5812c94a2f2061c593b4479faef24
Reviewed-on: https://gerrit.libreoffice.org/81482
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Jenkins
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 16a9d933ed03..d4e867c05767 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1743,6 +1743,18 @@ void ScInterpreter::ScRandom()
SCROW nRows = 0;
if(pMyFormulaCell)
pMyFormulaCell->GetMatColsRows( nCols, nRows);
+
+ if (nCols == 1 && nRows == 1)
+ {
+ // For compatibility with existing
+ // com.sun.star.sheet.FunctionAccess.callFunction() calls that per
+ // default are executed in array context unless
+ // FA.setPropertyValue("IsArrayFunction",False) was set, return a
+ // scalar double instead of a 1x1 matrix object. tdf#128218
+ PushDouble( comphelper::rng::uniform_real_distribution());
+ return;
+ }
+
// ScViewFunc::EnterMatrix() might be asking for
// ScFormulaCell::GetResultDimensions(), which here are none so create
// a 1x1 matrix at least which exactly is the case when EnterMatrix()
More information about the Libreoffice-commits
mailing list