diff options
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 27 |
2 files changed, 16 insertions, 25 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index fc8ba28a217e..038d0a72e824 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -851,13 +851,13 @@ BOOL ScDocFunc::PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, BOOL bApi return TRUE; } -void ScDocFunc::NotifyInputHandler( const ScAddress& /* rPos */ ) +void ScDocFunc::NotifyInputHandler( const ScAddress& rPos ) { ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); if ( pViewSh && pViewSh->GetViewData()->GetDocShell() == &rDocShell ) { ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(); - if ( pInputHdl ) + if ( pInputHdl && pInputHdl->GetCursorPos() == rPos ) { sal_Bool bIsEditMode(pInputHdl->IsEditMode()); @@ -986,7 +986,7 @@ ScTokenArray* lcl_ScDocFunc_CreateTokenArrayXML( const String& rText, const Stri ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos, - const String& rText, const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar ) + const String& rText, const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar, short* pRetFormatType ) { ScDocument* pDoc = rDocShell.GetDocument(); ScBaseCell* pNewCell = NULL; @@ -1020,7 +1020,12 @@ ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos, sal_uInt32 nEnglish = pFormatter->GetStandardIndex(LANGUAGE_ENGLISH_US); double fVal; if ( pFormatter->IsNumberFormat( rText, nEnglish, fVal ) ) + { pNewCell = new ScValueCell( fVal ); + // return the format type from the English format, so a localized format can be created + if ( pRetFormatType ) + *pRetFormatType = pFormatter->GetType( nEnglish ); + } else if ( rText.Len() ) pNewCell = ScBaseCell::CreateTextCell( rText, pDoc ); @@ -2650,8 +2655,7 @@ void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, String& sModuleName, String uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY ); if ( xVBAModuleInfo.is() ) { - String sCodeName( genModuleName ); - rDoc.SetCodeName( nTab, sCodeName ); + rDoc.SetCodeName( nTab, genModuleName ); script::ModuleInfo sModuleInfo = lcl_InitModuleInfo( rDocSh, genModuleName ); xVBAModuleInfo->insertModuleInfo( genModuleName, sModuleInfo ); xLib->insertByName( genModuleName, aSourceAny ); 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: |