[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sc/inc sc/source
Eike Rathke
erack at redhat.com
Wed Jul 8 04:48:05 PDT 2015
sc/inc/scmatrix.hxx | 3 +++
sc/source/core/tool/interpr5.cxx | 10 +++++-----
sc/source/core/tool/scmatrix.cxx | 13 +++++++++++++
3 files changed, 21 insertions(+), 5 deletions(-)
New commits:
commit f5427fa4d7cb9ad79d68d0760030ca998ca1d0e5
Author: Eike Rathke <erack at redhat.com>
Date: Mon Jul 6 16:48:42 2015 +0200
use ScMatrix::IsValueOrEmpty() on math operators Mul/Div/Pow, tdf#91453
... which aren't implemented at ScMatrix yet. Using IsValue() worked
when errors were not propagated, and before that when errors were
propagated because ScMatrix didn't have empty elements but instead was
initialized to 0.0
Change-Id: Ib9c6d34f2e6a68e483b606923cbcc41a3c1d2f51
Reviewed-on: https://gerrit.libreoffice.org/16799
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 27d3777..63284e9 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -342,6 +342,9 @@ public:
bool IsValue( SCSIZE nC, SCSIZE nR ) const;
/// @return <TRUE/> if value or boolean or empty or empty path.
+ bool IsValueOrEmpty( SCSIZE nIndex ) const;
+
+ /// @return <TRUE/> if value or boolean or empty or empty path.
bool IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const;
/// @return <TRUE/> if boolean.
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 3aab1c2..4a093be 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1471,7 +1471,7 @@ void ScInterpreter::ScMul()
{
SCSIZE nCount = nC * nR;
for ( SCSIZE i = 0; i < nCount; i++ )
- if (pMat->IsValue(i))
+ if (pMat->IsValueOrEmpty(i))
pResMat->PutDouble(pMat->GetDouble(i)*fVal, i);
else
pResMat->PutError( errNoValue, i);
@@ -1550,14 +1550,14 @@ void ScInterpreter::ScDiv()
SCSIZE nCount = nC * nR;
if (bFlag)
{ for ( SCSIZE i = 0; i < nCount; i++ )
- if (pMat->IsValue(i))
+ if (pMat->IsValueOrEmpty(i))
pResMat->PutDouble( div( fVal, pMat->GetDouble(i)), i);
else
pResMat->PutError( errNoValue, i);
}
else
{ for ( SCSIZE i = 0; i < nCount; i++ )
- if (pMat->IsValue(i))
+ if (pMat->IsValueOrEmpty(i))
pResMat->PutDouble( div( pMat->GetDouble(i), fVal), i);
else
pResMat->PutError( errNoValue, i);
@@ -1629,14 +1629,14 @@ void ScInterpreter::ScPow()
SCSIZE nCount = nC * nR;
if (bFlag)
{ for ( SCSIZE i = 0; i < nCount; i++ )
- if (pMat->IsValue(i))
+ if (pMat->IsValueOrEmpty(i))
pResMat->PutDouble(pow(fVal,pMat->GetDouble(i)), i);
else
pResMat->PutError( errNoValue, i);
}
else
{ for ( SCSIZE i = 0; i < nCount; i++ )
- if (pMat->IsValue(i))
+ if (pMat->IsValueOrEmpty(i))
pResMat->PutDouble(pow(pMat->GetDouble(i),fVal), i);
else
pResMat->PutError( errNoValue, i);
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 90b2376..707337e 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -259,6 +259,7 @@ public:
bool IsEmptyPath( SCSIZE nC, SCSIZE nR ) const;
bool IsValue( SCSIZE nIndex ) const;
bool IsValue( SCSIZE nC, SCSIZE nR ) const;
+ bool IsValueOrEmpty( SCSIZE nIndex ) const;
bool IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const;
bool IsBoolean( SCSIZE nC, SCSIZE nR ) const;
bool IsNumeric() const;
@@ -749,6 +750,13 @@ bool ScMatrixImpl::IsValue( SCSIZE nC, SCSIZE nR ) const
return false;
}
+bool ScMatrixImpl::IsValueOrEmpty( SCSIZE nIndex ) const
+{
+ SCSIZE nC, nR;
+ CalcPosition(nIndex, nC, nR);
+ return IsValueOrEmpty(nC, nR);
+}
+
bool ScMatrixImpl::IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const
{
ValidColRowReplicated(nC, nR);
@@ -2364,6 +2372,11 @@ bool ScMatrix::IsValue( SCSIZE nC, SCSIZE nR ) const
return pImpl->IsValue(nC, nR);
}
+bool ScMatrix::IsValueOrEmpty( SCSIZE nIndex ) const
+{
+ return pImpl->IsValueOrEmpty(nIndex);
+}
+
bool ScMatrix::IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const
{
return pImpl->IsValueOrEmpty(nC, nR);
More information about the Libreoffice-commits
mailing list