summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/interpr5.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/tool/interpr5.cxx')
-rw-r--r--sc/source/core/tool/interpr5.cxx21
1 files changed, 5 insertions, 16 deletions
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index e33484658837..0d5f907cddb8 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1188,6 +1188,7 @@ void ScInterpreter::ScAdd()
{
CalculateAddSub(false);
}
+
void ScInterpreter::CalculateAddSub(bool _bSub)
{
ScMatrixRef pMat1 = NULL;
@@ -1275,29 +1276,17 @@ void ScInterpreter::CalculateAddSub(bool _bSub)
}
SCSIZE nC, nR;
pMat->GetDimensions(nC, nR);
- ScMatrixRef pResMat = GetNewMat(nC, nR);
+ ScMatrixRef pResMat = GetNewMat(nC, nR, true);
if (pResMat)
{
- SCSIZE nCount = nC * nR;
+ svl::SharedString aString = mrStrPool.intern(ScGlobal::GetRscString(STR_NO_VALUE));
if (bFlag || !_bSub )
{
- for ( SCSIZE i = 0; i < nCount; i++ )
- {
- if (pMat->IsValue(i))
- pResMat->PutDouble( _bSub ? ::rtl::math::approxSub( fVal, pMat->GetDouble(i)) : ::rtl::math::approxAdd( pMat->GetDouble(i), fVal), i);
- else
- pResMat->PutString(mrStrPool.intern(ScGlobal::GetRscString(STR_NO_VALUE)), i);
- }
+ pMat->SubAddOp(_bSub, fVal, aString, *pResMat);
}
else
{
- for ( SCSIZE i = 0; i < nCount; i++ )
- {
- if (pMat->IsValue(i))
- pResMat->PutDouble( ::rtl::math::approxSub( pMat->GetDouble(i), fVal), i);
- else
- pResMat->PutString(mrStrPool.intern(ScGlobal::GetRscString(STR_NO_VALUE)), i);
- }
+ pMat->SubAddOp(true, fVal, aString, *pResMat);
}
PushMatrix(pResMat);
}