summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-10-05 19:28:34 +0200
committerEike Rathke <erack@redhat.com>2015-10-05 20:06:55 +0200
commit778d03b59c62d21fd171b81c9fab3ba8496e319d (patch)
tree0f37df809167174d2b9e09742b2a693da6059853 /sc
parent9d6913646881d8decf4f0f7b344e1ba69bed376c (diff)
Resolves: tdf#91453 use configuration of text to number conversion
... also in arithmetic matrix operations if both operands are matrix. Change-Id: I84609656b166b4e059d9496a5ed732a96e731164
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr5.cxx26
1 files changed, 25 insertions, 1 deletions
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 8cb115cdef7d..0d2fb0a7456c 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);
}