[PATCH libreoffice-4-0] bnc#805071 fix object assigment problems when default member...

Noel Power (via Code Review) gerrit at gerrit.libreoffice.org
Fri Mar 15 10:27:16 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2756

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/56/2756/1

bnc#805071 fix object assigment problems when default members present

Change-Id: I6f7dfd369a36aff06f15b9a3affadb9d19787a9c
(cherry picked from commit d06f4577b52df5f390809850f26663e2e62d0ff1)
---
M basic/source/runtime/step0.cxx
1 file changed, 32 insertions(+), 11 deletions(-)



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 @@
     // 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 @@
         {
             // 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 @@
                     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 );

-- 
To view, visit https://gerrit.libreoffice.org/2756
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f7dfd369a36aff06f15b9a3affadb9d19787a9c
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Noel Power <noel.power at suse.com>



More information about the LibreOffice mailing list