[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - basic/source
Noel Power
noel.power at suse.com
Fri Mar 15 14:57:30 PDT 2013
basic/source/classes/sbunoobj.cxx | 4 ++++
basic/source/runtime/step2.cxx | 25 +++++++++++++++++++++++++
2 files changed, 29 insertions(+)
New commits:
commit dd59a0a039fe4bd509d5fe456e7d6ea865bb307e
Author: Noel Power <noel.power at suse.com>
Date: Fri Mar 15 17:11:16 2013 +0000
detect follow-on default member of default member object bnc#809017
Change-Id: I366c049fc342240081957b81d2f28bfcf8d4e331
Reviewed-on: https://gerrit.libreoffice.org/2758
Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 4ac95f0..9267909 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 0f6c07bd..cc2fff5 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 );
More information about the Libreoffice-commits
mailing list