From 68a55b78362209fb6244ed31e23042af60c39c85 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Tue, 24 Jan 2012 12:27:19 +0000 Subject: 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) --- basic/source/sbx/sbxvalue.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'basic') 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; + } } } -- cgit v1.2.3