[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Mon Oct 5 11:07:35 PDT 2015
sc/source/core/tool/interpr5.cxx | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
New commits:
commit 778d03b59c62d21fd171b81c9fab3ba8496e319d
Author: Eike Rathke <erack at redhat.com>
Date: Mon Oct 5 19:28:34 2015 +0200
Resolves: tdf#91453 use configuration of text to number conversion
... also in arithmetic matrix operations if both operands are matrix.
Change-Id: I84609656b166b4e059d9496a5ed732a96e731164
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 8cb115c..0d2fb0a 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1113,8 +1113,10 @@ static ScMatrixRef lcl_MatrixCalculation(
{
for (j = 0; j < nMinR; j++)
{
+ bool bVal1 = rMat1.IsValueOrEmpty(i,j);
+ bool bVal2 = rMat2.IsValueOrEmpty(i,j);
sal_uInt16 nErr;
- if (rMat1.IsValueOrEmpty(i,j) && rMat2.IsValueOrEmpty(i,j))
+ if (bVal1 && bVal2)
{
double d = Op(rMat1.GetDouble(i,j), rMat2.GetDouble(i,j));
xResMat->PutDouble( d, i, j);
@@ -1124,6 +1126,28 @@ static ScMatrixRef lcl_MatrixCalculation(
{
xResMat->PutError( nErr, i, j);
}
+ else if ((!bVal1 && rMat1.IsString(i,j)) || (!bVal2 && rMat2.IsString(i,j)))
+ {
+ sal_uInt16 nError1 = 0;
+ short nFmt1 = 0;
+ double fVal1 = (bVal1 ? rMat1.GetDouble(i,j) :
+ pInterpreter->ConvertStringToValue( rMat1.GetString(i,j).getString(), nError1, nFmt1));
+
+ sal_uInt16 nError2 = 0;
+ short nFmt2 = 0;
+ double fVal2 = (bVal2 ? rMat2.GetDouble(i,j) :
+ pInterpreter->ConvertStringToValue( rMat2.GetString(i,j).getString(), nError2, nFmt2));
+
+ if (nError1)
+ xResMat->PutError( nError1, i, j);
+ else if (nError2)
+ xResMat->PutError( nError2, i, j);
+ else
+ {
+ double d = Op( fVal1, fVal2);
+ xResMat->PutDouble( d, i, j);
+ }
+ }
else
xResMat->PutError( errNoValue, i, j);
}
More information about the Libreoffice-commits
mailing list