diff options
author | Noel Power <npower@openoffice.org> | 2009-09-29 14:47:18 +0000 |
---|---|---|
committer | Noel Power <npower@openoffice.org> | 2009-09-29 14:47:18 +0000 |
commit | 4aa9c65e8853a300c0da1ef2e7f544d4ca927359 (patch) | |
tree | 89f8bda1e93948ff4d742ae0867a9511a5ef3ecd /sc/source | |
parent | ed107e6366ffec1352046998ec9c0f815ece4b53 (diff) |
tweak VBAGlobals creation/insertion, also restore overwritten visibility
controls bits to moved ( erm delete and created in another director )
file. Add missing bits to enable Application.Quit and use preprocessor
to include some uncompiled code
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/filter/excel/excimp8.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 18 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh2.cxx | 13 |
3 files changed, 22 insertions, 25 deletions
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index a3de34afacdc..6e307e0a354d 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -266,23 +266,9 @@ void ImportExcel8::ReadBasic( void ) bool bLoadStrg = pFilterOpt->IsLoadExcelBasicStorage(); if( bLoadCode || bLoadStrg ) { - uno::Any aGlobs; - uno::Sequence< uno::Any > aArgs(1); - aArgs[ 0 ] <<= pShell->GetModel(); - aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "ooo.vba.excel.Globals"), aArgs ); - pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs ); SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg ); - bool bAsComment = !bLoadExecutable || !aGlobs.hasValue(); + bool bAsComment = !bLoadExecutable; aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment ); - // There may be implications setting the current component - // too early :-/ so I will just manually set the Basic Variables - BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); - if ( pAppMgr ) - pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pShell->GetModel() ) ); - { - uno::Any aModel = uno::makeAny( pShell->GetModel() ); - pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aModel ); - } } } } diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index df7cb24e605f..0dbde19943be 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -360,15 +360,15 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet) else aDocument.SetInsertingFromOtherDoc( FALSE ); // add vba globals ( if they are availabl ) - SfxObjectShell* pShell = aDocument.GetDocumentShell(); - if ( pShell ) - { - uno::Any aGlobs; - uno::Sequence< uno::Any > aArgs(1); - aArgs[ 0 ] <<= pShell->GetModel(); - aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs ); - pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs ); - } + uno::Any aGlobs; + uno::Sequence< uno::Any > aArgs(1); + aArgs[ 0 ] <<= GetModel(); + aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs ); + GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs ); + BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); + if ( pAppMgr ) + pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] ); + aDocument.SetImportingXML( FALSE ); aDocument.EnableExecuteLink( true ); aDocument.EnableUndo( TRUE ); diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx index 7f213175a075..c79be9cb978b 100644 --- a/sc/source/ui/docshell/docsh2.cxx +++ b/sc/source/ui/docshell/docsh2.cxx @@ -53,7 +53,10 @@ #include <svx/unolingu.hxx> #include <rtl/logfile.hxx> - +#include <comphelper/processfactory.hxx> +#include <basic/sbstar.hxx> +#include <basic/basmgr.hxx> +#include <sfx2/app.hxx> // INCLUDE --------------------------------------------------------------- /* @@ -102,6 +105,14 @@ BOOL __EXPORT ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xSt InitItems(); CalcOutputFactor(); + uno::Any aGlobs; + uno::Sequence< uno::Any > aArgs(1); + aArgs[ 0 ] <<= GetModel(); + aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs ); + GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs ); + BasicManager* pAppMgr = SFX_APP()->GetBasicManager(); + if ( pAppMgr ) + pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] ); return bRet; } |