[PATCH libreoffice-4-0] detect follow-on default member of default member object bnc...
Noel Power (via Code Review)
gerrit at gerrit.libreoffice.org
Fri Mar 15 10:27:55 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/2758
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/58/2758/1
detect follow-on default member of default member object bnc#809017
Change-Id: I366c049fc342240081957b81d2f28bfcf8d4e331
---
M basic/source/classes/sbunoobj.cxx
M basic/source/runtime/step2.cxx
2 files changed, 29 insertions(+), 0 deletions(-)
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 @@
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 @@
SbxVariable* getVBAConstant( const OUString& rName );
+SbxVariable* getDefaultProp( SbxVariable* pRef );
// the bits in the String-ID:
// 0x8000 - Argv is reserved
@@ -606,6 +607,30 @@
}
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 );
--
To view, visit https://gerrit.libreoffice.org/2758
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I366c049fc342240081957b81d2f28bfcf8d4e331
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