summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2013-03-15 17:11:16 +0000
committerNoel Power <noel.power@suse.com>2013-03-15 17:24:12 +0000
commitc90373f98e91dba112bdf76d3bf223528845cdf0 (patch)
treec4626791fe315e53b0753b1d6ea283226f38680f /basic
parent5fbc90a6e277fc038b8c3a1c86360556dc9c0069 (diff)
detect follow-on default member of default member object bnc#809017
Change-Id: I366c049fc342240081957b81d2f28bfcf8d4e331
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/sbunoobj.cxx4
-rw-r--r--basic/source/runtime/step2.cxx25
2 files changed, 29 insertions, 0 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 703b280a396f..b10d00c63d8f 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -296,6 +296,10 @@ SbUnoObject* createOLEObject_Impl( const OUString& aType )
Any aAny;
aAny <<= xOLEObject;
pUnoObj = new SbUnoObject( aType, aAny );
+ ::rtl::OUString sDfltPropName;
+
+ if ( SbUnoObject::getDefaultPropName( pUnoObj, sDfltPropName ) )
+ pUnoObj->SetDfltProperty( sDfltPropName );
}
}
return pUnoObj;
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index f6fa096ce511..a66b568a3b2f 100644
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -43,6 +43,7 @@ using com::sun::star::uno::Reference;
SbxVariable* getVBAConstant( const OUString& rName );
+SbxVariable* getDefaultProp( SbxVariable* pRef );
// the bits in the String-ID:
// 0x8000 - Argv is reserved
@@ -606,6 +607,30 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
}
else
{
+ // check if there isn't a default member between the current variable
+ // and the params, e.g.
+ // Dim rst1 As New ADODB.Recordset
+ // "
+ // val = rst1("FirstName")
+ // has the default 'Fields' member between rst1 and '("FirstName")'
+ SbxVariable* pDflt = getDefaultProp( pElem );
+ if ( pDflt )
+ {
+ pDflt->Broadcast( SBX_HINT_DATAWANTED );
+ SbxBaseRef pObj = (SbxBase*)pDflt->GetObject();
+ if( pObj )
+ {
+ if( pObj->ISA(SbUnoObject) )
+ {
+ pUnoObj = (SbUnoObject*)(SbxBase*)pObj;
+ Any aAny = pUnoObj->getUnoAny();
+
+ if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE )
+ x = *(Reference< XInterface >*)aAny.getValue();
+ pElem = pDflt;
+ }
+ }
+ }
OUString sDefaultMethod;
Reference< XDefaultMethod > xDfltMethod( x, UNO_QUERY );