fix runtime error when using extended types
note: using VBA objects with the code completion is not possible at the moment. Unfortunately there is some hard coded hacks for flattening the namespace used by checkUnoObject. Change-Id: Ic3a3149f41a6959943e71fa7ac22ff4dab7f30a1
This commit is contained in:
@@ -67,6 +67,7 @@
|
|||||||
#include <com/sun/star/bridge/oleautomation/Currency.hpp>
|
#include <com/sun/star/bridge/oleautomation/Currency.hpp>
|
||||||
#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
|
#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
|
||||||
#include <com/sun/star/script/XAutomationInvocation.hpp>
|
#include <com/sun/star/script/XAutomationInvocation.hpp>
|
||||||
|
#include "basic/codecompletecache.hxx"
|
||||||
|
|
||||||
using com::sun::star::uno::Reference;
|
using com::sun::star::uno::Reference;
|
||||||
using namespace com::sun::star::uno;
|
using namespace com::sun::star::uno;
|
||||||
@@ -1731,16 +1732,24 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, const OUString& rClass )
|
|||||||
which matches the interface names 'ooo.vba.excel.XWorkbooks' or
|
which matches the interface names 'ooo.vba.excel.XWorkbooks' or
|
||||||
'ooo.vba.msforms.XLabel'.
|
'ooo.vba.msforms.XLabel'.
|
||||||
*/
|
*/
|
||||||
OUString aClassName( "." );
|
OUString aClassName;
|
||||||
sal_Int32 nClassNameDot = rClass.lastIndexOf( '.' );
|
if ( SbiRuntime::isVBAEnabled() )
|
||||||
if( nClassNameDot >= 0 )
|
|
||||||
{
|
{
|
||||||
aClassName += rClass.copy( 0, nClassNameDot + 1 ) + "X" + rClass.copy( nClassNameDot + 1 );
|
aClassName = ".";
|
||||||
}
|
sal_Int32 nClassNameDot = rClass.lastIndexOf( '.' );
|
||||||
else
|
if( nClassNameDot >= 0 )
|
||||||
{
|
{
|
||||||
aClassName += "X" + rClass;
|
aClassName += rClass.copy( 0, nClassNameDot + 1 ) + OUString( sal_Unicode( 'X' ) ) + rClass.copy( nClassNameDot + 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aClassName += OUString( sal_Unicode( 'X' ) ) + rClass;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else // assume extended type declaration support for basic ( can't get here
|
||||||
|
// otherwise.
|
||||||
|
aClassName = rClass;
|
||||||
|
|
||||||
Sequence< Type > aTypeSeq = xTypeProvider->getTypes();
|
Sequence< Type > aTypeSeq = xTypeProvider->getTypes();
|
||||||
const Type* pTypeArray = aTypeSeq.getConstArray();
|
const Type* pTypeArray = aTypeSeq.getConstArray();
|
||||||
sal_uInt32 nIfaceCount = aTypeSeq.getLength();
|
sal_uInt32 nIfaceCount = aTypeSeq.getLength();
|
||||||
@@ -1779,7 +1788,7 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, const OUString& rClass )
|
|||||||
|
|
||||||
// match interface name with passed class name
|
// match interface name with passed class name
|
||||||
OSL_TRACE("Checking if object implements %s", OUStringToOString( aClassName, RTL_TEXTENCODING_UTF8 ).getStr() );
|
OSL_TRACE("Checking if object implements %s", OUStringToOString( aClassName, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||||
if ( (aClassName.getLength() < aInterfaceName.getLength()) &&
|
if ( (aClassName.getLength() <= aInterfaceName.getLength()) &&
|
||||||
aInterfaceName.matchIgnoreAsciiCase( aClassName, aInterfaceName.getLength() - aClassName.getLength() ) )
|
aInterfaceName.matchIgnoreAsciiCase( aClassName, aInterfaceName.getLength() - aClassName.getLength() ) )
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
|
@@ -64,6 +64,7 @@
|
|||||||
#include "sb.hrc"
|
#include "sb.hrc"
|
||||||
#include "sbintern.hxx"
|
#include "sbintern.hxx"
|
||||||
#include "sbunoobj.hxx"
|
#include "sbunoobj.hxx"
|
||||||
|
#include "basic/codecompletecache.hxx"
|
||||||
|
|
||||||
using com::sun::star::uno::Reference;
|
using com::sun::star::uno::Reference;
|
||||||
|
|
||||||
@@ -3264,7 +3265,7 @@ bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
|
|||||||
{
|
{
|
||||||
if( !implIsClass( pObj, aClass ) )
|
if( !implIsClass( pObj, aClass ) )
|
||||||
{
|
{
|
||||||
if ( bVBAEnabled && pObj->IsA( TYPE(SbUnoObject) ) )
|
if ( ( bVBAEnabled || CodeCompleteOptions::IsExtendedTypeDeclaration() ) && pObj->IsA( TYPE(SbUnoObject) ) )
|
||||||
{
|
{
|
||||||
SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pObj);
|
SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pObj);
|
||||||
bOk = checkUnoObjectType( pUnoObj, aClass );
|
bOk = checkUnoObjectType( pUnoObj, aClass );
|
||||||
|
Reference in New Issue
Block a user