diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-08-22 08:50:56 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-08-22 08:50:56 +0200 |
commit | 8a08ddd7371024db9a0cb901e956b5ba4bd40a06 (patch) | |
tree | adac78712957f32d619d95ca71afe1a802b4532f | |
parent | 10b6bda51c9da5429ca562c70ce75ee03e5f4e56 (diff) |
No need to own SfxBasicManagerHolder by pointer in SfxObjectShell_Impl
Change-Id: I55da464ef1d3381fb51949a349f844dbd7da49eb
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/inc/objshimp.hxx | 5 |
3 files changed, 17 insertions, 18 deletions
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 7de53491e514..6e8b659ff0a2 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1060,13 +1060,13 @@ bool SfxObjectShell::DoSave() GetBasicManager(); // disconnect from the current storage - pImp->pBasicManager->setStorage( xTmpStorage ); + pImp->aBasicManager.setStorage( xTmpStorage ); // store to the current storage - pImp->pBasicManager->storeLibrariesToStorage( GetMedium()->GetStorage() ); + pImp->aBasicManager.storeLibrariesToStorage( GetMedium()->GetStorage() ); // connect to the current storage back - pImp->pBasicManager->setStorage( GetMedium()->GetStorage() ); + pImp->aBasicManager.setStorage( GetMedium()->GetStorage() ); } catch( uno::Exception& ) { @@ -1858,7 +1858,7 @@ bool SfxObjectShell::ConnectTmpStorage_Impl( if ( bResult ) { - pImp->pBasicManager->setStorage( xTmpStorage ); + pImp->aBasicManager.setStorage( xTmpStorage ); // Get rid of this workaround after issue i113914 is fixed try @@ -2014,7 +2014,7 @@ bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) // TODO/LATER: may be this code will be replaced, but not sure // Set storage in document library containers - pImp->pBasicManager->setStorage( xStorage ); + pImp->aBasicManager.setStorage( xStorage ); // Get rid of this workaround after issue i113914 is fixed try @@ -3097,7 +3097,7 @@ bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium ) GetBasicManager(); // Save dialog/script container - pImp->pBasicManager->storeLibrariesToStorage( xStorage ); + pImp->aBasicManager.storeLibrariesToStorage( xStorage ); } #endif return SaveAs( rMedium ); @@ -3632,12 +3632,12 @@ bool SfxObjectShell::QuerySaveSizeExceededModules_Impl( const uno::Reference< ta if ( !HasBasic() ) return true; - if ( !pImp->pBasicManager->isValid() ) + if ( !pImp->aBasicManager.isValid() ) GetBasicManager(); uno::Sequence< OUString > sModules; if ( xHandler.is() ) { - if( pImp->pBasicManager->LegacyPsswdBinaryLimitExceeded( sModules ) ) + if( pImp->aBasicManager.LegacyPsswdBinaryLimitExceeded( sModules ) ) { ModuleSizeExceeded* pReq = new ModuleSizeExceeded( sModules ); uno::Reference< task::XInteractionRequest > xReq( pReq ); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 409ce93bb900..2b4112bb4945 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -205,7 +205,6 @@ TYPEINIT1(SfxObjectShell, SfxShell); SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) :mpObjectContainer(0) - ,pBasicManager( new SfxBasicManagerHolder ) ,rDocShell( _rDocShell ) ,aMacroMode( *this ) ,pProgress( 0) @@ -276,7 +275,6 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) SfxObjectShell_Impl::~SfxObjectShell_Impl() { - delete pBasicManager; } @@ -364,7 +362,7 @@ SfxObjectShell::~SfxObjectShell() pSfxApp->ReleaseIndex(pImp->nVisualDocumentNumber); // Destroy Basic-Manager - pImp->pBasicManager->reset( NULL ); + pImp->aBasicManager.reset( NULL ); if ( pSfxApp->GetDdeService() ) pSfxApp->RemoveDdeTopic( this ); @@ -688,7 +686,7 @@ namespace { if ( !_rDocument.Get_Impl()->bBasicInitialized ) const_cast< SfxObjectShell& >( _rDocument ).InitBasicManager_Impl(); - return _rDocument.Get_Impl()->pBasicManager->get(); + return _rDocument.Get_Impl()->aBasicManager.get(); } // assume we do not have Basic ourself, but we can refer to another @@ -749,7 +747,7 @@ bool SfxObjectShell::HasBasic() const if ( !pImp->bBasicInitialized ) const_cast< SfxObjectShell* >( this )->InitBasicManager_Impl(); - return pImp->pBasicManager->isValid(); + return pImp->aBasicManager.isValid(); #endif } @@ -876,16 +874,16 @@ void SfxObjectShell::InitBasicManager_Impl() Basic managers is the global BasicManagerRepository instance. */ #ifndef DISABLE_SCRIPTING - DBG_ASSERT( !pImp->bBasicInitialized && !pImp->pBasicManager->isValid(), "Lokaler BasicManager bereits vorhanden"); + DBG_ASSERT( !pImp->bBasicInitialized && !pImp->aBasicManager.isValid(), "Lokaler BasicManager bereits vorhanden"); try { - pImp->pBasicManager->reset( BasicManagerRepository::getDocumentBasicManager( GetModel() ) ); + pImp->aBasicManager.reset( BasicManagerRepository::getDocumentBasicManager( GetModel() ) ); } catch (const css::ucb::ContentCreationException& e) { SAL_WARN("sfx.doc", "caught exception " << e.Message); } - DBG_ASSERT( pImp->pBasicManager->isValid(), "SfxObjectShell::InitBasicManager_Impl: did not get a BasicManager!" ); + DBG_ASSERT( pImp->aBasicManager.isValid(), "SfxObjectShell::InitBasicManager_Impl: did not get a BasicManager!" ); pImp->bBasicInitialized = true; #endif } diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index a32e4f373f0b..ff3f2b31f2e0 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -31,6 +31,8 @@ #include <sfx2/docmacromode.hxx> #include "bitset.hxx" +#include <appbaslib.hxx> + namespace svtools { class AsynchronLink; } class SfxViewFrame; @@ -46,8 +48,7 @@ class SfxBasicManagerHolder; struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess { ::comphelper::EmbeddedObjectContainer* mpObjectContainer; - SfxBasicManagerHolder* - pBasicManager; + SfxBasicManagerHolder aBasicManager; SfxObjectShell& rDocShell; ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer > xBasicLibraries; |