From 9d3ae8930790c4a9afc10995fd9a2dd5a4b2b4ba Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Tue, 24 Aug 2010 16:59:15 +0200 Subject: mib19: enable document event handling in workbooks created via VBA symbol Workbooks.Add --- sc/source/ui/docshell/docsh.cxx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'sc/source/ui/docshell') diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index d5d7f6e09292..9e98d7430d96 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -72,7 +72,6 @@ #include #include #include -#include #include "scabstdlg.hxx" //CHINA001 #include @@ -625,15 +624,9 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) { uno::Reference< frame::XModel > xModel( GetModel(), uno::UNO_SET_THROW ); - // create VBAGlobals object if not yet done (this also creates the "ThisExcelDoc" symbol) + // create VBAGlobals object if not yet done (this also creates the "ThisExcelDoc" symbol and the event processor) 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& ) { -- cgit From 70f55868b448b1e04130fac5552b1476bb564c80 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 2 Sep 2010 16:24:32 +0200 Subject: mib19: #163525# handle missing codenames in XLS files --- sc/source/ui/docshell/docfunc.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sc/source/ui/docshell') diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 36b6641d94a6..27112d8c62c2 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2650,8 +2650,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 ); -- cgit From 3df871eb91f28bdbc8ee07ee5d2f31643d8d4bb4 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Tue, 14 Sep 2010 19:10:26 +0200 Subject: mib19: #163566# compare cursor position in ScDocFunc::NotifyInputHandler --- sc/source/ui/docshell/docfunc.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sc/source/ui/docshell') diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 27112d8c62c2..adbe26abf157 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()); -- cgit From 3024512c90d8660d35d4824471c436d68aa62241 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 17 Sep 2010 19:32:15 +0200 Subject: mib19: #163664# text values for VBA range Value property must be parsed (always English) --- sc/source/ui/docshell/docfunc.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sc/source/ui/docshell') diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index adbe26abf157..02dbc7546a38 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -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 ); -- cgit From edd423387c36fa561dc34ccc43097aac58813a9a Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Mon, 20 Sep 2010 20:50:44 +0200 Subject: mib19: #163655# do not fire events when document is disposed --- sc/source/ui/docshell/docsh.cxx | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'sc/source/ui/docshell') diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 9e98d7430d96..e7089349fdb7 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -553,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; } } } @@ -618,19 +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 and the event processor) - uno::Reference< lang::XMultiServiceFactory > xFactory( xModel, uno::UNO_QUERY_THROW ); - xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) ); - } - catch( uno::Exception& ) - { - } } break; case SFX_EVENT_VIEWCREATED: -- cgit