summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2013-03-11 11:28:18 +0000
committerFridrich Strba <fridrich@documentfoundation.org>2013-03-15 21:53:54 +0000
commitee6dc201a084c5ec0e7eea65736376757530db44 (patch)
tree944b4fde0bb2a622e807877111416b0595fc323e /basic
parent41c5f5205a8e4155b34800064640b07caf79780f (diff)
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@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/step0.cxx43
1 files changed, 32 insertions, 11 deletions
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 2388722acbe5..9229d61ad6b9 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 );