diff options
Diffstat (limited to 'basctl')
29 files changed, 310 insertions, 114 deletions
diff --git a/basctl/source/basicide/basicrenderable.hxx b/basctl/source/basicide/basicrenderable.hxx index f91a5ef8a9d3..db96dfc66ea5 100644 --- a/basctl/source/basicide/basicrenderable.hxx +++ b/basctl/source/basicide/basicrenderable.hxx @@ -33,7 +33,7 @@ class Renderable : public cppu::WeakComponentImplHelper1< com::sun::star::view::XRenderable >, public vcl::PrinterOptionsHelper { - BaseWindow* mpWindow; + VclPtr<BaseWindow> mpWindow; osl::Mutex maMutex; Printer* getPrinter(); diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 9b4837673dbe..33ddae459da9 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -1484,6 +1484,7 @@ void ModulWindowLayout::dispose() { aWatchWindow.disposeAndClear(); aStackWindow.disposeAndClear(); + pChild.clear(); Layout::dispose(); } diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 48874b01c69b..addef49f60a9 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -445,7 +445,7 @@ protected: private: // main child window - ModulWindow* pChild; + VclPtr<ModulWindow> pChild; // dockable windows VclPtr<WatchWindow> aWatchWindow; VclPtr<StackWindow> aStackWindow; @@ -475,7 +475,7 @@ private: // the configuration svtools::ColorConfig aConfig; // the active editor - EditorWindow* pEditor; + VclPtr<EditorWindow> pEditor; } aSyntaxColors; }; @@ -489,7 +489,7 @@ private: /* a buffer to build up function name when typing * a function name, used for showing/hiding listbox values * */ - CodeCompleteWindow* pCodeCompleteWindow; // parent window + VclPtr<CodeCompleteWindow> pCodeCompleteWindow; // parent window void SetMatchingEntries(); // sets the visible entries based on aFuncBuffer variable void HideAndRestoreFocus(); @@ -497,6 +497,8 @@ private: public: CodeCompleteListBox( CodeCompleteWindow* pPar ); + virtual ~CodeCompleteListBox(); + virtual void dispose() SAL_OVERRIDE; void InsertSelectedEntry(); //insert the selected entry DECL_LINK(ImplDoubleClickHdl, void*); @@ -510,9 +512,9 @@ class CodeCompleteWindow: public vcl::Window { friend class CodeCompleteListBox; private: - EditorWindow* pParent; // parent window + VclPtr<EditorWindow> pParent; // parent window TextSelection aTextSelection; - CodeCompleteListBox* pListBox; + VclPtr<CodeCompleteListBox> pListBox; void InitListBox(); // initialize the ListBox diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 4afce39c3dfc..f405491cce56 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -2685,6 +2685,17 @@ pCodeCompleteWindow( pPar ) SetSelectHdl(LINK(this, CodeCompleteListBox, ImplSelectHdl)); } +CodeCompleteListBox::~CodeCompleteListBox() +{ + dispose(); +} + +void CodeCompleteListBox::dispose() +{ + pCodeCompleteWindow.clear(); + ListBox::dispose(); +} + IMPL_LINK_NOARG(CodeCompleteListBox, ImplDoubleClickHdl) { InsertSelectedEntry(); @@ -2863,8 +2874,8 @@ CodeCompleteWindow::~CodeCompleteWindow() void CodeCompleteWindow::dispose() { - delete pListBox; - pListBox = NULL; + pListBox.clear(); + pParent.clear(); vcl::Window::dispose(); } diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index a85d0e0fd67f..4c08dcbb770e 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -1413,12 +1413,12 @@ DialogWindowLayout::~DialogWindowLayout() void DialogWindowLayout::dispose() { - if (pPropertyBrowser != 0) + if (pPropertyBrowser) { Remove(pPropertyBrowser); - delete pPropertyBrowser; - pPropertyBrowser = 0; } + pPropertyBrowser.clear(); + pChild.clear(); Layout::dispose(); } diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index c6374bf8e43d..c9aaa23447c7 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -126,7 +126,7 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) break; if (it != aWindowTable.end()) ++it; - BaseWindow* pWin = it != aWindowTable.end() ? it->second : 0; + BaseWindow* pWin = it != aWindowTable.end() ? it->second.get() : 0; bool bSearchedFromStart = false; while ( !nFound && !bCanceled && ( pWin || !bSearchedFromStart ) ) @@ -166,7 +166,7 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) { if ( it != aWindowTable.end() ) ++it; - pWin = it != aWindowTable.end() ? it->second : 0; + pWin = it != aWindowTable.end() ? it->second.get() : 0; } else pWin = 0; @@ -202,7 +202,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq ) case SID_BASICSTOP: { // maybe do not simply stop if on breakpoint! - if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get())) pMCurWin->BasicStop(); StopBasic(); } @@ -769,7 +769,7 @@ void Shell::GetState(SfxItemSet &rSet) case SID_BASICSAVEAS: case SID_BASICIDE_MATCHGROUP: { - if (!dynamic_cast<ModulWindow*>(pCurWin)) + if (!dynamic_cast<ModulWindow*>(pCurWin.get())) rSet.DisableItem( nWh ); else if ( ( nWh == SID_BASICLOAD ) && ( StarBASIC::IsRunning() || ( pCurWin && pCurWin->IsReadOnly() ) ) ) rSet.DisableItem( nWh ); @@ -782,7 +782,7 @@ void Shell::GetState(SfxItemSet &rSet) case SID_BASICIDE_TOGGLEBRKPNT: case SID_BASICIDE_MANAGEBRKPNTS: { - if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get())) { if (StarBASIC::IsRunning() && !pMCurWin->GetBasicStatus().bIsInReschedule) rSet.DisableItem(nWh); @@ -793,7 +793,7 @@ void Shell::GetState(SfxItemSet &rSet) break; case SID_BASICCOMPILE: { - if (StarBASIC::IsRunning() || !dynamic_cast<ModulWindow*>(pCurWin)) + if (StarBASIC::IsRunning() || !dynamic_cast<ModulWindow*>(pCurWin.get())) rSet.DisableItem( nWh ); } break; @@ -814,7 +814,7 @@ void Shell::GetState(SfxItemSet &rSet) case SID_INSERT_FORM_HSCROLL: case SID_INSERT_FORM_SPIN: { - if (!dynamic_cast<DialogWindow*>(pCurWin)) + if (!dynamic_cast<DialogWindow*>(pCurWin.get())) rSet.DisableItem( nWh ); } break; @@ -945,7 +945,7 @@ void Shell::GetState(SfxItemSet &rSet) // if this is not a module window hide the // setting, doesn't make sense for example if the // dialog editor is open - if (pCurWin && !dynamic_cast<ModulWindow*>(pCurWin)) + if (pCurWin && !dynamic_cast<ModulWindow*>(pCurWin.get())) { rSet.DisableItem( nWh ); rSet.Put(SfxVisibilityItem(nWh, false)); @@ -968,7 +968,7 @@ bool Shell::HasUIFeature( sal_uInt32 nFeature ) if ( (nFeature & BASICIDE_UI_FEATURE_SHOW_BROWSER) == BASICIDE_UI_FEATURE_SHOW_BROWSER ) { // fade out (in) property browser in module (dialog) windows - if (dynamic_cast<DialogWindow*>(pCurWin) && !pCurWin->IsReadOnly()) + if (dynamic_cast<DialogWindow*>(pCurWin.get()) && !pCurWin->IsReadOnly()) bResult = true; } @@ -1035,7 +1035,7 @@ void Shell::SetCurWindow( BaseWindow* pNewWin, bool bUpdateTabBar, bool bRemembe aObjectCatalog->SetCurrentEntry(pCurWin); SetUndoManager( pCurWin ? pCurWin->GetUndoManager() : 0 ); InvalidateBasicIDESlots(); - EnableScrollbars(pCurWin != 0); + EnableScrollbars(pCurWin != nullptr); if ( m_pCurLocalizationMgr ) m_pCurLocalizationMgr->handleTranslationbar(); @@ -1067,7 +1067,7 @@ void Shell::ManageToolbars() if ( xLayoutManager.is() ) { xLayoutManager->lock(); - if (dynamic_cast<DialogWindow*>(pCurWin)) + if (dynamic_cast<DialogWindow*>(pCurWin.get())) { xLayoutManager->destroyElement( aMacroBarResName ); @@ -1213,7 +1213,7 @@ void Shell::AdjustPosSizePixel( const Point &rPos, const Size &rSize ) } if (pLayout) - pLayout->SetPosSizePixel(rPos, dynamic_cast<DialogWindow*>(pCurWin) ? aSz : aOutSz); + pLayout->SetPosSizePixel(rPos, dynamic_cast<DialogWindow*>(pCurWin.get()) ? aSz : aOutSz); } Reference< XModel > Shell::GetCurrentDocument() const @@ -1230,7 +1230,7 @@ void Shell::Activate( bool bMDI ) if ( bMDI ) { - if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin)) + if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin.get())) pDCurWin->UpdateBrowser(); } } @@ -1241,7 +1241,7 @@ void Shell::Deactivate( bool bMDI ) // deactivate due to a MessageBox bMDI is false if ( bMDI ) { - if (DialogWindow* pXDlgWin = dynamic_cast<DialogWindow*>(pCurWin)) + if (DialogWindow* pXDlgWin = dynamic_cast<DialogWindow*>(pCurWin.get())) { pXDlgWin->DisableBrowser(); if( pXDlgWin->IsModified() ) diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx index 70cda63abde1..3e88d55a9e98 100644 --- a/basctl/source/basicide/basides2.cxx +++ b/basctl/source/basicide/basides2.cxx @@ -44,7 +44,7 @@ Reference< view::XRenderable > Shell::GetRenderable() bool Shell::HasSelection( bool /* bText */ ) const { - if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get())) { TextView* pEditView = pMCurWin->GetEditView(); if ( pEditView && pEditView->HasSelection() ) @@ -56,7 +56,7 @@ bool Shell::HasSelection( bool /* bText */ ) const OUString Shell::GetSelectionText( bool bWholeWord ) { OUString aText; - if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get())) { if (TextView* pEditView = pMCurWin->GetEditView()) { @@ -220,14 +220,14 @@ void Shell::Move() void Shell::ShowCursor( bool bOn ) { - if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) + if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin.get())) pMCurWin->ShowCursor(bOn); } // only if basic window above: void Shell::ExecuteBasic( SfxRequest& rReq ) { - if (dynamic_cast<ModulWindow*>(pCurWin)) + if (dynamic_cast<ModulWindow*>(pCurWin.get())) { pCurWin->ExecuteCommand( rReq ); if (nShellCount) diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx index 8112a1790d5c..5b2f93d3beca 100644 --- a/basctl/source/basicide/basides3.cxx +++ b/basctl/source/basicide/basides3.cxx @@ -128,7 +128,7 @@ sal_uInt16 Shell::GetWindowId(const BaseWindow* pWin) const SdrView* Shell::GetCurDlgView() const { - if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin)) + if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin.get())) return &pDCurWin->GetView(); else return 0; @@ -137,7 +137,7 @@ SdrView* Shell::GetCurDlgView() const // only if dialogue window above: void Shell::ExecuteDialog( SfxRequest& rReq ) { - if (pCurWin && (dynamic_cast<DialogWindow*>(pCurWin) || rReq.GetSlot() == SID_IMPORT_DIALOG)) + if (pCurWin && (dynamic_cast<DialogWindow*>(pCurWin.get()) || rReq.GetSlot() == SID_IMPORT_DIALOG)) pCurWin->ExecuteCommand(rReq); } diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index bf9af424fe6f..e1d92e1e88b2 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -232,11 +232,8 @@ Shell::~Shell() SetWindow( 0 ); SetCurWindow( 0 ); - for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) - { - // no store; does already happen when the BasicManagers are destroyed - delete it->second; - } + // no store; does already happen when the BasicManagers are destroyed + aWindowTable.clear(); // Destroy all ContainerListeners for Basic Container. if (ContainerListenerImpl* pListener = static_cast<ContainerListenerImpl*>(m_xLibListener.get())) @@ -255,7 +252,10 @@ void Shell::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) // for VBA documents, show a warning that we can save them only in ODF if (pCurWin->GetDocument().isInVBAMode()) - GetViewFrame()->AppendInfoBar("vba_save", IDE_RESSTR(RID_STR_CANNOTSAVEVBA)); + { + std::vector< VclPtr<PushButton> > aButtons; + GetViewFrame()->AppendInfoBar("vba_save", IDE_RESSTR(RID_STR_CANNOTSAVEVBA), aButtons); + } } UpdateWindows(); diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 3a6be366accc..7e0bfeafe149 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -64,6 +64,8 @@ void BaseWindow::dispose() pShellVScrollBar->SetScrollHdl( Link() ); if ( pShellHScrollBar ) pShellHScrollBar->SetScrollHdl( Link() ); + pShellVScrollBar.clear(); + pShellHScrollBar.clear(); vcl::Window::dispose(); } @@ -279,6 +281,17 @@ DockingWindow::DockingWindow (Layout* pParent) : nShowCount(0) { } +DockingWindow::~DockingWindow() +{ + dispose(); +} + +void DockingWindow::dispose() +{ + pLayout.clear(); + ::DockingWindow::dispose(); +} + // Sets the position and the size of the docking window. This property is saved // when the window is floating. Called by Layout. void DockingWindow::ResizeIfDocking (Point const& rPos, Size const& rSize) @@ -526,7 +539,7 @@ void TabBar::Command( const CommandEvent& rCEvt ) { Shell::WindowTable& aWindowTable = pShell->GetWindowTable(); Shell::WindowTableIt it = aWindowTable.find( GetCurPageId() ); - if (it != aWindowTable.end() && dynamic_cast<ModulWindow*>(it->second)) + if (it != aWindowTable.end() && dynamic_cast<ModulWindow*>(it->second.get())) { SbModule* pActiveModule = pBasic->FindModule( it->second->GetName() ); if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::DOCUMENT ) ) diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx index b5b2ef17d9dc..321f68bd9a9d 100644 --- a/basctl/source/basicide/brkdlg.cxx +++ b/basctl/source/basicide/brkdlg.cxx @@ -106,6 +106,21 @@ BreakPointDialog::BreakPointDialog( vcl::Window* pParent, BreakPointList& rBrkPn CheckButtons(); } +BreakPointDialog::~BreakPointDialog() +{ + dispose(); +} + +void BreakPointDialog::dispose() +{ + m_pComboBox.clear(); + m_pOKButton.clear(); + m_pNewButton.clear(); + m_pDelButton.clear(); + m_pNumericField.clear(); + ModalDialog::dispose(); +} + void BreakPointDialog::SetCurrentBreakPoint( BreakPoint* pBrk ) { OUString aStr( "# " + OUString::number(pBrk->nLine) ); diff --git a/basctl/source/basicide/brkdlg.hxx b/basctl/source/basicide/brkdlg.hxx index 703744efd345..5c78e7ce6674 100644 --- a/basctl/source/basicide/brkdlg.hxx +++ b/basctl/source/basicide/brkdlg.hxx @@ -31,12 +31,12 @@ namespace basctl class BreakPointDialog : public ModalDialog { private: - ComboBox* m_pComboBox; - OKButton* m_pOKButton; - PushButton* m_pNewButton; - PushButton* m_pDelButton; - ::CheckBox* m_pCheckBox; - NumericField* m_pNumericField; + VclPtr<ComboBox> m_pComboBox; + VclPtr<OKButton> m_pOKButton; + VclPtr<PushButton> m_pNewButton; + VclPtr<PushButton> m_pDelButton; + ::VclPtr<CheckBox> m_pCheckBox; + VclPtr<NumericField> m_pNumericField; BreakPointList & m_rOriginalBreakPointList; BreakPointList m_aModifiedBreakPointList; @@ -53,6 +53,8 @@ protected: public: BreakPointDialog( vcl::Window* pParent, BreakPointList& rBrkList ); + virtual ~BreakPointDialog(); + virtual void dispose() SAL_OVERRIDE; void SetCurrentBreakPoint( BreakPoint* pBrk ); }; diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx index 58db3a74dbb1..14a3b54af1a0 100644 --- a/basctl/source/basicide/layout.cxx +++ b/basctl/source/basicide/layout.cxx @@ -53,6 +53,17 @@ Layout::Layout (vcl::Window* pParent) : SetFont(aFont); } +Layout::~Layout() +{ + dispose(); +} + +void Layout::dispose() +{ + pChild.clear(); + Window::dispose(); +} + // removes a docking window void Layout::Remove (DockingWindow* pWin) { diff --git a/basctl/source/basicide/layout.hxx b/basctl/source/basicide/layout.hxx index 56e69a2f28f9..ad19ad93e5f1 100644 --- a/basctl/source/basicide/layout.hxx +++ b/basctl/source/basicide/layout.hxx @@ -50,6 +50,9 @@ public: virtual void GetState (SfxItemSet&, unsigned nWhich) = 0; virtual void UpdateDebug (bool bBasicStopped ) = 0; + virtual ~Layout(); + virtual void dispose() SAL_OVERRIDE; + protected: Layout (vcl::Window* pParent); @@ -67,7 +70,7 @@ protected: private: // the main child window (either ModulWindow or DialogWindow) - BaseWindow* pChild; + VclPtr<BaseWindow> pChild; // when this window has at first (nonempty) size bool bFirstSize; @@ -101,7 +104,7 @@ private: struct Item { // pointer to the dockable window - DockingWindow* pWin; + VclPtr<DockingWindow> pWin; // starting and ending position in the strip // They may be different from the actual window position, because // the window may fill the space of the adjacent currently diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx index e3b49bf2dc39..97c1fd9e9b77 100644 --- a/basctl/source/basicide/linenumberwindow.cxx +++ b/basctl/source/basicide/linenumberwindow.cxx @@ -25,6 +25,17 @@ LineNumberWindow::LineNumberWindow (vcl::Window* pParent, ModulWindow* pModulWin m_nWidth = m_nBaseWidth * 3 + m_nBaseWidth / 2; } +LineNumberWindow::~LineNumberWindow() +{ + dispose(); +} + +void LineNumberWindow::dispose() +{ + m_pModulWindow.clear(); + Window::dispose(); +} + void LineNumberWindow::Paint( const Rectangle& ) { if(SyncYOffset()) diff --git a/basctl/source/basicide/linenumberwindow.hxx b/basctl/source/basicide/linenumberwindow.hxx index 6a6bcd201714..65498937eda8 100644 --- a/basctl/source/basicide/linenumberwindow.hxx +++ b/basctl/source/basicide/linenumberwindow.hxx @@ -19,7 +19,7 @@ class ModulWindow; class LineNumberWindow : public vcl::Window { private: - ModulWindow* m_pModulWindow; + VclPtr<ModulWindow> m_pModulWindow; int m_nWidth; long m_nCurYOffset; int m_nBaseWidth; @@ -30,6 +30,8 @@ protected: public: LineNumberWindow (vcl::Window* pParent, ModulWindow* pModulWin); + virtual ~LineNumberWindow(); + virtual void dispose() SAL_OVERRIDE; void DoScroll( long nHorzScroll, long nVertScroll ); diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index 31d8bccecd19..104d3650ac96 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -122,6 +122,20 @@ void MacroChooser::dispose() SfxGetpApp()->SaveBasicAndDialogContainer(); bForceStoreBasic = false; } + m_pMacroNameEdit.clear(); + m_pMacroFromTxT.clear(); + m_pMacrosSaveInTxt.clear(); + m_pBasicBox.clear(); + m_pMacrosInTxt.clear(); + m_pMacroBox.clear(); + m_pRunButton.clear(); + m_pCloseButton.clear(); + m_pAssignButton.clear(); + m_pEditButton.clear(); + m_pDelButton.clear(); + m_pOrganizeButton.clear(); + m_pNewLibButton.clear(); + m_pNewModButton.clear(); SfxModalDialog::dispose(); } diff --git a/basctl/source/basicide/macrodlg.hxx b/basctl/source/basicide/macrodlg.hxx index 71892b3ea1a8..d8388204904c 100644 --- a/basctl/source/basicide/macrodlg.hxx +++ b/basctl/source/basicide/macrodlg.hxx @@ -45,22 +45,22 @@ public: }; private: - Edit* m_pMacroNameEdit; - FixedText* m_pMacroFromTxT; - FixedText* m_pMacrosSaveInTxt; - TreeListBox* m_pBasicBox; - FixedText* m_pMacrosInTxt; + VclPtr<Edit> m_pMacroNameEdit; + VclPtr<FixedText> m_pMacroFromTxT; + VclPtr<FixedText> m_pMacrosSaveInTxt; + VclPtr<TreeListBox> m_pBasicBox; + VclPtr<FixedText> m_pMacrosInTxt; OUString m_aMacrosInTxtBaseStr; - SvTreeListBox* m_pMacroBox; - - PushButton* m_pRunButton; - CloseButton* m_pCloseButton; - PushButton* m_pAssignButton; - PushButton* m_pEditButton; - PushButton* m_pDelButton; - PushButton* m_pOrganizeButton; - PushButton* m_pNewLibButton; - PushButton* m_pNewModButton; + VclPtr<SvTreeListBox> m_pMacroBox; + + VclPtr<PushButton> m_pRunButton; + VclPtr<CloseButton> m_pCloseButton; + VclPtr<PushButton> m_pAssignButton; + VclPtr<PushButton> m_pEditButton; + VclPtr<PushButton> m_pDelButton; + VclPtr<PushButton> m_pOrganizeButton; + VclPtr<PushButton> m_pNewLibButton; + VclPtr<PushButton> m_pNewModButton; bool bNewDelIsDel; bool bForceStoreBasic; diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index f7cfbb5adfd2..9174328463cc 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -392,6 +392,18 @@ NewObjectDialog::NewObjectDialog(vcl::Window * pParent, ObjectMode::Mode eMode, m_pOKButton->SetClickHdl(LINK(this, NewObjectDialog, OkButtonHandler)); } +NewObjectDialog::~NewObjectDialog() +{ + dispose(); +} + +void NewObjectDialog::dispose() +{ + m_pEdit.clear(); + m_pOKButton.clear(); + ModalDialog::dispose(); +} + // GotoLineDialog GotoLineDialog::GotoLineDialog(vcl::Window * pParent ) : ModalDialog(pParent, "GotoLineDialog", @@ -403,6 +415,18 @@ GotoLineDialog::GotoLineDialog(vcl::Window * pParent ) m_pOKButton->SetClickHdl(LINK(this, GotoLineDialog, OkButtonHandler)); } +GotoLineDialog::~GotoLineDialog() +{ + dispose(); +} + +void GotoLineDialog::dispose() +{ + m_pEdit.clear(); + m_pOKButton.clear(); + ModalDialog::dispose(); +} + sal_Int32 GotoLineDialog::GetLineNumber() const { return m_pEdit->GetText().toInt32(); @@ -437,6 +461,18 @@ ExportDialog::ExportDialog(vcl::Window * pParent) m_pOKButton->SetClickHdl(LINK(this, ExportDialog, OkButtonHandler)); } +ExportDialog::~ExportDialog() +{ + dispose(); +} + +void ExportDialog::dispose() +{ + m_pExportAsPackageButton.clear(); + m_pOKButton.clear(); + ModalDialog::dispose(); +} + // LibPage LibPage::LibPage(vcl::Window * pParent) : TabPage(pParent, "LibPage", @@ -497,8 +533,16 @@ void LibPage::dispose() DocumentEntry* pEntry = static_cast<DocumentEntry*>(m_pBasicsBox->GetEntryData( i )); delete pEntry; } - m_pBasicsBox = NULL; } + m_pBasicsBox.clear(); + m_pLibBox.clear(); + m_pEditButton.clear(); + m_pPasswordButton.clear(); + m_pNewLibButton.clear(); + m_pInsertLibButton.clear(); + m_pExportButton.clear(); + m_pDelButton.clear(); + pTabDlg.clear(); TabPage::dispose(); } diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index 216fb1d3c92b..d80dbc18ba98 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -495,8 +495,8 @@ void OrganizeDialog::dispose() { for ( sal_uInt16 i = 0; i < m_pTabCtrl->GetPageCount(); i++ ) delete m_pTabCtrl->GetTabPage( m_pTabCtrl->GetPageId( i ) ); - m_pTabCtrl = NULL; } + m_pTabCtrl.clear(); TabDialog::dispose(); }; @@ -598,6 +598,22 @@ ObjectPage::ObjectPage(vcl::Window *pParent, const OString &rName, sal_uInt16 nM CheckButtons(); } +ObjectPage::~ObjectPage() +{ + dispose(); +} + +void ObjectPage::dispose() +{ + m_pBasicBox.clear(); + m_pEditButton.clear(); + m_pNewModButton.clear(); + m_pNewDlgButton.clear(); + m_pDelButton.clear(); + pTabDlg.clear(); + TabPage::dispose(); +} + void ObjectPage::SetCurrentEntry (EntryDescriptor& rDesc) { m_pBasicBox->SetCurrentEntry( rDesc ); @@ -927,6 +943,21 @@ LibDialog::LibDialog( vcl::Window* pParent ) m_pLibBox->set_width_request(m_pLibBox->approximate_char_width() * 32); } +LibDialog::~LibDialog() +{ + dispose(); +} + +void LibDialog::dispose() +{ + m_pStorageFrame.clear(); + m_pLibBox.clear(); + m_pReferenceBox.clear(); + m_pReplaceBox.clear(); + ModalDialog::dispose(); +} + + void LibDialog::SetStorageName( const OUString& rName ) { OUString aName( IDE_RESSTR(RID_STR_FILENAME) ); diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx index 00abbe158ca9..12907c0c2342 100644 --- a/basctl/source/basicide/moduldlg.hxx +++ b/basctl/source/basicide/moduldlg.hxx @@ -48,12 +48,14 @@ namespace ObjectMode class NewObjectDialog : public ModalDialog { private: - Edit* m_pEdit; - OKButton* m_pOKButton; + VclPtr<Edit> m_pEdit; + VclPtr<OKButton> m_pOKButton; DECL_LINK(OkButtonHandler, void *); public: NewObjectDialog (vcl::Window* pParent, ObjectMode::Mode, bool bCheckName = false); + virtual ~NewObjectDialog(); + virtual void dispose() SAL_OVERRIDE; OUString GetObjectName() const { return m_pEdit->GetText(); } void SetObjectName( const OUString& rName ) { @@ -64,19 +66,21 @@ public: class GotoLineDialog : public ModalDialog { - Edit* m_pEdit; - OKButton* m_pOKButton; + VclPtr<Edit> m_pEdit; + VclPtr<OKButton> m_pOKButton; DECL_LINK(OkButtonHandler, void *); public: GotoLineDialog(vcl::Window * pParent); + virtual ~GotoLineDialog(); + virtual void dispose() SAL_OVERRIDE; sal_Int32 GetLineNumber() const; }; class ExportDialog : public ModalDialog { private: - RadioButton* m_pExportAsPackageButton; - OKButton* m_pOKButton; + VclPtr<RadioButton> m_pExportAsPackageButton; + VclPtr<OKButton> m_pOKButton; bool mbExportAsPackage; @@ -84,6 +88,8 @@ private: public: ExportDialog( vcl::Window * pParent ); + virtual ~ExportDialog(); + virtual void dispose() SAL_OVERRIDE; bool isExportAsPackage () const { return mbExportAsPackage; } }; @@ -141,13 +147,15 @@ public: class LibDialog: public ModalDialog { private: - VclFrame* m_pStorageFrame; - CheckBox* m_pLibBox; - ::CheckBox* m_pReferenceBox; - ::CheckBox* m_pReplaceBox; + VclPtr<VclFrame> m_pStorageFrame; + VclPtr<CheckBox> m_pLibBox; + VclPtr<::CheckBox> m_pReferenceBox; + VclPtr<::CheckBox> m_pReplaceBox; public: LibDialog( vcl::Window* pParent ); + virtual ~LibDialog(); + virtual void dispose() SAL_OVERRIDE; void SetStorageName( const OUString& rName ); @@ -162,7 +170,7 @@ public: class OrganizeDialog : public TabDialog { private: - TabControl* m_pTabCtrl; + VclPtr<TabControl> m_pTabCtrl; EntryDescriptor m_aCurEntry; public: @@ -178,11 +186,11 @@ public: class ObjectPage: public TabPage { protected: - ExtTreeListBox* m_pBasicBox; - PushButton* m_pEditButton; - PushButton* m_pNewModButton; - PushButton* m_pNewDlgButton; - PushButton* m_pDelButton; + VclPtr<ExtTreeListBox> m_pBasicBox; + VclPtr<PushButton> m_pEditButton; + VclPtr<PushButton> m_pNewModButton; + VclPtr<PushButton> m_pNewDlgButton; + VclPtr<PushButton> m_pDelButton; DECL_LINK( BasicBoxHighlightHdl, TreeListBox * ); DECL_LINK( ButtonHdl, Button * ); @@ -193,13 +201,15 @@ protected: void NewDialog(); void EndTabDialog( sal_uInt16 nRet ); - TabDialog* pTabDlg; + VclPtr<TabDialog> pTabDlg; virtual void ActivatePage() SAL_OVERRIDE; virtual void DeactivatePage() SAL_OVERRIDE; public: ObjectPage(vcl::Window* pParent, const OString& rName, sal_uInt16 nMode); + virtual ~ObjectPage(); + virtual void dispose() SAL_OVERRIDE; void SetCurrentEntry( EntryDescriptor& rDesc ); void SetTabDlg( TabDialog* p ) { pTabDlg = p;} @@ -209,14 +219,14 @@ public: class LibPage: public TabPage { protected: - ListBox* m_pBasicsBox; - CheckBox* m_pLibBox; - PushButton* m_pEditButton; - PushButton* m_pPasswordButton; - PushButton* m_pNewLibButton; - PushButton* m_pInsertLibButton; - PushButton* m_pExportButton; - PushButton* m_pDelButton; + VclPtr<ListBox> m_pBasicsBox; + VclPtr<CheckBox> m_pLibBox; + VclPtr<PushButton> m_pEditButton; + VclPtr<PushButton> m_pPasswordButton; + VclPtr<PushButton> m_pNewLibButton; + VclPtr<PushButton> m_pInsertLibButton; + VclPtr<PushButton> m_pExportButton; + VclPtr<PushButton> m_pDelButton; ScriptDocument m_aCurDocument; LibraryLocation m_eCurLocation; @@ -242,7 +252,7 @@ protected: virtual void ActivatePage() SAL_OVERRIDE; virtual void DeactivatePage() SAL_OVERRIDE; - TabDialog* pTabDlg; + VclPtr<TabDialog> pTabDlg; public: LibPage( vcl::Window* pParent ); diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx index 953f96b92316..cb0ec81910fd 100644 --- a/basctl/source/dlged/managelang.cxx +++ b/basctl/source/dlged/managelang.cxx @@ -81,6 +81,10 @@ ManageLanguageDialog::~ManageLanguageDialog() void ManageLanguageDialog::dispose() { ClearLanguageBox(); + m_pLanguageLB.clear(); + m_pAddPB.clear(); + m_pDeletePB.clear(); + m_pMakeDefPB.clear(); ModalDialog::dispose(); } @@ -253,6 +257,22 @@ SetDefaultLanguageDialog::SetDefaultLanguageDialog(vcl::Window* pParent, boost:: FillLanguageBox(); } +SetDefaultLanguageDialog::~SetDefaultLanguageDialog() +{ + dispose(); +} + +void SetDefaultLanguageDialog::dispose() +{ + m_pLanguageFT.clear(); + m_pLanguageLB.clear(); + m_pCheckLangFT.clear(); + m_pCheckLangLB.clear(); + m_pDefinedFT.clear(); + m_pAddedFT.clear(); + ModalDialog::dispose(); +} + void SetDefaultLanguageDialog::FillLanguageBox() { // fill list with all languages diff --git a/basctl/source/inc/accessibledialogcontrolshape.hxx b/basctl/source/inc/accessibledialogcontrolshape.hxx index 7192763c27dc..bc0d52b33eec 100644 --- a/basctl/source/inc/accessibledialogcontrolshape.hxx +++ b/basctl/source/inc/accessibledialogcontrolshape.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <comphelper/accessiblecomponenthelper.hxx> #include <cppuhelper/implbase3.hxx> +#include <vcl/vclptr.hxx> namespace vcl { class Window; } class VCLExternalSolarLock; @@ -56,7 +57,7 @@ class AccessibleDialogControlShape : public AccessibleExtendedComponentHelper private: VCLExternalSolarLock* m_pExternalLock; - DialogWindow* m_pDialogWindow; + VclPtr<DialogWindow> m_pDialogWindow; DlgEdObj* m_pDlgEdObj; bool m_bFocused; bool m_bSelected; diff --git a/basctl/source/inc/accessibledialogwindow.hxx b/basctl/source/inc/accessibledialogwindow.hxx index c57b2590ae71..bd2739440160 100644 --- a/basctl/source/inc/accessibledialogwindow.hxx +++ b/basctl/source/inc/accessibledialogwindow.hxx @@ -26,6 +26,7 @@ #include <cppuhelper/implbase3.hxx> #include <svl/lstner.hxx> #include <tools/link.hxx> +#include <vcl/vclptr.hxx> class VCLExternalSolarLock; class VclSimpleEvent; @@ -80,7 +81,7 @@ private: AccessibleChildren m_aAccessibleChildren; VCLExternalSolarLock* m_pExternalLock; - basctl::DialogWindow* m_pDialogWindow; + VclPtr<basctl::DialogWindow> m_pDialogWindow; DlgEditor* m_pDlgEditor; DlgEdModel* m_pDlgEdModel; diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx index 644ccbad2721..de17eb08403c 100644 --- a/basctl/source/inc/baside3.hxx +++ b/basctl/source/inc/baside3.hxx @@ -146,12 +146,12 @@ protected: private: // child window - DialogWindow* pChild; + VclPtr<DialogWindow> pChild; // dockable windows: // object catalog (owned by Shell) ObjectCatalog& rObjectCatalog; // property browser (created by this, deleted by toolkit) - PropBrw* pPropertyBrowser; + VclPtr<PropBrw> pPropertyBrowser; private: void AddPropertyBrowser (); diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index 216f06518316..0baeb579dda1 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -56,7 +56,7 @@ class Shell : public DocumentEventListener { public: - typedef std::map<sal_uInt16, BaseWindow*> WindowTable; + typedef std::map<sal_uInt16, VclPtr<BaseWindow> > WindowTable; typedef WindowTable::const_iterator WindowTableIt; private: @@ -64,9 +64,9 @@ private: friend class LocalizationMgr; friend bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName ); // defined in baside3.cxx - WindowTable aWindowTable; + WindowTable aWindowTable; sal_uInt16 nCurKey; - BaseWindow* pCurWin; + VclPtr<BaseWindow> pCurWin; ScriptDocument m_aCurDocument; OUString m_aCurLibName; boost::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr; @@ -81,7 +81,7 @@ private: boost::scoped_ptr<ModulWindowLayout> pModulLayout; boost::scoped_ptr<DialogWindowLayout> pDialogLayout; // the active layout window - Layout* pLayout; + VclPtr<Layout> pLayout; // common object catalog window VclPtr<ObjectCatalog> aObjectCatalog; diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx index 37e11306111d..8423874c19a9 100644 --- a/basctl/source/inc/bastypes.hxx +++ b/basctl/source/inc/bastypes.hxx @@ -80,7 +80,8 @@ class DockingWindow : public ::DockingWindow public: DockingWindow (vcl::Window* pParent); DockingWindow (Layout* pParent); -public: + virtual ~DockingWindow(); + virtual void dispose() SAL_OVERRIDE; void ResizeIfDocking (Point const&, Size const&); void ResizeIfDocking (Size const&); Size GetDockingSize () const { return aDockingRect.GetSize(); } @@ -102,7 +103,7 @@ private: // the position and the size of the docking window Rectangle aDockingRect; // the parent layout window (only when docking) - Layout* pLayout; + VclPtr<Layout> pLayout; // > 0: shown, <= 0: hidden, ++ by Show() and -- by Hide() int nShowCount; @@ -148,8 +149,8 @@ class EntryDescriptor; class BaseWindow : public vcl::Window { private: - ScrollBar* pShellHScrollBar; - ScrollBar* pShellVScrollBar; + VclPtr<ScrollBar> pShellHScrollBar; + VclPtr<ScrollBar> pShellVScrollBar; DECL_LINK( ScrollHdl, ScrollBar * ); int nStatus; diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx index 6371ac67b72f..18883daa3854 100644 --- a/basctl/source/inc/dlged.hxx +++ b/basctl/source/inc/dlged.hxx @@ -30,6 +30,7 @@ #include <tools/gen.hxx> #include <vcl/timer.hxx> #include <vcl/idle.hxx> +#include <vcl/vclptr.hxx> #include <boost/scoped_ptr.hpp> @@ -106,8 +107,8 @@ private: void Print( Printer* pPrinter, const OUString& rTitle ); private: - ScrollBar* pHScroll; - ScrollBar* pVScroll; + VclPtr<ScrollBar> pHScroll; + VclPtr<ScrollBar> pVScroll; boost::scoped_ptr<DlgEdModel> pDlgEdModel; // never nullptr DlgEdPage* pDlgEdPage; // never nullptr boost::scoped_ptr<DlgEdView> pDlgEdView; // never nullptr diff --git a/basctl/source/inc/managelang.hxx b/basctl/source/inc/managelang.hxx index ab6fb62ceab9..f7b9335e5e24 100644 --- a/basctl/source/inc/managelang.hxx +++ b/basctl/source/inc/managelang.hxx @@ -52,10 +52,10 @@ extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft, class ManageLanguageDialog : public ModalDialog { private: - ListBox* m_pLanguageLB; - PushButton* m_pAddPB; - PushButton* m_pDeletePB; - PushButton* m_pMakeDefPB; + VclPtr<ListBox> m_pLanguageLB; + VclPtr<PushButton> m_pAddPB; + VclPtr<PushButton> m_pDeletePB; + VclPtr<PushButton> m_pMakeDefPB; boost::shared_ptr<LocalizationMgr> m_xLocalizationMgr; @@ -80,12 +80,12 @@ public: class SetDefaultLanguageDialog : public ModalDialog { private: - FixedText* m_pLanguageFT; - SvxLanguageBox* m_pLanguageLB; - FixedText* m_pCheckLangFT; - SvxCheckListBox* m_pCheckLangLB; - FixedText* m_pDefinedFT; - FixedText* m_pAddedFT; + VclPtr<FixedText> m_pLanguageFT; + VclPtr<SvxLanguageBox> m_pLanguageLB; + VclPtr<FixedText> m_pCheckLangFT; + VclPtr<SvxCheckListBox> m_pCheckLangLB; + VclPtr<FixedText> m_pDefinedFT; + VclPtr<FixedText> m_pAddedFT; boost::shared_ptr<LocalizationMgr> m_xLocalizationMgr; @@ -93,6 +93,8 @@ private: public: SetDefaultLanguageDialog(vcl::Window* pParent, boost::shared_ptr<LocalizationMgr> xLMgr); + virtual ~SetDefaultLanguageDialog(); + virtual void dispose() SAL_OVERRIDE; ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > GetLocales() const; }; |