diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-03-06 18:52:05 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-03-06 18:52:05 +0000 |
commit | b7c3701fed59f9f0a5e0fb9a5e339c4c256afad7 (patch) | |
tree | 0c42db689e75deedc3de4279de256f679a31640e /sfx2 | |
parent | 802c3b6ae6c50a0d96c90528fe698ef09bbac497 (diff) |
INTEGRATION: CWS odbmacros2 (1.126.2); FILE MERGED
2008/03/04 12:11:41 fs 1.126.2.5: RESYNC: (1.127-1.128); FILE MERGED
2008/02/04 13:15:33 fs 1.126.2.4: RESYNC: (1.126-1.127); FILE MERGED
2007/12/19 14:51:25 fs 1.126.2.3: #i49133# BasicManager::Insert/set/ResetGlobalUNOConstant superseded by SetGlobalUNOConstant
2007/12/12 22:00:16 fs 1.126.2.2: properly reset ThisComponent
2007/12/12 14:42:32 fs 1.126.2.1: #i49133# condensed the ThisComponent handling, by using new helpers at the BasicManager
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appuno.cxx | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index fd0a56fe4f02..cc587436ddc7 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -4,9 +4,9 @@ * * $RCSfile: appuno.cxx,v $ * - * $Revision: 1.128 $ + * $Revision: 1.129 $ * - * last change: $Author: obo $ $Date: 2008-02-26 15:05:30 $ + * last change: $Author: kz $ $Date: 2008-03-06 19:52:05 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -1769,8 +1769,6 @@ void SAL_CALL SfxMacroLoader::removeStatusListener( { } -extern ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar ); - // ----------------------------------------------------------------------- ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star::uno::Any& rRetval, SfxObjectShell* pSh ) throw ( ::com::sun::star::uno::RuntimeException ) @@ -1879,8 +1877,7 @@ ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star:: aQuotedArgs += ')'; } - SbxBaseRef xOldVar; - StarBASIC* pBas = NULL; + Any aOldThisComponent; if ( pSh ) { if ( pBasMgr != pAppMgr ) @@ -1888,25 +1885,8 @@ ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star:: pSh->SetMacroMode_Impl( TRUE ); if ( pBasMgr == pAppMgr ) { - // document is executed via AppBASIC, adjust "ThisComponent" variable - pBas = pAppMgr->GetLib(0); - SbxVariable *pCompVar = pBas->Find( DEFINE_CONST_UNICODE("ThisComponent"), SbxCLASS_OBJECT ); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - xInterface ( pSh->GetModel() , ::com::sun::star::uno::UNO_QUERY ); - ::com::sun::star::uno::Any aAny; - aAny <<= xInterface; - if ( pCompVar ) - { - xOldVar = pCompVar->GetObject(); - pCompVar->PutObject( GetSbUnoObject( DEFINE_CONST_UNICODE("ThisComponent"), aAny ) ); - } - else - { - SbxObjectRef xUnoObj = GetSbUnoObject( DEFINE_CONST_UNICODE("ThisComponent"), aAny ); - xUnoObj->SetFlag( SBX_DONTSTORE ); - pBas->Insert( xUnoObj ); - pCompVar = pBas->Find( DEFINE_CONST_UNICODE("ThisComponent"), SbxCLASS_OBJECT ); - } + // document is executed via AppBASIC, adjust ThisComponent variable + aOldThisComponent = pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pSh->GetModel() ) ); } } @@ -1933,12 +1913,9 @@ ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star:: } nErr = SbxBase::GetError(); - if ( pBas ) + if ( ( pBasMgr == pAppMgr ) && pSh ) { - SbxVariable *pCompVar = pBas->Find( DEFINE_CONST_UNICODE("ThisComponent"), SbxCLASS_OBJECT ); - // reset "ThisComponent" to prior value - if( pCompVar ) - pCompVar->PutObject( xOldVar ); + pAppMgr->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent ); } if ( pSh && pSh->GetModel().is() ) |