diff options
author | Noel Power <noel.power@novell.com> | 2012-01-24 12:27:19 +0000 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2012-01-24 12:30:51 +0000 |
commit | 68a55b78362209fb6244ed31e23042af60c39c85 (patch) | |
tree | 0fcf39f467baf6b2de0691b1a658d426f512f184 /basic/source | |
parent | f933735c1cd7f1fad71c300fdb14baebdc62e1bd (diff) |
tweak treatment of '+/-' operators when dealing with Date types
Any '+' operation involving Date types results in a Date, '-' of a Date type results in a Date except if both LHS & RHS are Date(s)
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/sbx/sbxvalue.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index e67335cec4a4..f4aab28c70c6 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -1272,10 +1272,15 @@ Lbl_OpIsDouble: SetError( SbxERR_NOTIMP ); } // Date with "+" or "-" needs special handling that - // forces the Date type ( except if lhs AND rhs are already - // Date types - if( ( eOp == SbxPLUS || eOp == SbxMINUS )&& ( ( GetType() == SbxDATE || rOp.GetType() == SbxDATE )&& ( GetType() != rOp.GetType() ) ) ) - aL.eType = SbxDATE; + // forces the Date type. If the operation is '+' the + // result is always a Date, if '-' the result is only + // a Date if one of lhs or rhs ( but not both ) is already + // a Date + if( ( GetType() == SbxDATE || rOp.GetType() == SbxDATE ) ) + { + if( eOp == SbxPLUS || ( ( eOp == SbxMINUS ) && ( GetType() != rOp.GetType() ) ) ) + aL.eType = SbxDATE; + } } } |