diff options
Diffstat (limited to 'formula/source/ui/dlg')
-rw-r--r-- | formula/source/ui/dlg/ControlHelper.hxx | 19 | ||||
-rw-r--r-- | formula/source/ui/dlg/formula.cxx | 72 | ||||
-rw-r--r-- | formula/source/ui/dlg/funcpage.cxx | 12 | ||||
-rw-r--r-- | formula/source/ui/dlg/funcpage.hxx | 6 | ||||
-rw-r--r-- | formula/source/ui/dlg/funcutl.cxx | 69 | ||||
-rw-r--r-- | formula/source/ui/dlg/parawin.cxx | 26 | ||||
-rw-r--r-- | formula/source/ui/dlg/parawin.hxx | 51 | ||||
-rw-r--r-- | formula/source/ui/dlg/structpg.cxx | 11 | ||||
-rw-r--r-- | formula/source/ui/dlg/structpg.hxx | 4 |
9 files changed, 181 insertions, 89 deletions
diff --git a/formula/source/ui/dlg/ControlHelper.hxx b/formula/source/ui/dlg/ControlHelper.hxx index 4c7e56420c22..aba773361dcf 100644 --- a/formula/source/ui/dlg/ControlHelper.hxx +++ b/formula/source/ui/dlg/ControlHelper.hxx @@ -29,7 +29,7 @@ class EditBox : public Control { private: - MultiLineEdit* pMEdit; + VclPtr<MultiLineEdit> pMEdit; Link aSelChangedLink; Selection aOldSel; bool bMouseFlag; @@ -48,6 +48,7 @@ public: EditBox( vcl::Window* pParent, WinBits nBits ); virtual ~EditBox(); + virtual void dispose() SAL_OVERRIDE; MultiLineEdit* GetEdit() {return pMEdit;} @@ -64,6 +65,8 @@ class ArgEdit : public RefEdit { public: ArgEdit( vcl::Window* pParent, WinBits nBits ); + virtual ~ArgEdit(); + virtual void dispose() SAL_OVERRIDE; void Init( ArgEdit* pPrevEdit, ArgEdit* pNextEdit, ScrollBar& rArgSlider, sal_uInt16 nArgCount ); @@ -72,9 +75,9 @@ protected: virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; private: - ArgEdit* pEdPrev; - ArgEdit* pEdNext; - ScrollBar* pSlider; + VclPtr<ArgEdit> pEdPrev; + VclPtr<ArgEdit> pEdNext; + VclPtr<ScrollBar> pSlider; sal_uInt16 nArgs; }; @@ -93,10 +96,10 @@ private: Link aEdFocusLink; Link aEdModifyLink; - FixedText* pFtArg; - PushButton* pBtnFx; - ArgEdit* pEdArg; - RefButton* pRefBtn; + VclPtr<FixedText> pFtArg; + VclPtr<PushButton> pBtnFx; + VclPtr<ArgEdit> pEdArg; + VclPtr<RefButton> pRefBtn; DECL_LINK( FxBtnClickHdl, ImageButton* ); DECL_LINK( RefBtnClickHdl,RefButton* ); diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index 15ca7bde9c9b..7f20431ab1bb 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -146,43 +146,43 @@ namespace formula mutable const sheet::FormulaOpCodeMapEntry* m_pBinaryOpCodesEnd; ::std::map<FormulaToken*,sheet::FormulaToken> m_aTokenMap; IFormulaEditorHelper* m_pHelper; - Dialog* m_pParent; + VclPtr<Dialog> m_pParent; IControlReferenceHandler* m_pDlg; - TabControl *m_pTabCtrl; - VclVBox *m_pParaWinBox; - ParaWin* pParaWin; - FixedText *m_pFtHeadLine; - FixedText *m_pFtFuncName; - FixedText *m_pFtFuncDesc; + VclPtr<TabControl> m_pTabCtrl; + VclPtr<VclVBox> m_pParaWinBox; + VclPtr<ParaWin> pParaWin; + VclPtr<FixedText> m_pFtHeadLine; + VclPtr<FixedText> m_pFtFuncName; + VclPtr<FixedText> m_pFtFuncDesc; - FixedText *m_pFtEditName; + VclPtr<FixedText> m_pFtEditName; - FixedText *m_pFtResult; - Edit *m_pWndResult; + VclPtr<FixedText> m_pFtResult; + VclPtr<Edit> m_pWndResult; - FixedText *m_pFtFormula; - EditBox *m_pMEFormula; + VclPtr<FixedText> m_pFtFormula; + VclPtr<EditBox> m_pMEFormula; - CheckBox *m_pBtnMatrix; - CancelButton *m_pBtnCancel; + VclPtr<CheckBox> m_pBtnMatrix; + VclPtr<CancelButton> m_pBtnCancel; - PushButton *m_pBtnBackward; - PushButton *m_pBtnForward; - OKButton *m_pBtnEnd; + VclPtr<PushButton> m_pBtnBackward; + VclPtr<PushButton> m_pBtnForward; + VclPtr<OKButton> m_pBtnEnd; - RefEdit *m_pEdRef; - RefButton *m_pRefBtn; + VclPtr<RefEdit> m_pEdRef; + VclPtr<RefButton> m_pRefBtn; - FixedText *m_pFtFormResult; - Edit *m_pWndFormResult; + VclPtr<FixedText> m_pFtFormResult; + VclPtr<Edit> m_pWndFormResult; - RefEdit* pTheRefEdit; - RefButton* pTheRefButton; - FuncPage* pFuncPage; - StructPage* pStructPage; + VclPtr<RefEdit> pTheRefEdit; + VclPtr<RefButton> pTheRefButton; + VclPtr<FuncPage> pFuncPage; + VclPtr<StructPage> pStructPage; OUString aOldFormula; bool bStructUpdate; - MultiLineEdit* pMEdit; + VclPtr<MultiLineEdit> pMEdit; bool bUserMatrixFlag; Idle aIdle; @@ -286,7 +286,7 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent pParent->get(m_pRefBtn, "RB_REF"); m_pRefBtn->SetReferences(_pDlg, m_pEdRef); - pParaWin = new ParaWin(m_pParaWinBox, _pDlg); + pParaWin = VclPtr<ParaWin>::Create(m_pParaWinBox, _pDlg); pParaWin->Show(); m_pParaWinBox->Hide(); m_pFtEditName->Hide(); @@ -306,8 +306,8 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent pParaWin->SetArgModifiedHdl(LINK( this, FormulaDlg_Impl, ModifyHdl ) ); pParaWin->SetFxHdl(LINK( this, FormulaDlg_Impl, FxHdl ) ); - pFuncPage= new FuncPage( m_pTabCtrl,_pFunctionMgr); - pStructPage= new StructPage( m_pTabCtrl); + pFuncPage= VclPtr<FuncPage>::Create( m_pTabCtrl,_pFunctionMgr); + pStructPage= VclPtr<StructPage>::Create( m_pTabCtrl); pFuncPage->Hide(); pStructPage->Hide(); m_pTabCtrl->SetTabPage( TP_FUNCTION, pFuncPage); @@ -364,9 +364,9 @@ FormulaDlg_Impl::~FormulaDlg_Impl() m_pTabCtrl->RemovePage(TP_FUNCTION); m_pTabCtrl->RemovePage(TP_STRUCT); - delete pStructPage; - delete pFuncPage; - delete pParaWin; + pStructPage.disposeAndClear(); + pFuncPage.disposeAndClear(); + pParaWin.disposeAndClear(); DeleteArgs(); } @@ -1426,7 +1426,7 @@ void FormulaDlg_Impl::UpdateSelection() m_pRefBtn->Show( pButton != NULL ); ::std::pair<RefButton*,RefEdit*> aPair; - aPair.first = pButton ? m_pRefBtn : NULL; + aPair.first = pButton ? m_pRefBtn.get() : NULL; aPair.second = m_pEdRef; return aPair; } @@ -1473,7 +1473,7 @@ void FormulaDlg_Impl::RefInputDoneAfter( bool bForced ) } RefEdit* FormulaDlg_Impl::GetCurrRefEdit() { - return m_pEdRef->IsVisible() ? m_pEdRef : pParaWin->GetActiveEdit(); + return m_pEdRef->IsVisible() ? m_pEdRef.get() : pParaWin->GetActiveEdit(); } void FormulaDlg_Impl::Update() { @@ -1612,7 +1612,7 @@ bool FormulaDlg_Impl::UpdateParaWin(Selection& _rSelection) OUString aStrEd; Edit* pEd = GetCurrRefEdit(); - if(pEd!=NULL && pTheRefEdit==NULL) + if(pEd!=NULL && pTheRefEdit==nullptr) { _rSelection=pEd->GetSelection(); _rSelection.Justify(); @@ -1626,7 +1626,7 @@ bool FormulaDlg_Impl::UpdateParaWin(Selection& _rSelection) _rSelection.Justify(); aStrEd= m_pEdRef->GetText(); } - return pTheRefEdit == NULL; + return pTheRefEdit == nullptr; } void FormulaDlg_Impl::SetEdSelection() diff --git a/formula/source/ui/dlg/funcpage.cxx b/formula/source/ui/dlg/funcpage.cxx index a977b174d543..886cab46c063 100644 --- a/formula/source/ui/dlg/funcpage.cxx +++ b/formula/source/ui/dlg/funcpage.cxx @@ -91,6 +91,18 @@ FuncPage::FuncPage(vcl::Window* pParent,const IFunctionManager* _pFunctionManage m_pLbFunction->SetDoubleClickHdl( LINK( this, FuncPage, DblClkHdl ) ); } +FuncPage::~FuncPage() +{ + disposeOnce(); +} + +void FuncPage::dispose() +{ + m_pLbCategory.clear(); + m_pLbFunction.clear(); + TabPage::dispose(); +} + void FuncPage::impl_addFunctions(const IFunctionCategory* _pCategory) { const sal_uInt32 nCount = _pCategory->getCount(); diff --git a/formula/source/ui/dlg/funcpage.hxx b/formula/source/ui/dlg/funcpage.hxx index 62d803dd8ed6..87a2799dcfac 100644 --- a/formula/source/ui/dlg/funcpage.hxx +++ b/formula/source/ui/dlg/funcpage.hxx @@ -64,8 +64,8 @@ private: OModuleClient m_aModuleClient; Link aDoubleClickLink; Link aSelectionLink; - ListBox *m_pLbCategory; - FormulaListBox *m_pLbFunction; + VclPtr<ListBox> m_pLbCategory; + VclPtr<FormulaListBox> m_pLbFunction; const IFunctionManager* m_pFunctionManager; @@ -86,6 +86,8 @@ protected: public: FuncPage( vcl::Window* pParent,const IFunctionManager* _pFunctionManager); + virtual ~FuncPage(); + virtual void dispose() SAL_OVERRIDE; void SetCategory(sal_Int32 nCat); void SetFunction(sal_Int32 nFunc); diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx index d6313d418a0a..271d8b83cafa 100644 --- a/formula/source/ui/dlg/funcutl.cxx +++ b/formula/source/ui/dlg/funcutl.cxx @@ -42,6 +42,19 @@ ArgEdit::ArgEdit( vcl::Window* pParent, WinBits nBits ) { } +ArgEdit::~ArgEdit() +{ + disposeOnce(); +} + +void ArgEdit::dispose() +{ + pEdPrev.clear(); + pEdNext.clear(); + pSlider.clear(); + RefEdit::dispose(); +} + extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeArgEdit(vcl::Window *pParent, VclBuilder::stringmap &) { return new ArgEdit(pParent, WB_BORDER); @@ -149,17 +162,17 @@ void ArgInput::InitArgInput( FixedText* pftArg, PushButton* pbtnFx, pEdArg =pedArg; pRefBtn=prefBtn; - if(pBtnFx!=NULL) + if(pBtnFx!=nullptr) { pBtnFx->SetClickHdl ( LINK( this, ArgInput, FxBtnClickHdl ) ); pBtnFx->SetGetFocusHdl( LINK( this, ArgInput, FxBtnFocusHdl ) ); } - if(pRefBtn!=NULL) + if(pRefBtn!=nullptr) { pRefBtn->SetClickHdl ( LINK( this, ArgInput, RefBtnClickHdl ) ); pRefBtn->SetGetFocusHdl( LINK( this, ArgInput, RefBtnFocusHdl ) ); } - if(pEdArg!=NULL) + if(pEdArg!=nullptr) { pEdArg->SetGetFocusHdl ( LINK( this, ArgInput, EdFocusHdl ) ); pEdArg->SetModifyHdl ( LINK( this, ArgInput, EdModifyHdl ) ); @@ -170,14 +183,14 @@ void ArgInput::InitArgInput( FixedText* pftArg, PushButton* pbtnFx, // Sets the Name for the Argument void ArgInput::SetArgName(const OUString &aArg) { - if(pFtArg !=NULL) pFtArg->SetText(aArg ); + if(pFtArg !=nullptr) pFtArg->SetText(aArg ); } // Returns the Name for the Argument OUString ArgInput::GetArgName() { OUString aPrivArgName; - if(pFtArg !=NULL) + if(pFtArg !=nullptr) aPrivArgName=pFtArg->GetText(); return aPrivArgName; @@ -186,19 +199,19 @@ OUString ArgInput::GetArgName() //Sets the Name for the Argument void ArgInput::SetArgNameFont (const vcl::Font &aFont) { - if(pFtArg !=NULL) pFtArg->SetFont(aFont); + if(pFtArg !=nullptr) pFtArg->SetFont(aFont); } //Sets up the Selection for the EditBox. void ArgInput::SetArgSelection (const Selection& rSel ) { - if(pEdArg !=NULL) pEdArg ->SetSelection(rSel ); + if(pEdArg !=nullptr) pEdArg ->SetSelection(rSel ); } //Sets the Value for the Argument void ArgInput::SetArgVal(const OUString &rVal) { - if(pEdArg !=NULL) + if(pEdArg != nullptr) { pEdArg ->SetRefString(rVal); } @@ -208,7 +221,7 @@ void ArgInput::SetArgVal(const OUString &rVal) OUString ArgInput::GetArgVal() { OUString aResult; - if(pEdArg!=NULL) + if(pEdArg!=nullptr) { aResult=pEdArg->GetText(); } @@ -340,7 +353,7 @@ EditBox::EditBox( vcl::Window* pParent, WinBits nBits ) WinBits nStyle=GetStyle(); SetStyle( nStyle| WB_DIALOGCONTROL); - pMEdit=new MultiLineEdit(this,WB_LEFT | WB_VSCROLL | (nStyle & WB_TABSTOP) | + pMEdit=VclPtr<MultiLineEdit>::Create(this,WB_LEFT | WB_VSCROLL | (nStyle & WB_TABSTOP) | WB_NOBORDER | WB_NOHIDESELECTION | WB_IGNORETAB); pMEdit->Show(); aOldSel=pMEdit->GetSelection(); @@ -361,10 +374,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeEditBox(vcl::Window *p EditBox::~EditBox() { - MultiLineEdit* pTheEdit=pMEdit; + disposeOnce(); +} + +void EditBox::dispose() +{ pMEdit->Disable(); - pMEdit=NULL; - delete pTheEdit; + pMEdit.disposeAndClear(); + Control::dispose(); } // When the selection is changed this function will be called @@ -377,14 +394,14 @@ void EditBox::SelectionChanged() void EditBox::Resize() { Size aSize=GetOutputSizePixel(); - if(pMEdit!=NULL) pMEdit->SetOutputSizePixel(aSize); + if(pMEdit!=nullptr) pMEdit->SetOutputSizePixel(aSize); } // When the Control is activated, the Selection is repealed // and the Cursor set at the end. void EditBox::GetFocus() { - if(pMEdit!=NULL) + if(pMEdit!=nullptr) { pMEdit->GrabFocus(); } @@ -396,7 +413,7 @@ bool EditBox::PreNotify( NotifyEvent& rNEvt ) { bool nResult = true; - if(pMEdit==NULL) return nResult; + if(pMEdit==nullptr) return nResult; MouseNotifyEvent nSwitch=rNEvt.GetType(); if(nSwitch==MouseNotifyEvent::KEYINPUT)// || nSwitch==MouseNotifyEvent::KEYUP) @@ -431,7 +448,7 @@ bool EditBox::PreNotify( NotifyEvent& rNEvt ) //first called. IMPL_LINK_NOARG(EditBox, ChangedHdl) { - if(pMEdit!=NULL) + if(pMEdit!=nullptr) { Selection aNewSel=pMEdit->GetSelection(); @@ -481,8 +498,15 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeRefEdit(vcl::Window *p RefEdit::~RefEdit() { + disposeOnce(); +} + +void RefEdit::dispose() +{ aIdle.SetIdleHdl( Link() ); aIdle.Stop(); + pLabelWidget.clear(); + Edit::dispose(); } void RefEdit::SetRefString( const OUString& rStr ) @@ -581,6 +605,17 @@ RefButton::RefButton( vcl::Window* _pParent, WinBits nStyle ) : SetStartImage(); } +RefButton::~RefButton() +{ + disposeOnce(); +} + +void RefButton::dispose() +{ + pRefEdit.clear(); + ImageButton::dispose(); +} + extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeRefButton(vcl::Window *pParent, VclBuilder::stringmap &) { return new RefButton(pParent, 0); diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx index 9e3a647eed04..539661b05b1c 100644 --- a/formula/source/ui/dlg/parawin.cxx +++ b/formula/source/ui/dlg/parawin.cxx @@ -221,6 +221,11 @@ void ParaWin::UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i ) ParaWin::~ParaWin() { + disposeOnce(); +} + +void ParaWin::dispose() +{ // #i66422# if the focus changes during destruction of the controls, // don't call the focus handlers Link aEmptyLink; @@ -228,6 +233,27 @@ ParaWin::~ParaWin() m_pBtnFx2->SetGetFocusHdl( aEmptyLink ); m_pBtnFx3->SetGetFocusHdl( aEmptyLink ); m_pBtnFx4->SetGetFocusHdl( aEmptyLink ); + m_pFtEditDesc.clear(); + m_pFtArgName.clear(); + m_pFtArgDesc.clear(); + m_pBtnFx1.clear(); + m_pFtArg1.clear(); + m_pEdArg1.clear(); + m_pRefBtn1.clear(); + m_pBtnFx2.clear(); + m_pFtArg2.clear(); + m_pEdArg2.clear(); + m_pRefBtn2.clear(); + m_pBtnFx3.clear(); + m_pFtArg3.clear(); + m_pEdArg3.clear(); + m_pRefBtn3.clear(); + m_pBtnFx4.clear(); + m_pFtArg4.clear(); + m_pEdArg4.clear(); + m_pRefBtn4.clear(); + m_pSlider.clear(); + TabPage::dispose(); } diff --git a/formula/source/ui/dlg/parawin.hxx b/formula/source/ui/dlg/parawin.hxx index 5bf159b4f5d4..6a83c4d59218 100644 --- a/formula/source/ui/dlg/parawin.hxx +++ b/formula/source/ui/dlg/parawin.hxx @@ -56,31 +56,31 @@ private: vcl::Font aFntBold; vcl::Font aFntLight; - FixedText *m_pFtEditDesc; - FixedText *m_pFtArgName; - FixedText *m_pFtArgDesc; - - PushButton *m_pBtnFx1; - FixedText *m_pFtArg1; - ArgEdit *m_pEdArg1; - RefButton *m_pRefBtn1; - - PushButton *m_pBtnFx2; - FixedText *m_pFtArg2; - ArgEdit *m_pEdArg2; - RefButton *m_pRefBtn2; - - PushButton *m_pBtnFx3; - FixedText *m_pFtArg3; - ArgEdit *m_pEdArg3; - RefButton *m_pRefBtn3; - - PushButton *m_pBtnFx4; - FixedText *m_pFtArg4; - ArgEdit *m_pEdArg4; - RefButton *m_pRefBtn4; - - ScrollBar *m_pSlider; + VclPtr<FixedText> m_pFtEditDesc; + VclPtr<FixedText> m_pFtArgName; + VclPtr<FixedText> m_pFtArgDesc; + + VclPtr<PushButton> m_pBtnFx1; + VclPtr<FixedText> m_pFtArg1; + VclPtr<ArgEdit> m_pEdArg1; + VclPtr<RefButton> m_pRefBtn1; + + VclPtr<PushButton> m_pBtnFx2; + VclPtr<FixedText> m_pFtArg2; + VclPtr<ArgEdit> m_pEdArg2; + VclPtr<RefButton> m_pRefBtn2; + + VclPtr<PushButton> m_pBtnFx3; + VclPtr<FixedText> m_pFtArg3; + VclPtr<ArgEdit> m_pEdArg3; + VclPtr<RefButton> m_pRefBtn3; + + VclPtr<PushButton> m_pBtnFx4; + VclPtr<FixedText> m_pFtArg4; + VclPtr<ArgEdit> m_pEdArg4; + VclPtr<RefButton> m_pRefBtn4; + + VclPtr<ScrollBar> m_pSlider; OUString m_sOptional; OUString m_sRequired; bool bRefMode; @@ -125,6 +125,7 @@ protected: public: ParaWin(vcl::Window* pParent,IControlReferenceHandler* _pDlg); virtual ~ParaWin(); + virtual void dispose() SAL_OVERRIDE; void SetFunctionDesc(const IFunctionDescription* pFDesc); void SetArgumentOffset(sal_uInt16 nOffset); diff --git a/formula/source/ui/dlg/structpg.cxx b/formula/source/ui/dlg/structpg.cxx index 4bcdc15e44b9..eb39a60e55d6 100644 --- a/formula/source/ui/dlg/structpg.cxx +++ b/formula/source/ui/dlg/structpg.cxx @@ -103,6 +103,17 @@ StructPage::StructPage(vcl::Window* pParent): m_pTlbStruct->SetSelectHdl(LINK( this, StructPage, SelectHdl ) ); } +StructPage::~StructPage() +{ + disposeOnce(); +} + +void StructPage::dispose() +{ + m_pTlbStruct.clear(); + TabPage::dispose(); +} + void StructPage::ClearStruct() { m_pTlbStruct->SetActiveFlag(false); diff --git a/formula/source/ui/dlg/structpg.hxx b/formula/source/ui/dlg/structpg.hxx index bdd4fcd7d70d..d0a3b35066e9 100644 --- a/formula/source/ui/dlg/structpg.hxx +++ b/formula/source/ui/dlg/structpg.hxx @@ -73,7 +73,7 @@ private: OModuleClient m_aModuleClient; Link aSelLink; - StructListBox *m_pTlbStruct; + VclPtr<StructListBox> m_pTlbStruct; Image maImgEnd; Image maImgError; @@ -90,6 +90,8 @@ protected: public: StructPage( vcl::Window* pParent); + virtual ~StructPage(); + virtual void dispose() SAL_OVERRIDE; void ClearStruct(); virtual SvTreeListEntry* InsertEntry(const OUString& rText, SvTreeListEntry* pParent, |