diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-12-05 19:29:07 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-12-05 19:29:07 +0100 |
commit | e1593452b25bbfd9e61a73f69a4d50aa4c28510b (patch) | |
tree | 3123590defc1c25847be4ce61a9f5e5b1074260d /sc/source/ui/docshell/docsh2.cxx | |
parent | 95619e5c6332e7ac36282f2bc0390d34c138779f (diff) | |
parent | 8c30146af0e6d4fbdb731eae01dbf47661e788ae (diff) |
merge to m67
Diffstat (limited to 'sc/source/ui/docshell/docsh2.cxx')
-rw-r--r-- | sc/source/ui/docshell/docsh2.cxx | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx index 9ac98af7b043..386ac8528cec 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,25 @@ 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 ); + // Fake ThisComponent being setup by Activate ( which is a view + // related thing ), + // a) if another document is opened then in theory ThisComponent + // will be reset as before, + // b) when this document is 'really' Activated then ThisComponent + // again will be set as before + // The only wrinkle seems if this document is loaded 'InVisible' + // but.. I don't see that this is possible from the vba API + // I could be wrong though + // 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( "ThisExcelDoc", aArgs[ 0 ] ); return bRet; } |