From 90e983df7b79d9022e24926d770298227becb342 Mon Sep 17 00:00:00 2001 From: August Sodora Date: Fri, 20 Jan 2012 20:23:06 -0500 Subject: Use a smart pointer here instead --- basctl/source/basicide/basicbox.cxx | 2 +- basctl/source/basicide/baside3.cxx | 2 +- basctl/source/basicide/basides1.cxx | 2 +- basctl/source/basicide/basidesh.cxx | 8 +------- basctl/source/dlged/managelang.cxx | 9 ++------- basctl/source/inc/basidesh.hxx | 4 ++-- basctl/source/inc/managelang.hxx | 8 ++++---- 7 files changed, 12 insertions(+), 23 deletions(-) (limited to 'basctl') diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx index c1975007ee2a..cb568700f128 100644 --- a/basctl/source/basicide/basicbox.cxx +++ b/basctl/source/basicide/basicbox.cxx @@ -424,7 +424,7 @@ void BasicLanguageBox::FillBox() m_sCurrentText = GetSelectEntry(); ClearBox(); - LocalizationMgr* pCurMgr = BasicIDEGlobals::GetShell()->GetCurLocalizationMgr(); + boost::shared_ptr pCurMgr(BasicIDEGlobals::GetShell()->GetCurLocalizationMgr()); if ( pCurMgr->isLibraryLocalized() ) { Enable(); diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 55e72c9c7270..7db5434d3b74 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -1152,7 +1152,7 @@ sal_Bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const bool bCopyResourcesForDialog = true; if( bAddDialogLanguagesToLib ) { - LocalizationMgr* pCurMgr = pIDEShell->GetCurLocalizationMgr(); + boost::shared_ptr pCurMgr = pIDEShell->GetCurLocalizationMgr(); lang::Locale aFirstLocale; aFirstLocale = aOnlyInImportLanguages[0]; diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index bcf4006ce9e7..f404f37c83fe 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -1024,7 +1024,7 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) else { ::rtl::OUString aItemStr; - LocalizationMgr* pCurMgr = GetCurLocalizationMgr(); + boost::shared_ptr pCurMgr(GetCurLocalizationMgr()); if ( pCurMgr->isLibraryLocalized() ) { Sequence< lang::Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales(); diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 4aabe0037ac0..8458625a9324 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -206,8 +206,6 @@ void BasicIDEShell::Init() pObjectCatalog = 0; bCreatingWindow = sal_False; - m_pCurLocalizationMgr = NULL; - pTabBar = new BasicIDETabBar( &GetViewFrame()->GetWindow() ); pTabBar->SetSplitHdl( LINK( this, BasicIDEShell, TabBarSplitHdl ) ); bTabBarSplitted = sal_False; @@ -245,8 +243,6 @@ BasicIDEShell::~BasicIDEShell() SetWindow( 0 ); SetCurWindow( 0 ); - delete m_pCurLocalizationMgr; - IDEBaseWindow* pWin = aIDEWindowTable.First(); while ( pWin ) { @@ -1014,7 +1010,6 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, ::rtl::OUString void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, ::rtl::OUString aLibName ) { // Create LocalizationMgr - delete m_pCurLocalizationMgr; Reference< resource::XStringResourceManager > xStringResourceManager; try { @@ -1026,9 +1021,8 @@ void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, : } catch (const container::NoSuchElementException& ) {} - m_pCurLocalizationMgr = new LocalizationMgr - ( this, rDocument, aLibName, xStringResourceManager ); + m_pCurLocalizationMgr = boost::shared_ptr(new LocalizationMgr(this, rDocument, aLibName, xStringResourceManager)); m_pCurLocalizationMgr->handleTranslationbar(); } diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx index d41ed42fcda3..eb16d60cab63 100644 --- a/basctl/source/dlged/managelang.cxx +++ b/basctl/source/dlged/managelang.cxx @@ -85,10 +85,8 @@ namespace { } } -ManageLanguageDialog::ManageLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ) : - +ManageLanguageDialog::ManageLanguageDialog( Window* pParent, boost::shared_ptr _pLMgr ) : ModalDialog( pParent, IDEResId( RID_DLG_MANAGE_LANGUAGE ) ), - m_aLanguageFT ( this, IDEResId( FT_LANGUAGE ) ), m_aLanguageLB ( this, IDEResId( LB_LANGUAGE ) ), m_aAddPB ( this, IDEResId( PB_ADD_LANG ) ), @@ -290,10 +288,9 @@ IMPL_LINK( ManageLanguageDialog, SelectHdl, ListBox *, EMPTYARG ) // class SetDefaultLanguageDialog ----------------------------------------------- -SetDefaultLanguageDialog::SetDefaultLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ) : +SetDefaultLanguageDialog::SetDefaultLanguageDialog( Window* pParent, boost::shared_ptr _pLMgr ) : ModalDialog( pParent, IDEResId( RID_DLG_SETDEF_LANGUAGE ) ), - m_aLanguageFT ( this, IDEResId( FT_DEF_LANGUAGE ) ), m_pLanguageLB ( new SvxLanguageBox( this, IDEResId( LB_DEF_LANGUAGE ) ) ), m_pCheckLangLB ( NULL ), @@ -302,9 +299,7 @@ SetDefaultLanguageDialog::SetDefaultLanguageDialog( Window* pParent, Localizatio m_aOKBtn ( this, IDEResId( PB_DEF_OK ) ), m_aCancelBtn ( this, IDEResId( PB_DEF_CANCEL ) ), m_aHelpBtn ( this, IDEResId( PB_DEF_HELP ) ), - m_pLocalizationMgr( _pLMgr ) - { if ( m_pLocalizationMgr->isLibraryLocalized() ) { diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index 0f09c455ee52..3f1b757df62b 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -85,7 +85,7 @@ friend class LocalizationMgr; IDEBaseWindow* pCurWin; ScriptDocument m_aCurDocument; ::rtl::OUString m_aCurLibName; - LocalizationMgr* m_pCurLocalizationMgr; + boost::shared_ptr m_pCurLocalizationMgr; ScrollBar aHScrollBar; ScrollBar aVScrollBar; @@ -177,7 +177,7 @@ public: GetCurDocument() const { return m_aCurDocument; } const ::rtl::OUString& GetCurLibName() const { return m_aCurLibName; } ObjectCatalog* GetObjectCatalog() const { return pObjectCatalog; } - LocalizationMgr* GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; } + boost::shared_ptr GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; } ScrollBar& GetHScrollBar() { return aHScrollBar; } ScrollBar& GetVScrollBar() { return aVScrollBar; } diff --git a/basctl/source/inc/managelang.hxx b/basctl/source/inc/managelang.hxx index f9f9dba62617..3ff9db6fe324 100644 --- a/basctl/source/inc/managelang.hxx +++ b/basctl/source/inc/managelang.hxx @@ -68,7 +68,7 @@ private: HelpButton m_aHelpBtn; OKButton m_aCloseBtn; - LocalizationMgr* m_pLocalizationMgr; + boost::shared_ptr m_pLocalizationMgr; ::rtl::OUString m_sDefLangStr; ::rtl::OUString m_sDeleteStr; @@ -85,7 +85,7 @@ private: DECL_LINK( SelectHdl, ListBox * ); public: - ManageLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ); + ManageLanguageDialog( Window* pParent, boost::shared_ptr _pLMgr ); ~ManageLanguageDialog(); }; @@ -103,13 +103,13 @@ private: HelpButton m_aHelpBtn; bool m_bIsDefaultMode; - LocalizationMgr* m_pLocalizationMgr; + boost::shared_ptr m_pLocalizationMgr; void FillLanguageBox(); void CalcInfoSize(); public: - SetDefaultLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ); + SetDefaultLanguageDialog( Window* pParent, boost::shared_ptr _pLMgr ); ~SetDefaultLanguageDialog(); ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > GetLocales() const; -- cgit