summaryrefslogtreecommitdiff
path: root/basic/source/classes
diff options
context:
space:
mode:
authorDaniel Rentz <dr@openoffice.org>2010-05-21 10:11:51 +0200
committerDaniel Rentz <dr@openoffice.org>2010-05-21 10:11:51 +0200
commit36bbd6d57e843d558ee89a59ea990d3afadda718 (patch)
tree0bd24ba46b24a776f7f40e3e55689804e6847cb0 /basic/source/classes
parent9e090f35c699eb8fcec6ba0d385bd76b76c744b5 (diff)
parentff494dca2e13bfb2cc35b7d65a178e6093af9842 (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.cxx23
-rw-r--r--[-rwxr-xr-x]basic/source/classes/sbunoobj.cxx52
2 files changed, 59 insertions, 16 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 3bc3b455ef..3e20519125 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 1ded922eff..1d5fc7086d 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 );
}