diff options
author | Daniel Rentz <dr@openoffice.org> | 2010-05-21 10:11:51 +0200 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2010-05-21 10:11:51 +0200 |
commit | 87523ea7109b044939ff51bb481aad00171c2e3a (patch) | |
tree | f4451a2a1db327b942d0f18df9211d474c061f97 /basic/source/classes | |
parent | cff39a2614347c6db8ae1a214947d90a3ea57000 (diff) | |
parent | 2f4bff8415b28e36346872157104eb71322a743a (diff) |
npower13_objectmodules: rebase and merge with DEV300_m78
Diffstat (limited to 'basic/source/classes')
-rwxr-xr-x[-rw-r--r--] | basic/source/classes/sb.cxx | 23 | ||||
-rw-r--r--[-rwxr-xr-x] | basic/source/classes/sbunoobj.cxx | 52 |
2 files changed, 59 insertions, 16 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 233b181757f0..47ef141632c3 100644..100755 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -55,6 +55,7 @@ #include "sb.hrc" #include <basrid.hxx> #include <vos/mutex.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/script/ModuleType.hpp> #include <com/sun/star/script/ModuleInfo.hpp> @@ -68,6 +69,10 @@ TYPEINIT1(StarBASIC,SbxObject) #define RTLNAME "@SBRTL" // i#i68894# +using com::sun::star::uno::Reference; +using com::sun::star::uno::Any; +using com::sun::star::uno::UNO_QUERY; +using com::sun::star::lang::XMultiServiceFactory; const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") ); const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) ); @@ -75,7 +80,25 @@ const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) ); SbxObject* StarBASIC::getVBAGlobals( ) { if ( !pVBAGlobals ) + { + Any aThisDoc; + if ( GetUNOConstant("ThisComponent", aThisDoc) ) + { + Reference< XMultiServiceFactory > xDocFac( aThisDoc, UNO_QUERY ); + if ( xDocFac.is() ) + { + try + { + xDocFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) ); + } + catch( Exception& ) + { + // Ignore + } + } + } pVBAGlobals = (SbUnoObject*)Find( aVBAHook , SbxCLASS_DONTCARE ); + } return pVBAGlobals; } diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 1e278bf583a7..1c95b4f30de6 100755..100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -112,9 +112,9 @@ typedef WeakImplHelper1< XAllListener > BasicAllListenerHelper; // Identifier fuer die dbg_-Properies als Strings anlegen -static String ID_DBG_SUPPORTEDINTERFACES( RTL_CONSTASCII_USTRINGPARAM("Dbg_SupportedInterfaces") ); -static String ID_DBG_PROPERTIES( RTL_CONSTASCII_USTRINGPARAM("Dbg_Properties") ); -static String ID_DBG_METHODS( RTL_CONSTASCII_USTRINGPARAM("Dbg_Methods") ); +static char const ID_DBG_SUPPORTEDINTERFACES[] = "Dbg_SupportedInterfaces"; +static char const ID_DBG_PROPERTIES[] = "Dbg_Properties"; +static char const ID_DBG_METHODS[] = "Dbg_Methods"; static ::rtl::OUString aSeqLevelStr( RTL_CONSTASCII_USTRINGPARAM("[]") ); static ::rtl::OUString defaultNameSpace( RTL_CONSTASCII_USTRINGPARAM("ooo.vba") ); @@ -139,16 +139,19 @@ bool SbUnoObject::getDefaultPropName( SbUnoObject* pUnoObj, String& sDfltProp ) SbxVariable* getDefaultProp( SbxVariable* pRef ) { SbxVariable* pDefaultProp = NULL; - SbxObject* pObj = PTR_CAST(SbxObject,(SbxVariable*) pRef); - if ( !pObj ) + if ( pRef->GetType() == SbxOBJECT ) { - SbxBase* pObjVarObj = pRef->GetObject(); - pObj = PTR_CAST(SbxObject,pObjVarObj); - } - if ( pObj && pObj->ISA(SbUnoObject) ) - { - SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*)pObj); - pDefaultProp = pUnoObj->GetDfltProperty(); + SbxObject* pObj = PTR_CAST(SbxObject,(SbxVariable*) pRef); + if ( !pObj ) + { + SbxBase* pObjVarObj = pRef->GetObject(); + pObj = PTR_CAST(SbxObject,pObjVarObj); + } + if ( pObj && pObj->ISA(SbUnoObject) ) + { + SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*)pObj); + pDefaultProp = pUnoObj->GetDfltProperty(); + } } return pDefaultProp; } @@ -1601,6 +1604,23 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, break; } ::rtl::OUString sClassName = xClass->getName(); + if ( sClassName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.oleautomation.XAutomationObject" ) ) ) ) + { + // there is a hack in the extensions/source/ole/oleobj.cxx to return the typename of the automation object, lets check if it + // matches + Reference< XInvocation > xInv( aToInspectObj, UNO_QUERY ); + if ( xInv.is() ) + { + rtl::OUString sTypeName; + xInv->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$GetTypeName") ) ) >>= sTypeName; + if ( sTypeName.getLength() == 0 || sTypeName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IDispatch") ) ) ) + // can't check type, leave it pass + result = true; + else + result = sTypeName.equals( aClass ); + } + break; // finished checking automation object + } OSL_TRACE("Checking if object implements %s", OUStringToOString( defaultNameSpace + aClass, RTL_TEXTENCODING_UTF8 ).getStr() ); @@ -1630,7 +1650,7 @@ String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj ) String aRet; if( eType != TypeClass_INTERFACE ) { - aRet += ID_DBG_SUPPORTEDINTERFACES; + aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM(ID_DBG_SUPPORTEDINTERFACES) ); aRet.AppendAscii( " not available.\n(TypeClass is not TypeClass_INTERFACE)\n" ); } else @@ -2653,15 +2673,15 @@ void SbUnoObject::implCreateDbgProperties( void ) Property aProp; // Id == -1: Implementierte Interfaces gemaess ClassProvider anzeigen - SbxVariableRef xVarRef = new SbUnoProperty( ID_DBG_SUPPORTEDINTERFACES, SbxSTRING, aProp, -1, false ); + SbxVariableRef xVarRef = new SbUnoProperty( String(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_SUPPORTEDINTERFACES)), SbxSTRING, aProp, -1, false ); QuickInsert( (SbxVariable*)xVarRef ); // Id == -2: Properties ausgeben - xVarRef = new SbUnoProperty( ID_DBG_PROPERTIES, SbxSTRING, aProp, -2, false ); + xVarRef = new SbUnoProperty( String(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_PROPERTIES)), SbxSTRING, aProp, -2, false ); QuickInsert( (SbxVariable*)xVarRef ); // Id == -3: Methoden ausgeben - xVarRef = new SbUnoProperty( ID_DBG_METHODS, SbxSTRING, aProp, -3, false ); + xVarRef = new SbUnoProperty( String(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_METHODS)), SbxSTRING, aProp, -3, false ); QuickInsert( (SbxVariable*)xVarRef ); } |