summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <er@openoffice.org>2001-04-23 17:38:10 +0000
committerEike Rathke <er@openoffice.org>2001-04-23 17:38:10 +0000
commit2d897f47d143574faff2a17ffd5228d4722faa20 (patch)
tree5ef1b9d82057657f99bf641c362b02495bbdf636 /sc
parenta7ad29076e142b09de4565c8257323d927bc22fd (diff)
#86129# ScNeg: unary minus, handle {=-A1:D1} matrix formula
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr1.cxx48
1 files changed, 41 insertions, 7 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index d6234cf45a36..29842b508b8e 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: interpr1.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: er $ $Date: 2001-03-14 18:10:21 $
+ * last change: $Author: er $ $Date: 2001-04-23 18:38:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -753,16 +753,50 @@ void ScInterpreter::ScOr()
}
-void ScInterpreter::ScNot()
+void ScInterpreter::ScNeg()
{
- nFuncFmtType = NUMBERFORMAT_LOGICAL;
- PushInt( GetDouble() == 0.0 );
+ MatrixDoubleRefToMatrix();
+ switch ( GetStackType() )
+ {
+ case svMatrix :
+ {
+ USHORT nMatInd;
+ ScMatrix* pMat = GetMatrix( nMatInd );
+ if ( pMat )
+ {
+ USHORT nC, nR;
+ pMat->GetDimensions( nC, nR );
+ USHORT nResMat;
+ ScMatrix* pResMat = GetNewMat( nC, nR, nResMat );
+ if ( !pResMat )
+ SetNoValue();
+ else
+ {
+ ULONG nCount = nC * nR;
+ for ( ULONG j=0; j<nCount; ++j )
+ {
+ if ( !pMat->IsString(j) )
+ pResMat->PutDouble( -pMat->GetDouble(j), j );
+ else
+ pResMat->PutString(
+ ScGlobal::GetRscString( STR_NO_VALUE ), j );
+ }
+ nRetMat = nResMat;
+ PushMatrix( pResMat );
+ }
+ }
+ }
+ break;
+ default:
+ PushDouble( -GetDouble() );
+ }
}
-void ScInterpreter::ScNeg()
+void ScInterpreter::ScNot()
{
- PushDouble(-GetDouble());
+ nFuncFmtType = NUMBERFORMAT_LOGICAL;
+ PushInt( GetDouble() == 0.0 );
}