Kaydet (Commit) 90e983df authored tarafından August Sodora's avatar August Sodora

Use a smart pointer here instead

üst e0d20cbd
...@@ -424,7 +424,7 @@ void BasicLanguageBox::FillBox() ...@@ -424,7 +424,7 @@ void BasicLanguageBox::FillBox()
m_sCurrentText = GetSelectEntry(); m_sCurrentText = GetSelectEntry();
ClearBox(); ClearBox();
LocalizationMgr* pCurMgr = BasicIDEGlobals::GetShell()->GetCurLocalizationMgr(); boost::shared_ptr<LocalizationMgr> pCurMgr(BasicIDEGlobals::GetShell()->GetCurLocalizationMgr());
if ( pCurMgr->isLibraryLocalized() ) if ( pCurMgr->isLibraryLocalized() )
{ {
Enable(); Enable();
......
...@@ -1152,7 +1152,7 @@ sal_Bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const ...@@ -1152,7 +1152,7 @@ sal_Bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const
bool bCopyResourcesForDialog = true; bool bCopyResourcesForDialog = true;
if( bAddDialogLanguagesToLib ) if( bAddDialogLanguagesToLib )
{ {
LocalizationMgr* pCurMgr = pIDEShell->GetCurLocalizationMgr(); boost::shared_ptr<LocalizationMgr> pCurMgr = pIDEShell->GetCurLocalizationMgr();
lang::Locale aFirstLocale; lang::Locale aFirstLocale;
aFirstLocale = aOnlyInImportLanguages[0]; aFirstLocale = aOnlyInImportLanguages[0];
......
...@@ -1024,7 +1024,7 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) ...@@ -1024,7 +1024,7 @@ void BasicIDEShell::GetState(SfxItemSet &rSet)
else else
{ {
::rtl::OUString aItemStr; ::rtl::OUString aItemStr;
LocalizationMgr* pCurMgr = GetCurLocalizationMgr(); boost::shared_ptr<LocalizationMgr> pCurMgr(GetCurLocalizationMgr());
if ( pCurMgr->isLibraryLocalized() ) if ( pCurMgr->isLibraryLocalized() )
{ {
Sequence< lang::Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales(); Sequence< lang::Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales();
......
...@@ -206,8 +206,6 @@ void BasicIDEShell::Init() ...@@ -206,8 +206,6 @@ void BasicIDEShell::Init()
pObjectCatalog = 0; pObjectCatalog = 0;
bCreatingWindow = sal_False; bCreatingWindow = sal_False;
m_pCurLocalizationMgr = NULL;
pTabBar = new BasicIDETabBar( &GetViewFrame()->GetWindow() ); pTabBar = new BasicIDETabBar( &GetViewFrame()->GetWindow() );
pTabBar->SetSplitHdl( LINK( this, BasicIDEShell, TabBarSplitHdl ) ); pTabBar->SetSplitHdl( LINK( this, BasicIDEShell, TabBarSplitHdl ) );
bTabBarSplitted = sal_False; bTabBarSplitted = sal_False;
...@@ -245,8 +243,6 @@ BasicIDEShell::~BasicIDEShell() ...@@ -245,8 +243,6 @@ BasicIDEShell::~BasicIDEShell()
SetWindow( 0 ); SetWindow( 0 );
SetCurWindow( 0 ); SetCurWindow( 0 );
delete m_pCurLocalizationMgr;
IDEBaseWindow* pWin = aIDEWindowTable.First(); IDEBaseWindow* pWin = aIDEWindowTable.First();
while ( pWin ) while ( pWin )
{ {
...@@ -1014,7 +1010,6 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, ::rtl::OUString ...@@ -1014,7 +1010,6 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, ::rtl::OUString
void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, ::rtl::OUString aLibName ) void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, ::rtl::OUString aLibName )
{ {
// Create LocalizationMgr // Create LocalizationMgr
delete m_pCurLocalizationMgr;
Reference< resource::XStringResourceManager > xStringResourceManager; Reference< resource::XStringResourceManager > xStringResourceManager;
try try
{ {
...@@ -1026,9 +1021,8 @@ void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, : ...@@ -1026,9 +1021,8 @@ void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, :
} }
catch (const container::NoSuchElementException& ) catch (const container::NoSuchElementException& )
{} {}
m_pCurLocalizationMgr = new LocalizationMgr
( this, rDocument, aLibName, xStringResourceManager );
m_pCurLocalizationMgr = boost::shared_ptr<LocalizationMgr>(new LocalizationMgr(this, rDocument, aLibName, xStringResourceManager));
m_pCurLocalizationMgr->handleTranslationbar(); m_pCurLocalizationMgr->handleTranslationbar();
} }
......
...@@ -85,10 +85,8 @@ namespace { ...@@ -85,10 +85,8 @@ namespace {
} }
} }
ManageLanguageDialog::ManageLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ) : ManageLanguageDialog::ManageLanguageDialog( Window* pParent, boost::shared_ptr<LocalizationMgr> _pLMgr ) :
ModalDialog( pParent, IDEResId( RID_DLG_MANAGE_LANGUAGE ) ), ModalDialog( pParent, IDEResId( RID_DLG_MANAGE_LANGUAGE ) ),
m_aLanguageFT ( this, IDEResId( FT_LANGUAGE ) ), m_aLanguageFT ( this, IDEResId( FT_LANGUAGE ) ),
m_aLanguageLB ( this, IDEResId( LB_LANGUAGE ) ), m_aLanguageLB ( this, IDEResId( LB_LANGUAGE ) ),
m_aAddPB ( this, IDEResId( PB_ADD_LANG ) ), m_aAddPB ( this, IDEResId( PB_ADD_LANG ) ),
...@@ -290,10 +288,9 @@ IMPL_LINK( ManageLanguageDialog, SelectHdl, ListBox *, EMPTYARG ) ...@@ -290,10 +288,9 @@ IMPL_LINK( ManageLanguageDialog, SelectHdl, ListBox *, EMPTYARG )
// class SetDefaultLanguageDialog ----------------------------------------------- // class SetDefaultLanguageDialog -----------------------------------------------
SetDefaultLanguageDialog::SetDefaultLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ) : SetDefaultLanguageDialog::SetDefaultLanguageDialog( Window* pParent, boost::shared_ptr<LocalizationMgr> _pLMgr ) :
ModalDialog( pParent, IDEResId( RID_DLG_SETDEF_LANGUAGE ) ), ModalDialog( pParent, IDEResId( RID_DLG_SETDEF_LANGUAGE ) ),
m_aLanguageFT ( this, IDEResId( FT_DEF_LANGUAGE ) ), m_aLanguageFT ( this, IDEResId( FT_DEF_LANGUAGE ) ),
m_pLanguageLB ( new SvxLanguageBox( this, IDEResId( LB_DEF_LANGUAGE ) ) ), m_pLanguageLB ( new SvxLanguageBox( this, IDEResId( LB_DEF_LANGUAGE ) ) ),
m_pCheckLangLB ( NULL ), m_pCheckLangLB ( NULL ),
...@@ -302,9 +299,7 @@ SetDefaultLanguageDialog::SetDefaultLanguageDialog( Window* pParent, Localizatio ...@@ -302,9 +299,7 @@ SetDefaultLanguageDialog::SetDefaultLanguageDialog( Window* pParent, Localizatio
m_aOKBtn ( this, IDEResId( PB_DEF_OK ) ), m_aOKBtn ( this, IDEResId( PB_DEF_OK ) ),
m_aCancelBtn ( this, IDEResId( PB_DEF_CANCEL ) ), m_aCancelBtn ( this, IDEResId( PB_DEF_CANCEL ) ),
m_aHelpBtn ( this, IDEResId( PB_DEF_HELP ) ), m_aHelpBtn ( this, IDEResId( PB_DEF_HELP ) ),
m_pLocalizationMgr( _pLMgr ) m_pLocalizationMgr( _pLMgr )
{ {
if ( m_pLocalizationMgr->isLibraryLocalized() ) if ( m_pLocalizationMgr->isLibraryLocalized() )
{ {
......
...@@ -85,7 +85,7 @@ friend class LocalizationMgr; ...@@ -85,7 +85,7 @@ friend class LocalizationMgr;
IDEBaseWindow* pCurWin; IDEBaseWindow* pCurWin;
ScriptDocument m_aCurDocument; ScriptDocument m_aCurDocument;
::rtl::OUString m_aCurLibName; ::rtl::OUString m_aCurLibName;
LocalizationMgr* m_pCurLocalizationMgr; boost::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr;
ScrollBar aHScrollBar; ScrollBar aHScrollBar;
ScrollBar aVScrollBar; ScrollBar aVScrollBar;
...@@ -177,7 +177,7 @@ public: ...@@ -177,7 +177,7 @@ public:
GetCurDocument() const { return m_aCurDocument; } GetCurDocument() const { return m_aCurDocument; }
const ::rtl::OUString& GetCurLibName() const { return m_aCurLibName; } const ::rtl::OUString& GetCurLibName() const { return m_aCurLibName; }
ObjectCatalog* GetObjectCatalog() const { return pObjectCatalog; } ObjectCatalog* GetObjectCatalog() const { return pObjectCatalog; }
LocalizationMgr* GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; } boost::shared_ptr<LocalizationMgr> GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; }
ScrollBar& GetHScrollBar() { return aHScrollBar; } ScrollBar& GetHScrollBar() { return aHScrollBar; }
ScrollBar& GetVScrollBar() { return aVScrollBar; } ScrollBar& GetVScrollBar() { return aVScrollBar; }
......
...@@ -68,7 +68,7 @@ private: ...@@ -68,7 +68,7 @@ private:
HelpButton m_aHelpBtn; HelpButton m_aHelpBtn;
OKButton m_aCloseBtn; OKButton m_aCloseBtn;
LocalizationMgr* m_pLocalizationMgr; boost::shared_ptr<LocalizationMgr> m_pLocalizationMgr;
::rtl::OUString m_sDefLangStr; ::rtl::OUString m_sDefLangStr;
::rtl::OUString m_sDeleteStr; ::rtl::OUString m_sDeleteStr;
...@@ -85,7 +85,7 @@ private: ...@@ -85,7 +85,7 @@ private:
DECL_LINK( SelectHdl, ListBox * ); DECL_LINK( SelectHdl, ListBox * );
public: public:
ManageLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ); ManageLanguageDialog( Window* pParent, boost::shared_ptr<LocalizationMgr> _pLMgr );
~ManageLanguageDialog(); ~ManageLanguageDialog();
}; };
...@@ -103,13 +103,13 @@ private: ...@@ -103,13 +103,13 @@ private:
HelpButton m_aHelpBtn; HelpButton m_aHelpBtn;
bool m_bIsDefaultMode; bool m_bIsDefaultMode;
LocalizationMgr* m_pLocalizationMgr; boost::shared_ptr<LocalizationMgr> m_pLocalizationMgr;
void FillLanguageBox(); void FillLanguageBox();
void CalcInfoSize(); void CalcInfoSize();
public: public:
SetDefaultLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ); SetDefaultLanguageDialog( Window* pParent, boost::shared_ptr<LocalizationMgr> _pLMgr );
~SetDefaultLanguageDialog(); ~SetDefaultLanguageDialog();
::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > GetLocales() const; ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > GetLocales() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment