diff options
Diffstat (limited to 'sc/source/ui/docshell/docsh.cxx')
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index d5d7f6e09292..e7089349fdb7 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -72,7 +72,6 @@ #include <com/sun/star/task/XJob.hpp> #include <basic/sbstar.hxx> #include <basic/basmgr.hxx> -#include <vbahelper/vbaaccesshelper.hxx> #include "scabstdlg.hxx" //CHINA001 #include <sot/formats.hxx> @@ -554,6 +553,13 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) xVbaEvents->processVbaEvent( WORKBOOK_AFTERSAVE, aArgs ); } break; + case SFX_EVENT_CLOSEDOC: + { + // #163655# prevent event processing after model is disposed + aDocument.SetVbaEventProcessor( uno::Reference< script::vba::XVBAEventProcessor >() ); + uno::Reference< lang::XEventListener >( xVbaEvents, uno::UNO_QUERY_THROW )->disposing( lang::EventObject() ); + } + break; } } } @@ -619,25 +625,6 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) SetReadOnlyUI( sal_True ); } } - - // VBA specific initialization - if( aDocument.IsInVBAMode() ) try - { - uno::Reference< frame::XModel > xModel( GetModel(), uno::UNO_SET_THROW ); - - // create VBAGlobals object if not yet done (this also creates the "ThisExcelDoc" symbol) - uno::Reference< lang::XMultiServiceFactory > xFactory( xModel, uno::UNO_QUERY_THROW ); - xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) ); - - // create the VBA document event processor - uno::Sequence< uno::Any > aArgs( 1 ); - aArgs[ 0 ] <<= xModel; - xVbaEvents.set( ooo::vba::createVBAUnoAPIServiceWithArgs( this, "com.sun.star.script.vba.VBASpreadsheetEventProcessor" , aArgs ), uno::UNO_QUERY ); - aDocument.SetVbaEventProcessor( xVbaEvents ); - } - catch( uno::Exception& ) - { - } } break; case SFX_EVENT_VIEWCREATED: |