[Libreoffice-commits] .: basic/source

Noel Power noelp at kemper.freedesktop.org
Tue Jan 24 04:30:06 PST 2012


 basic/source/sbx/sbxvalue.cxx |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 68a55b78362209fb6244ed31e23042af60c39c85
Author: Noel Power <noel.power at novell.com>
Date:   Tue Jan 24 12:27:19 2012 +0000

    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)

diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index e67335c..f4aab28 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;
+                    }
 
                 }
             }


More information about the Libreoffice-commits mailing list