diff options
Diffstat (limited to 'svx/source/unodialogs')
6 files changed, 83 insertions, 35 deletions
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx index bfb4240d74e4..6993716536d7 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx @@ -60,6 +60,19 @@ DictionaryList::DictionaryList(SvSimpleTableContainer& rParent, WinBits nBits) { } +DictionaryList::~DictionaryList() +{ + disposeOnce(); +} + +void DictionaryList::dispose() +{ + m_pED_Term.clear(); + m_pED_Mapping.clear(); + m_pLB_Property.clear(); + SvSimpleTable::dispose(); +} + OUString DictionaryList::getPropertyTypeName( sal_Int16 nConversionPropertyType ) const { if(!m_pLB_Property || !m_pLB_Property->GetEntryCount()) @@ -449,10 +462,10 @@ ChineseDictionaryDialog::ChineseDictionaryDialog( vcl::Window* pParent ) get(mpToSimplifiedContainer, "tradtosimpleview"); mpToSimplifiedContainer->set_height_request(mpToSimplifiedContainer->GetTextHeight() * 8); - m_pCT_DictionaryToSimplified = new DictionaryList(*mpToSimplifiedContainer, 0); + m_pCT_DictionaryToSimplified = VclPtr<DictionaryList>::Create(*mpToSimplifiedContainer, 0); get(mpToTraditionalContainer, "simpletotradview"); mpToTraditionalContainer->set_height_request(mpToTraditionalContainer->GetTextHeight() * 8); - m_pCT_DictionaryToTraditional = new DictionaryList(*mpToTraditionalContainer, 0); + m_pCT_DictionaryToTraditional = VclPtr<DictionaryList>::Create(*mpToTraditionalContainer, 0); SvtLinguConfig aLngCfg; bool bValue; @@ -542,9 +555,29 @@ ChineseDictionaryDialog::ChineseDictionaryDialog( vcl::Window* pParent ) ChineseDictionaryDialog::~ChineseDictionaryDialog() { + disposeOnce(); +} + +void ChineseDictionaryDialog::dispose() +{ m_xContext=0; - delete m_pCT_DictionaryToSimplified; - delete m_pCT_DictionaryToTraditional; + m_pCT_DictionaryToSimplified.disposeAndClear(); + m_pCT_DictionaryToTraditional.disposeAndClear(); + m_pRB_To_Simplified.clear(); + m_pRB_To_Traditional.clear(); + m_pCB_Reverse.clear(); + m_pFT_Term.clear(); + m_pED_Term.clear(); + m_pFT_Mapping.clear(); + m_pED_Mapping.clear(); + m_pFT_Property.clear(); + m_pLB_Property.clear(); + mpToSimplifiedContainer.clear(); + mpToTraditionalContainer.clear(); + m_pPB_Add.clear(); + m_pPB_Modify.clear(); + m_pPB_Delete.clear(); + ModalDialog::dispose(); } void ChineseDictionaryDialog::setDirectionAndTextConversionOptions( bool bDirectionToSimplified, sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ ) diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx index 97cef0a2ff33..50498b4d5d91 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx @@ -61,6 +61,8 @@ class DictionaryList : public SvSimpleTable { public: DictionaryList(SvSimpleTableContainer& rParent, WinBits nBits); + virtual ~DictionaryList(); + virtual void dispose() SAL_OVERRIDE; void init(const css::uno::Reference< css::linguistic2::XConversionDictionary>& xDictionary, vcl::Window *pED_Term, vcl::Window *pED_Mapping, ListBox *pLB_Property, @@ -99,9 +101,9 @@ public: css::uno::Reference<css::linguistic2::XConversionDictionary> m_xDictionary; private: - vcl::Window* m_pED_Term; - vcl::Window* m_pED_Mapping; - ListBox* m_pLB_Property; + VclPtr<vcl::Window> m_pED_Term; + VclPtr<vcl::Window> m_pED_Mapping; + VclPtr<ListBox> m_pLB_Property; std::vector< DictionaryEntry* > m_aToBeDeleted; @@ -113,6 +115,7 @@ class ChineseDictionaryDialog : public ModalDialog public: ChineseDictionaryDialog( vcl::Window* pParent ); virtual ~ChineseDictionaryDialog(); + virtual void dispose() SAL_OVERRIDE; //this method should be called once before calling execute void setDirectionAndTextConversionOptions( bool bDirectionToSimplified, sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ ); @@ -146,28 +149,28 @@ private: private: sal_Int32 m_nTextConversionOptions; //i18n::TextConversionOption - RadioButton* m_pRB_To_Simplified; - RadioButton* m_pRB_To_Traditional; + VclPtr<RadioButton> m_pRB_To_Simplified; + VclPtr<RadioButton> m_pRB_To_Traditional; - CheckBox* m_pCB_Reverse; + VclPtr<CheckBox> m_pCB_Reverse; - FixedText* m_pFT_Term; - Edit* m_pED_Term; + VclPtr<FixedText> m_pFT_Term; + VclPtr<Edit> m_pED_Term; - FixedText* m_pFT_Mapping; - Edit* m_pED_Mapping; + VclPtr<FixedText> m_pFT_Mapping; + VclPtr<Edit> m_pED_Mapping; - FixedText* m_pFT_Property; - ListBox* m_pLB_Property; + VclPtr<FixedText> m_pFT_Property; + VclPtr<ListBox> m_pLB_Property; - SvSimpleTableContainer* mpToSimplifiedContainer; - DictionaryList* m_pCT_DictionaryToSimplified; - SvSimpleTableContainer* mpToTraditionalContainer; - DictionaryList* m_pCT_DictionaryToTraditional; + VclPtr<SvSimpleTableContainer> mpToSimplifiedContainer; + VclPtr<DictionaryList> m_pCT_DictionaryToSimplified; + VclPtr<SvSimpleTableContainer> mpToTraditionalContainer; + VclPtr<DictionaryList> m_pCT_DictionaryToTraditional; - PushButton* m_pPB_Add; - PushButton* m_pPB_Modify; - PushButton* m_pPB_Delete; + VclPtr<PushButton> m_pPB_Add; + VclPtr<PushButton> m_pPB_Modify; + VclPtr<PushButton> m_pPB_Delete; css::uno::Reference<css::uno::XComponentContext> m_xContext; }; diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx index 0de8dbbf73cf..58f8a1faddad 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx @@ -58,8 +58,7 @@ void ChineseTranslation_UnoDialog::impl_DeleteDialog() { if(m_pDialog->IsInExecute()) m_pDialog->EndDialog(RET_CANCEL); - delete m_pDialog; - m_pDialog = 0; + m_pDialog.disposeAndClear(); } } @@ -137,7 +136,7 @@ sal_Int16 SAL_CALL ChineseTranslation_UnoDialog::execute() throw(uno::RuntimeExc pParent = pImplementation->GetWindow(); } uno::Reference< XComponent > xComp( this ); - m_pDialog = new ChineseTranslationDialog( pParent ); + m_pDialog = VclPtr<ChineseTranslationDialog>::Create( pParent ); } if( !m_pDialog ) return nRet; diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx index 5349c555c332..9c39681f77f8 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx @@ -29,6 +29,7 @@ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/implbase5.hxx> +#include <vcl/vclptr.hxx> namespace textconversiondlgs @@ -121,7 +122,7 @@ private: com::sun::star::uno::Reference< com::sun::star::awt::XWindow > m_xParentWindow; - ChineseTranslationDialog* m_pDialog; + VclPtr<ChineseTranslationDialog> m_pDialog; bool m_bDisposed; ///Dispose call ready. bool m_bInDispose;///In dispose call diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx index 8dec51d66809..faa63755f7b2 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx @@ -63,12 +63,23 @@ ChineseTranslationDialog::ChineseTranslationDialog( vcl::Window* pParent ) ChineseTranslationDialog::~ChineseTranslationDialog() { + disposeOnce(); +} + +void ChineseTranslationDialog::dispose() +{ if(m_pDictionaryDialog) { if(m_pDictionaryDialog->IsInExecute()) m_pDictionaryDialog->EndDialog(); - delete m_pDictionaryDialog; } + m_pDictionaryDialog.disposeAndClear(); + m_pRB_To_Simplified.clear(); + m_pRB_To_Traditional.clear(); + m_pCB_Translate_Commonterms.clear(); + m_pPB_Editterms.clear(); + m_pBP_OK.clear(); + ModalDialog::dispose(); } void ChineseTranslationDialog::getSettings( bool& rbDirectionToSimplified @@ -96,7 +107,7 @@ IMPL_LINK_NOARG(ChineseTranslationDialog, DictionaryHdl) { if( !m_pDictionaryDialog ) { - m_pDictionaryDialog = new ChineseDictionaryDialog(this); + m_pDictionaryDialog = VclPtr<ChineseDictionaryDialog>::Create(this); } if( m_pDictionaryDialog ) { diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx index 5e1f0909d9f2..0ec0bf32f2be 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx @@ -39,6 +39,7 @@ class ChineseTranslationDialog : public ModalDialog public: ChineseTranslationDialog( vcl::Window* pParent ); virtual ~ChineseTranslationDialog(); + virtual void dispose() SAL_OVERRIDE; void getSettings( bool& rbDirectionToSimplified , bool& rbTranslateCommonTerms ) const; @@ -50,15 +51,15 @@ private: void impl_UpdateVariantsCheckBox(); private: - RadioButton* m_pRB_To_Simplified; - RadioButton* m_pRB_To_Traditional; + VclPtr<RadioButton> m_pRB_To_Simplified; + VclPtr<RadioButton> m_pRB_To_Traditional; - CheckBox* m_pCB_Translate_Commonterms; - PushButton* m_pPB_Editterms; + VclPtr<CheckBox> m_pCB_Translate_Commonterms; + VclPtr<PushButton> m_pPB_Editterms; - OKButton* m_pBP_OK; + VclPtr<OKButton> m_pBP_OK; - ChineseDictionaryDialog* m_pDictionaryDialog; + VclPtr<ChineseDictionaryDialog> m_pDictionaryDialog; }; |