[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - basic/source

Noel Power noel.power at novell.com
Fri Mar 15 14:54:19 PDT 2013


 basic/source/runtime/step0.cxx |   43 ++++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 11 deletions(-)

New commits:
commit ee6dc201a084c5ec0e7eea65736376757530db44
Author: Noel Power <noel.power at novell.com>
Date:   Mon Mar 11 11:28:18 2013 +0000

    bnc#805071 fix object assigment problems when default members present
    
    Change-Id: I6f7dfd369a36aff06f15b9a3affadb9d19787a9c
    (cherry picked from commit d06f4577b52df5f390809850f26663e2e62d0ff1)
    Reviewed-on: https://gerrit.libreoffice.org/2756
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 2388722..9229d61 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -448,13 +448,26 @@ void SbiRuntime::StepPUT()
     // could equate to Range("A1").Value = 34
     if ( bVBAEnabled )
     {
-        if ( refVar->GetType() == SbxOBJECT  )
+        // yet more hacking at this, I feel we don't quite have the correct
+        // heuristics for dealing with obj1 = obj2 ( where obj2 ( and maybe
+        // obj1 ) has default member/property ) ) It seems that default props
+        // aren't dealt with if the object is a member of some parent object
+        bool bObjAssign = false;
+        if ( refVar->GetType() == SbxEMPTY )
+            refVar->Broadcast( SBX_HINT_DATAWANTED );
+        if ( refVar->GetType() == SbxOBJECT )
         {
-            SbxVariable* pDflt = getDefaultProp( refVar );
-            if ( pDflt )
-                refVar = pDflt;
+            if  ( refVar->IsA( TYPE(SbxMethod) ) || ! refVar->GetParent() )
+            {
+                SbxVariable* pDflt = getDefaultProp( refVar );
+
+                if ( pDflt )
+                    refVar = pDflt;
+            }
+            else
+                bObjAssign = true;
         }
-        if (  refVal->GetType() == SbxOBJECT  )
+        if (  refVal->GetType() == SbxOBJECT  && !bObjAssign && ( refVal->IsA( TYPE(SbxMethod) ) || ! refVal->GetParent() ) )
         {
             SbxVariable* pDflt = getDefaultProp( refVal );
             if ( pDflt )
@@ -588,16 +601,24 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
         {
             // get default properties for lhs & rhs where necessary
             // SbxVariable* defaultProp = NULL; unused variable
-            bool bLHSHasDefaultProp = false;
             // LHS try determine if a default prop exists
+            // again like in StepPUT (see there too ) we are tweaking the
+            // heursitics again for when to assign an object reference or
+            // use default memebers if they exists
+            // #FIXME we really need to get to the bottom of this mess
+            bool bObjAssign = false;
             if ( refVar->GetType() == SbxOBJECT )
             {
-                SbxVariable* pDflt = getDefaultProp( refVar );
-                if ( pDflt )
+                if ( refVar->IsA( TYPE(SbxMethod) ) || ! refVar->GetParent() )
                 {
-                    refVar = pDflt;
-                    bLHSHasDefaultProp = true;
+                    SbxVariable* pDflt = getDefaultProp( refVar );
+                    if ( pDflt )
+                    {
+                        refVar = pDflt;
+                    }
                 }
+                else
+                    bObjAssign = true;
             }
             // RHS only get a default prop is the rhs has one
             if (  refVal->GetType() == SbxOBJECT )
@@ -617,7 +638,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
                     pObj = PTR_CAST(SbxObject,pObjVarObj);
                 }
                 SbxVariable* pDflt = NULL;
-                if ( pObj || bLHSHasDefaultProp )
+                if ( pObj && !bObjAssign )
                 {
                     // lhs is either a valid object || or has a defaultProp
                     pDflt = getDefaultProp( refVal );


More information about the Libreoffice-commits mailing list