diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2010-05-11 11:26:34 +0200 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2010-05-11 11:26:34 +0200 |
commit | a8697ca9b4f3c5a1915304e6dbe638012d506ce7 (patch) | |
tree | 4fe26403842f1261cbea4b4122fe1bfc34957441 /basic | |
parent | 16257d5d011e4b8a95f6942407fc2d6ca9af2607 (diff) | |
parent | 1aad112dd03e02bc531d509d1f1b6fba2cd7f314 (diff) |
CWS-TOOLING: integrate CWS npower14miscfixes
Diffstat (limited to 'basic')
-rwxr-xr-x[-rw-r--r--] | basic/source/classes/sb.cxx | 26 | ||||
-rw-r--r-- | basic/source/classes/sbunoobj.cxx | 38 |
2 files changed, 54 insertions, 10 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 86850d9991c6..094568e7f0b2 100644..100755 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -54,6 +54,7 @@ #include "sb.hrc" #include <basrid.hxx> #include <vos/mutex.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> // #pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE ) @@ -63,11 +64,34 @@ 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; SbxObject* StarBASIC::getVBAGlobals( ) { if ( !pVBAGlobals ) - pVBAGlobals = (SbUnoObject*)Find( String(RTL_CONSTASCII_USTRINGPARAM("VBAGlobals")), SbxCLASS_DONTCARE ); +// pVBAGlobals = (SbUnoObject*)Find( String(RTL_CONSTASCII_USTRINGPARAM("VBAGlobals")), SbxCLASS_DONTCARE ); + { + 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 0e8928bc6c1a..1c95b4f30de6 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -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() ); |