From b46dab973c91c3a94bcda188a9888fef3fd16426 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Fri, 25 Mar 2011 10:40:25 +0100 Subject: calcvba: #164410# improve VBA compatibility implementation in various areas: Excel symbols, MSForms symbols, document and forms event handling --- scripting/source/dlgprov/dlgevtatt.cxx | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'scripting') diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx index 6c3694ea237d..ab2b52ae7d55 100644 --- a/scripting/source/dlgprov/dlgevtatt.cxx +++ b/scripting/source/dlgprov/dlgevtatt.cxx @@ -45,14 +45,13 @@ #include #include #include +#include #include #include #include #include #include -#include -#include using namespace ::com::sun::star; using namespace ::com::sun::star::awt; @@ -175,19 +174,17 @@ namespace dlgprov // handler for Script & ::rtl::OUString::createFromAscii( "vnd.sun.star.UNO:" ) listernersForTypes[ rtl::OUString::createFromAscii("vnd.sun.star.UNO") ] = new DialogUnoScriptListenerImpl( rxContext, rxModel, rxControl, rxHandler, rxIntrospect, bProviderMode ); listernersForTypes[ rtl::OUString::createFromAscii("vnd.sun.star.script") ] = new DialogSFScriptListenerImpl( rxContext, rxModel ); - // Note: in a future cws ( npower13_ObjectModule ) it will be possible - // to determine the vba mode from the basiclibrary container, the tunnel hack - // below can then be replaced - SfxObjectShell* pFoundShell = NULL; - if ( rxModel.is() ) + + // determine the VBA compatibility mode from the Basic library container + try + { + uno::Reference< beans::XPropertySet > xModelProps( rxModel, uno::UNO_QUERY_THROW ); + uno::Reference< script::vba::XVBACompatibility > xVBACompat( + xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) ), uno::UNO_QUERY_THROW ); + mbUseFakeVBAEvents = xVBACompat->getVBACompatibilityMode(); + } + catch( uno::Exception& ) { - uno::Reference< lang::XUnoTunnel > xObjShellTunnel( rxModel, uno::UNO_QUERY ); - if ( xObjShellTunnel.is() ) - { - pFoundShell = reinterpret_cast( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId())); - if ( pFoundShell ) - mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell ); - } } if ( mbUseFakeVBAEvents ) listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel ); -- cgit