diff options
author | Noel Grandin <noel@peralex.com> | 2015-01-14 16:16:15 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-09 21:23:03 +0100 |
commit | d380e713bc3f74868ccda548efea4509d78db0be (patch) | |
tree | 78f617b5fb70a7217f385a047e98e9d62e38388f | |
parent | ed2cea3e5087b90cd3686d8fd9da7e74981c8da6 (diff) |
vcl: VclPtr conversion in basctl
Change-Id: Ieea1ab9426ed025d7d0f8baba8a6d10cb454e93e
31 files changed, 412 insertions, 274 deletions
diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx index d4cbae63aa88..cbb50ba8cf21 100644 --- a/basctl/source/basicide/basicbox.cxx +++ b/basctl/source/basicide/basicbox.cxx @@ -46,12 +46,6 @@ LibBoxControl::LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx -LibBoxControl::~LibBoxControl() -{ -} - - - void LibBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState ) { LibBox* pBox = static_cast<LibBox*>(GetToolBox().GetItemWindow(GetId())); @@ -88,7 +82,13 @@ DocListenerBox::DocListenerBox( vcl::Window* pParent ) DocListenerBox::~DocListenerBox() { + dispose(); +} + +void DocListenerBox::dispose() +{ m_aNotifier.dispose(); + ListBox::dispose(); } void DocListenerBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) @@ -156,7 +156,13 @@ LibBox::LibBox( vcl::Window* pParent, const uno::Reference< frame::XFrame >& rFr LibBox::~LibBox() { + dispose(); +} + +void LibBox::dispose() +{ ClearBox(); + DocListenerBox::dispose(); } void LibBox::Update( const SfxStringItem* pItem ) @@ -341,10 +347,6 @@ LanguageBoxControl::LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, Tool { } -LanguageBoxControl::~LanguageBoxControl() -{ -} - void LanguageBoxControl::StateChanged( sal_uInt16 nID, SfxItemState eState, const SfxPoolItem* pItem ) { (void)nID; @@ -384,7 +386,13 @@ LanguageBox::LanguageBox( vcl::Window* pParent ) : LanguageBox::~LanguageBox() { + dispose(); +} + +void LanguageBox::dispose() +{ ClearBox(); + DocListenerBox::dispose(); } void LanguageBox::FillBox() diff --git a/basctl/source/basicide/basicbox.hxx b/basctl/source/basicide/basicbox.hxx index e06a51ac7dd2..f13e0ea6e85f 100644 --- a/basctl/source/basicide/basicbox.hxx +++ b/basctl/source/basicide/basicbox.hxx @@ -33,7 +33,6 @@ public: SFX_DECL_TOOLBOX_CONTROL(); LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - virtual ~LibBoxControl(); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; @@ -49,6 +48,7 @@ class DocListenerBox :public ListBox protected: DocListenerBox( vcl::Window* pParent ); virtual ~DocListenerBox(); + virtual void dispose() SAL_OVERRIDE; protected: virtual void FillBox() = 0; @@ -95,7 +95,8 @@ protected: public: LibBox( vcl::Window* pParent, const com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); - virtual ~LibBox(); + virtual ~LibBox(); + virtual void dispose() SAL_OVERRIDE; using Window::Update; void Update( const SfxStringItem* pItem ); @@ -107,7 +108,6 @@ public: SFX_DECL_TOOLBOX_CONTROL(); LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - virtual ~LanguageBoxControl(); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; @@ -135,6 +135,7 @@ protected: public: LanguageBox( vcl::Window* pParent ); virtual ~LanguageBox(); + virtual void dispose() SAL_OVERRIDE; using Window::Update; void Update( const SfxStringItem* pItem ); diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 5253ea982794..a5d4af81b6c7 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -192,10 +192,10 @@ ModulWindow::ModulWindow ( BaseWindow(pParent, rDocument, aLibName, aName), rLayout(*pParent), nValid(ValidWindow), - aXEditorWindow(this), + aXEditorWindow(new ComplexEditorWindow(this)), m_aModule(aModule) { - aXEditorWindow.Show(); + aXEditorWindow->Show(); SetBackground(); } @@ -227,9 +227,15 @@ SbModuleRef ModulWindow::XModule() ModulWindow::~ModulWindow() { - nValid = 0; + dispose(); +} +void ModulWindow::dispose() +{ + nValid = 0; StarBASIC::Stop(); + aXEditorWindow.disposeAndClear(); + BaseWindow::dispose(); } @@ -237,7 +243,7 @@ void ModulWindow::GetFocus() { if (nValid != ValidWindow) return; - aXEditorWindow.GetEdtWindow().GrabFocus(); + aXEditorWindow->GetEdtWindow().GrabFocus(); // don't call basic calls because focus is somewhere else... } @@ -256,7 +262,7 @@ void ModulWindow::Paint( const Rectangle& ) void ModulWindow::Resize() { - aXEditorWindow.SetPosSizePixel( Point( 0, 0 ), + aXEditorWindow->SetPosSizePixel( Point( 0, 0 ), Size( GetOutputSizePixel() ) ); } @@ -580,7 +586,7 @@ bool ModulWindow::BasicToggleBreakPoint() bNewBreakPoint = true; } - aXEditorWindow.GetBrkWindow().Invalidate(); + aXEditorWindow->GetBrkWindow().Invalidate(); return bNewBreakPoint; } @@ -638,7 +644,7 @@ bool ModulWindow::BasicErrorHdl( StarBASIC * pBasic ) // if other basic, the IDE should try to display the correct module bool const bMarkError = pBasic == GetBasic(); if ( bMarkError ) - aXEditorWindow.GetBrkWindow().SetMarkerPos(nErrorLine, true); + aXEditorWindow->GetBrkWindow().SetMarkerPos(nErrorLine, true); // #i47002# Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( this ); @@ -651,7 +657,7 @@ bool ModulWindow::BasicErrorHdl( StarBASIC * pBasic ) return false; if ( bMarkError ) - aXEditorWindow.GetBrkWindow().SetNoMarker(); + aXEditorWindow->GetBrkWindow().SetNoMarker(); return false; } @@ -676,7 +682,7 @@ long ModulWindow::BasicBreakHdl( StarBASIC* pBasic ) AssertValidEditEngine(); GetEditView()->SetSelection( TextSelection( TextPaM( nErrorLine, 0 ), TextPaM( nErrorLine, 0 ) ) ); - aXEditorWindow.GetBrkWindow().SetMarkerPos( nErrorLine ); + aXEditorWindow->GetBrkWindow().SetMarkerPos( nErrorLine ); rLayout.UpdateDebug(false); @@ -691,7 +697,7 @@ long ModulWindow::BasicBreakHdl( StarBASIC* pBasic ) Application::Yield(); aStatus.bIsInReschedule = false; - aXEditorWindow.GetBrkWindow().SetNoMarker(); + aXEditorWindow->GetBrkWindow().SetNoMarker(); ClearStatus( BASWIN_INRESCHEDULE ); @@ -1022,7 +1028,7 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq) { SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), false); bSourceLinesEnabled = pItem && pItem->GetValue(); - aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled); + aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled); } break; case SID_BASICIDE_DELETECURRENT: @@ -1236,7 +1242,7 @@ void ModulWindow::AssertValidEditEngine() void ModulWindow::Activating () { - aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled); + aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled); Show(); } @@ -1420,7 +1426,7 @@ bool ModulWindow::IsPasteAllowed() void ModulWindow::OnNewDocument () { - aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled); + aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled); } char const* ModulWindow::GetHid () const @@ -1464,15 +1470,27 @@ void ModulWindow::UpdateModule () ModulWindowLayout::ModulWindowLayout (vcl::Window* pParent, ObjectCatalog& rObjectCatalog_) : Layout(pParent), pChild(0), - aWatchWindow(this), - aStackWindow(this), + aWatchWindow(new WatchWindow(this)), + aStackWindow(new StackWindow(this)), rObjectCatalog(rObjectCatalog_) { } +ModulWindowLayout::~ModulWindowLayout() +{ + dispose(); +} + +void ModulWindowLayout::dispose() +{ + aWatchWindow.disposeAndClear(); + aStackWindow.disposeAndClear(); + Layout::dispose(); +} + void ModulWindowLayout::UpdateDebug (bool bBasicStopped) { - aWatchWindow.UpdateWatches(bBasicStopped); - aStackWindow.UpdateCalls(); + aWatchWindow->UpdateWatches(bBasicStopped); + aStackWindow->UpdateCalls(); } void ModulWindowLayout::Paint (Rectangle const&) @@ -1493,8 +1511,8 @@ void ModulWindowLayout::Activating (BaseWindow& rChild) { assert(dynamic_cast<ModulWindow*>(&rChild)); pChild = &static_cast<ModulWindow&>(rChild); - aWatchWindow.Show(); - aStackWindow.Show(); + aWatchWindow->Show(); + aStackWindow->Show(); rObjectCatalog.Show(); rObjectCatalog.SetLayoutWindow(this); rObjectCatalog.UpdateEntries(); @@ -1506,8 +1524,8 @@ void ModulWindowLayout::Deactivating () { aSyntaxColors.SetActiveEditor(0); Layout::Deactivating(); - aWatchWindow.Hide(); - aStackWindow.Hide(); + aWatchWindow->Hide(); + aStackWindow->Hide(); rObjectCatalog.Hide(); pChild = 0; } @@ -1528,19 +1546,19 @@ void ModulWindowLayout::GetState (SfxItemSet &rSet, unsigned nWhich) void ModulWindowLayout::BasicAddWatch (OUString const& rWatchStr) { - aWatchWindow.AddWatch(rWatchStr); + aWatchWindow->AddWatch(rWatchStr); } void ModulWindowLayout::BasicRemoveWatch () { - aWatchWindow.RemoveSelectedWatch(); + aWatchWindow->RemoveSelectedWatch(); } void ModulWindowLayout::OnFirstSize (long const nWidth, long const nHeight) { AddToLeft(&rObjectCatalog, Size(nWidth * 0.20, nHeight * 0.75)); - AddToBottom(&aWatchWindow, Size(nWidth * 0.67, nHeight * 0.25)); - AddToBottom(&aStackWindow, Size(nWidth * 0.33, nHeight * 0.25)); + AddToBottom(aWatchWindow.get(), Size(nWidth * 0.67, nHeight * 0.25)); + AddToBottom(aStackWindow.get(), Size(nWidth * 0.33, nHeight * 0.25)); } diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 595db9ebc8c6..48874b01c69b 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -137,6 +137,7 @@ protected: public: EditorWindow (vcl::Window* pParent, ModulWindow*); virtual ~EditorWindow(); + virtual void dispose() SAL_OVERRIDE; ExtTextEngine* GetEditEngine() const { return pEditEngine.get(); } ExtTextView* GetEditView() const { return pEditView.get(); } @@ -186,7 +187,6 @@ protected: public: BreakPointWindow (vcl::Window* pParent, ModulWindow*); - virtual ~BreakPointWindow(); void SetMarkerPos( sal_uInt16 nLine, bool bErrorMarker = false ); void SetNoMarker (); @@ -211,6 +211,7 @@ protected: public: WatchTreeListBox( vcl::Window* pParent, WinBits nWinBits ); virtual ~WatchTreeListBox(); + virtual void dispose() SAL_OVERRIDE; void RequestingChildren( SvTreeListEntry * pParent ) SAL_OVERRIDE; void UpdateWatches( bool bBasicStopped = false ); @@ -225,10 +226,10 @@ class WatchWindow : public DockingWindow { private: OUString aWatchStr; - ExtendedEdit aXEdit; - ImageButton aRemoveWatchButton; - WatchTreeListBox aTreeListBox; - HeaderBar aHeaderBar; + VclPtr<ExtendedEdit> aXEdit; + VclPtr<ImageButton> aRemoveWatchButton; + VclPtr<WatchTreeListBox> aTreeListBox; + VclPtr<HeaderBar> aHeaderBar; protected: virtual void Resize() SAL_OVERRIDE; @@ -243,20 +244,21 @@ protected: public: WatchWindow (Layout* pParent); virtual ~WatchWindow(); + virtual void dispose() SAL_OVERRIDE; void AddWatch( const OUString& rVName ); bool RemoveSelectedWatch(); void UpdateWatches( bool bBasicStopped = false ); - WatchTreeListBox& GetWatchTreeListBox() { return aTreeListBox; } + WatchTreeListBox& GetWatchTreeListBox() { return *aTreeListBox.get(); } }; class StackWindow : public DockingWindow { private: - SvTreeListBox aTreeListBox; - OUString aStackStr; + VclPtr<SvTreeListBox> aTreeListBox; + OUString aStackStr; protected: virtual void Resize() SAL_OVERRIDE; @@ -265,6 +267,7 @@ protected: public: StackWindow (Layout* pParent); virtual ~StackWindow(); + virtual void dispose() SAL_OVERRIDE; void UpdateCalls(); }; @@ -273,10 +276,10 @@ public: class ComplexEditorWindow : public vcl::Window { private: - BreakPointWindow aBrkWindow; - LineNumberWindow aLineNumberWindow; - EditorWindow aEdtWindow; - ScrollBar aEWVScrollBar; + VclPtr<BreakPointWindow> aBrkWindow; + VclPtr<LineNumberWindow> aLineNumberWindow; + VclPtr<EditorWindow> aEdtWindow; + VclPtr<ScrollBar> aEWVScrollBar; virtual void DataChanged(DataChangedEvent const & rDCEvt) SAL_OVERRIDE; @@ -286,11 +289,12 @@ protected: public: ComplexEditorWindow( ModulWindow* pParent ); - - BreakPointWindow& GetBrkWindow() { return aBrkWindow; } - LineNumberWindow& GetLineNumberWindow() { return aLineNumberWindow; } - EditorWindow& GetEdtWindow() { return aEdtWindow; } - ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; } + virtual ~ComplexEditorWindow(); + virtual void dispose() SAL_OVERRIDE; + BreakPointWindow& GetBrkWindow() { return *aBrkWindow.get(); } + LineNumberWindow& GetLineNumberWindow() { return *aLineNumberWindow.get(); } + EditorWindow& GetEdtWindow() { return *aEdtWindow.get(); } + ScrollBar& GetEWVScrollBar() { return *aEWVScrollBar.get(); } void SetLineNumberDisplay(bool b); }; @@ -302,7 +306,7 @@ private: ModulWindowLayout& rLayout; StarBASICRef xBasic; short nValid; - ComplexEditorWindow aXEditorWindow; + VclPtr<ComplexEditorWindow> aXEditorWindow; BasicStatus aStatus; SbModuleRef xModule; OUString aCurPath; @@ -328,6 +332,7 @@ public: ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDocument, const OUString& aLibName, const OUString& aName, OUString& aModule ); virtual ~ModulWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void ExecuteCommand (SfxRequest& rReq) SAL_OVERRIDE; virtual void ExecuteGlobal (SfxRequest& rReq) SAL_OVERRIDE; @@ -386,10 +391,10 @@ public: virtual sal_uInt16 GetSearchOptions() SAL_OVERRIDE; virtual sal_uInt16 StartSearchAndReplace (SvxSearchItem const&, bool bFromStart = false) SAL_OVERRIDE; - EditorWindow& GetEditorWindow() { return aXEditorWindow.GetEdtWindow(); } - BreakPointWindow& GetBreakPointWindow() { return aXEditorWindow.GetBrkWindow(); } - LineNumberWindow& GetLineNumberWindow() { return aXEditorWindow.GetLineNumberWindow(); } - ScrollBar& GetEditVScrollBar() { return aXEditorWindow.GetEWVScrollBar(); } + EditorWindow& GetEditorWindow() { return aXEditorWindow->GetEdtWindow(); } + BreakPointWindow& GetBreakPointWindow() { return aXEditorWindow->GetBrkWindow(); } + LineNumberWindow& GetLineNumberWindow() { return aXEditorWindow->GetLineNumberWindow(); } + ScrollBar& GetEditVScrollBar() { return aXEditorWindow->GetEWVScrollBar(); } ExtTextEngine* GetEditEngine() { return GetEditorWindow().GetEditEngine(); } ExtTextView* GetEditView() { return GetEditorWindow().GetEditView(); } BreakPointList& GetBreakPoints() { return GetBreakPointWindow().GetBreakPoints(); } @@ -419,6 +424,8 @@ class ModulWindowLayout: public Layout { public: ModulWindowLayout (vcl::Window* pParent, ObjectCatalog&); + virtual ~ModulWindowLayout(); + virtual void dispose() SAL_OVERRIDE; public: // Layout: virtual void Activating (BaseWindow&) SAL_OVERRIDE; @@ -440,8 +447,8 @@ private: // main child window ModulWindow* pChild; // dockable windows - WatchWindow aWatchWindow; - StackWindow aStackWindow; + VclPtr<WatchWindow> aWatchWindow; + VclPtr<StackWindow> aStackWindow; ObjectCatalog& rObjectCatalog; private: virtual void DataChanged (DataChangedEvent const& rDCEvt) SAL_OVERRIDE; @@ -511,7 +518,8 @@ private: public: CodeCompleteWindow( EditorWindow* pPar ); - virtual ~CodeCompleteWindow(){ delete pListBox; } + virtual ~CodeCompleteWindow(); + virtual void dispose() SAL_OVERRIDE; void InsertEntry( const OUString& aStr ); void ClearListBox(); diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 72888568ff68..0d1878a1945e 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -250,6 +250,11 @@ EditorWindow::EditorWindow (vcl::Window* pParent, ModulWindow* pModulWindow) : EditorWindow::~EditorWindow() { + dispose(); +} + +void EditorWindow::dispose() +{ Reference< beans::XMultiPropertySet > n; { osl::MutexGuard g(mutex_); @@ -1376,12 +1381,6 @@ BreakPointWindow::BreakPointWindow (vcl::Window* pParent, ModulWindow* pModulWin SetHelpId(HID_BASICIDE_BREAKPOINTWINDOW); } -BreakPointWindow::~BreakPointWindow() -{ -} - - - void BreakPointWindow::Paint( const Rectangle& ) { if ( SyncYOffset() ) @@ -1598,69 +1597,69 @@ namespace WatchWindow::WatchWindow (Layout* pParent) : DockingWindow(pParent), aWatchStr( IDEResId( RID_STR_REMOVEWATCH ) ), - aXEdit( this, IDEResId( RID_EDT_WATCHEDIT ) ), - aRemoveWatchButton( this, IDEResId( RID_IMGBTN_REMOVEWATCH ) ), - aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HASBUTTONS | WB_HASLINES | WB_HSCROLL | WB_TABSTOP - | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ), - aHeaderBar( this, WB_BUTTONSTYLE | WB_BORDER ) + aXEdit( new ExtendedEdit(this, IDEResId( RID_EDT_WATCHEDIT )) ), + aRemoveWatchButton( new ImageButton(this, IDEResId( RID_IMGBTN_REMOVEWATCH )) ), + aTreeListBox( new WatchTreeListBox(this, WB_BORDER | WB_3DLOOK | WB_HASBUTTONS | WB_HASLINES | WB_HSCROLL | WB_TABSTOP + | WB_HASLINESATROOT | WB_HASBUTTONSATROOT) ), + aHeaderBar( new HeaderBar( this, WB_BUTTONSTYLE | WB_BORDER ) ) { - aXEdit.SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString()); - aTreeListBox.SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString()); + aXEdit->SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString()); + aTreeListBox->SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString()); long nTextLen = GetTextWidth( aWatchStr ) + DWBORDER + 3; - aXEdit.SetPosPixel( Point( nTextLen, 3 ) ); - aXEdit.SetAccHdl( LINK( this, WatchWindow, EditAccHdl ) ); - aXEdit.GetAccelerator().InsertItem( 1, vcl::KeyCode( KEY_RETURN ) ); - aXEdit.GetAccelerator().InsertItem( 2, vcl::KeyCode( KEY_ESCAPE ) ); - aXEdit.Show(); - - aRemoveWatchButton.Disable(); - aRemoveWatchButton.SetClickHdl( LINK( this, WatchWindow, ButtonHdl ) ); - aRemoveWatchButton.SetPosPixel( Point( nTextLen + aXEdit.GetSizePixel().Width() + 4, 2 ) ); - Size aSz( aRemoveWatchButton.GetModeImage().GetSizePixel() ); + aXEdit->SetPosPixel( Point( nTextLen, 3 ) ); + aXEdit->SetAccHdl( LINK( this, WatchWindow, EditAccHdl ) ); + aXEdit->GetAccelerator().InsertItem( 1, vcl::KeyCode( KEY_RETURN ) ); + aXEdit->GetAccelerator().InsertItem( 2, vcl::KeyCode( KEY_ESCAPE ) ); + aXEdit->Show(); + + aRemoveWatchButton->Disable(); + aRemoveWatchButton->SetClickHdl( LINK( this, WatchWindow, ButtonHdl ) ); + aRemoveWatchButton->SetPosPixel( Point( nTextLen + aXEdit->GetSizePixel().Width() + 4, 2 ) ); + Size aSz( aRemoveWatchButton->GetModeImage().GetSizePixel() ); aSz.Width() += 6; aSz.Height() += 6; - aRemoveWatchButton.SetSizePixel( aSz ); - aRemoveWatchButton.Show(); + aRemoveWatchButton->SetSizePixel( aSz ); + aRemoveWatchButton->Show(); - long nRWBtnSize = aRemoveWatchButton.GetModeImage().GetSizePixel().Height() + 10; - nVirtToolBoxHeight = aXEdit.GetSizePixel().Height() + 7; + long nRWBtnSize = aRemoveWatchButton->GetModeImage().GetSizePixel().Height() + 10; + nVirtToolBoxHeight = aXEdit->GetSizePixel().Height() + 7; if ( nRWBtnSize > nVirtToolBoxHeight ) nVirtToolBoxHeight = nRWBtnSize; nHeaderBarHeight = 16; - aTreeListBox.SetHelpId(HID_BASICIDE_WATCHWINDOW_LIST); - aTreeListBox.EnableInplaceEditing(true); - aTreeListBox.SetSelectHdl( LINK( this, WatchWindow, TreeListHdl ) ); - aTreeListBox.SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight + nHeaderBarHeight ) ); - aTreeListBox.SetHighlightRange( 1, 5 ); + aTreeListBox->SetHelpId(HID_BASICIDE_WATCHWINDOW_LIST); + aTreeListBox->EnableInplaceEditing(true); + aTreeListBox->SetSelectHdl( LINK( this, WatchWindow, TreeListHdl ) ); + aTreeListBox->SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight + nHeaderBarHeight ) ); + aTreeListBox->SetHighlightRange( 1, 5 ); Point aPnt( DWBORDER, nVirtToolBoxHeight + 1 ); - aHeaderBar.SetPosPixel( aPnt ); - aHeaderBar.SetEndDragHdl( LINK( this, WatchWindow, implEndDragHdl ) ); + aHeaderBar->SetPosPixel( aPnt ); + aHeaderBar->SetEndDragHdl( LINK( this, WatchWindow, implEndDragHdl ) ); long nVarTabWidth = 220; long nValueTabWidth = 100; long nTypeTabWidth = 1250; - aHeaderBar.InsertItem( ITEM_ID_VARIABLE, IDEResId(RID_STR_WATCHVARIABLE).toString(), nVarTabWidth ); - aHeaderBar.InsertItem( ITEM_ID_VALUE, IDEResId(RID_STR_WATCHVALUE).toString(), nValueTabWidth ); - aHeaderBar.InsertItem( ITEM_ID_TYPE, IDEResId(RID_STR_WATCHTYPE).toString(), nTypeTabWidth ); + aHeaderBar->InsertItem( ITEM_ID_VARIABLE, IDEResId(RID_STR_WATCHVARIABLE).toString(), nVarTabWidth ); + aHeaderBar->InsertItem( ITEM_ID_VALUE, IDEResId(RID_STR_WATCHVALUE).toString(), nValueTabWidth ); + aHeaderBar->InsertItem( ITEM_ID_TYPE, IDEResId(RID_STR_WATCHTYPE).toString(), nTypeTabWidth ); long tabs[ 4 ]; tabs[ 0 ] = 3; // two tabs tabs[ 1 ] = 0; tabs[ 2 ] = nVarTabWidth; tabs[ 3 ] = nVarTabWidth + nValueTabWidth; - aTreeListBox.SvHeaderTabListBox::SetTabs( tabs, MAP_PIXEL ); - aTreeListBox.InitHeaderBar( &aHeaderBar ); + aTreeListBox->SvHeaderTabListBox::SetTabs( tabs, MAP_PIXEL ); + aTreeListBox->InitHeaderBar( aHeaderBar.get() ); - aTreeListBox.SetNodeDefaultImages( ); + aTreeListBox->SetNodeDefaultImages( ); - aHeaderBar.Show(); + aHeaderBar->Show(); - aTreeListBox.Show(); + aTreeListBox->Show(); SetText(IDEResId(RID_STR_WATCHNAME).toString()); @@ -1674,6 +1673,15 @@ WatchWindow::WatchWindow (Layout* pParent) : WatchWindow::~WatchWindow() { + dispose(); +} + +void WatchWindow::dispose() +{ + aXEdit.disposeAndClear(); + aRemoveWatchButton.disposeAndClear(); + aHeaderBar.disposeAndClear(); + aTreeListBox.disposeAndClear(); GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this ); } @@ -1698,11 +1706,11 @@ void WatchWindow::Resize() aBoxSz.Height() = 0; aBoxSz.Height() -= nHeaderBarHeight; - aTreeListBox.SetSizePixel( aBoxSz ); - aTreeListBox.GetHScroll()->SetPageSize( aTreeListBox.GetHScroll()->GetVisibleSize() ); + aTreeListBox->SetSizePixel( aBoxSz ); + aTreeListBox->GetHScroll()->SetPageSize( aTreeListBox->GetHScroll()->GetVisibleSize() ); aBoxSz.Height() = nHeaderBarHeight; - aHeaderBar.SetSizePixel( aBoxSz ); + aHeaderBar->SetSizePixel( aBoxSz ); Invalidate(); } @@ -1766,29 +1774,29 @@ void WatchWindow::AddWatch( const OUString& rVName ) OUString aWatchStr_( aVar ); aWatchStr_ += "\t\t"; - SvTreeListEntry* pNewEntry = aTreeListBox.InsertEntry( aWatchStr_, 0, true, TREELIST_APPEND ); + SvTreeListEntry* pNewEntry = aTreeListBox->InsertEntry( aWatchStr_, 0, true, TREELIST_APPEND ); pNewEntry->SetUserData( pWatchItem ); - aTreeListBox.Select(pNewEntry, true); - aTreeListBox.MakeVisible(pNewEntry); - aRemoveWatchButton.Enable(); + aTreeListBox->Select(pNewEntry, true); + aTreeListBox->MakeVisible(pNewEntry); + aRemoveWatchButton->Enable(); UpdateWatches(); } bool WatchWindow::RemoveSelectedWatch() { - SvTreeListEntry* pEntry = aTreeListBox.GetCurEntry(); + SvTreeListEntry* pEntry = aTreeListBox->GetCurEntry(); if ( pEntry ) { - aTreeListBox.GetModel()->Remove( pEntry ); - pEntry = aTreeListBox.GetCurEntry(); + aTreeListBox->GetModel()->Remove( pEntry ); + pEntry = aTreeListBox->GetCurEntry(); if ( pEntry ) - aXEdit.SetText( static_cast<WatchItem*>(pEntry->GetUserData())->maName ); + aXEdit->SetText( static_cast<WatchItem*>(pEntry->GetUserData())->maName ); else - aXEdit.SetText( OUString() ); - if ( !aTreeListBox.GetEntryCount() ) - aRemoveWatchButton.Disable(); + aXEdit->SetText( OUString() ); + if ( !aTreeListBox->GetEntryCount() ) + aRemoveWatchButton->Disable(); return true; } else @@ -1798,7 +1806,7 @@ bool WatchWindow::RemoveSelectedWatch() IMPL_LINK_INLINE_START( WatchWindow, ButtonHdl, ImageButton *, pButton ) { - if (pButton == &aRemoveWatchButton) + if (pButton == aRemoveWatchButton.get()) if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute(SID_BASICIDE_REMOVEWATCH); return 0; @@ -1809,9 +1817,9 @@ IMPL_LINK_INLINE_END( WatchWindow, ButtonHdl, ImageButton *, pButton ) IMPL_LINK_NOARG_INLINE_START(WatchWindow, TreeListHdl) { - SvTreeListEntry* pCurEntry = aTreeListBox.GetCurEntry(); + SvTreeListEntry* pCurEntry = aTreeListBox->GetCurEntry(); if ( pCurEntry && pCurEntry->GetUserData() ) - aXEdit.SetText( static_cast<WatchItem*>(pCurEntry->GetUserData())->maName ); + aXEdit->SetText( static_cast<WatchItem*>(pCurEntry->GetUserData())->maName ); return 0; } @@ -1824,29 +1832,29 @@ IMPL_LINK_INLINE_START( WatchWindow, implEndDragHdl, HeaderBar *, pBar ) const sal_Int32 TAB_WIDTH_MIN = 10; sal_Int32 nMaxWidth = - aHeaderBar.GetSizePixel().getWidth() - 2 * TAB_WIDTH_MIN; + aHeaderBar->GetSizePixel().getWidth() - 2 * TAB_WIDTH_MIN; - sal_Int32 nVariableWith = aHeaderBar.GetItemSize( ITEM_ID_VARIABLE ); + sal_Int32 nVariableWith = aHeaderBar->GetItemSize( ITEM_ID_VARIABLE ); if( nVariableWith < TAB_WIDTH_MIN ) - aHeaderBar.SetItemSize( ITEM_ID_VARIABLE, TAB_WIDTH_MIN ); + aHeaderBar->SetItemSize( ITEM_ID_VARIABLE, TAB_WIDTH_MIN ); else if( nVariableWith > nMaxWidth ) - aHeaderBar.SetItemSize( ITEM_ID_VARIABLE, nMaxWidth ); + aHeaderBar->SetItemSize( ITEM_ID_VARIABLE, nMaxWidth ); - sal_Int32 nValueWith = aHeaderBar.GetItemSize( ITEM_ID_VALUE ); + sal_Int32 nValueWith = aHeaderBar->GetItemSize( ITEM_ID_VALUE ); if( nValueWith < TAB_WIDTH_MIN ) - aHeaderBar.SetItemSize( ITEM_ID_VALUE, TAB_WIDTH_MIN ); + aHeaderBar->SetItemSize( ITEM_ID_VALUE, TAB_WIDTH_MIN ); else if( nValueWith > nMaxWidth ) - aHeaderBar.SetItemSize( ITEM_ID_VALUE, nMaxWidth ); + aHeaderBar->SetItemSize( ITEM_ID_VALUE, nMaxWidth ); - if (aHeaderBar.GetItemSize( ITEM_ID_TYPE ) < TAB_WIDTH_MIN) - aHeaderBar.SetItemSize( ITEM_ID_TYPE, TAB_WIDTH_MIN ); + if (aHeaderBar->GetItemSize( ITEM_ID_TYPE ) < TAB_WIDTH_MIN) + aHeaderBar->SetItemSize( ITEM_ID_TYPE, TAB_WIDTH_MIN ); sal_Int32 nPos = 0; - sal_uInt16 nTabs = aHeaderBar.GetItemCount(); + sal_uInt16 nTabs = aHeaderBar->GetItemCount(); for( sal_uInt16 i = 1 ; i < nTabs ; ++i ) { - nPos += aHeaderBar.GetItemSize( i ); - aTreeListBox.SetTab( i, nPos, MAP_PIXEL ); + nPos += aHeaderBar->GetItemSize( i ); + aTreeListBox->SetTab( i, nPos, MAP_PIXEL ); } return 0; } @@ -1859,17 +1867,17 @@ IMPL_LINK( WatchWindow, EditAccHdl, Accelerator *, pAcc ) { case KEY_RETURN: { - OUString aCurText( aXEdit.GetText() ); + OUString aCurText( aXEdit->GetText() ); if ( !aCurText.isEmpty() ) { AddWatch( aCurText ); - aXEdit.SetSelection( Selection( 0, 0xFFFF ) ); + aXEdit->SetSelection( Selection( 0, 0xFFFF ) ); } } break; case KEY_ESCAPE: { - aXEdit.SetText( OUString() ); + aXEdit->SetText( OUString() ); } break; } @@ -1879,7 +1887,7 @@ IMPL_LINK( WatchWindow, EditAccHdl, Accelerator *, pAcc ) void WatchWindow::UpdateWatches( bool bBasicStopped ) { - aTreeListBox.UpdateWatches( bBasicStopped ); + aTreeListBox->UpdateWatches( bBasicStopped ); } @@ -1890,16 +1898,16 @@ void WatchWindow::UpdateWatches( bool bBasicStopped ) StackWindow::StackWindow (Layout* pParent) : DockingWindow(pParent), - aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP ), + aTreeListBox( new SvTreeListBox(this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP) ), aStackStr( IDEResId( RID_STR_STACK ) ) { - aTreeListBox.SetHelpId(HID_BASICIDE_STACKWINDOW_LIST); - aTreeListBox.SetAccessibleName(IDEResId(RID_STR_STACKNAME).toString()); - aTreeListBox.SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight ) ); - aTreeListBox.SetHighlightRange(); - aTreeListBox.SetSelectionMode( NO_SELECTION ); - aTreeListBox.InsertEntry( OUString(), 0, false, TREELIST_APPEND ); - aTreeListBox.Show(); + aTreeListBox->SetHelpId(HID_BASICIDE_STACKWINDOW_LIST); + aTreeListBox->SetAccessibleName(IDEResId(RID_STR_STACKNAME).toString()); + aTreeListBox->SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight ) ); + aTreeListBox->SetHighlightRange(); + aTreeListBox->SetSelectionMode( NO_SELECTION ); + aTreeListBox->InsertEntry( OUString(), 0, false, TREELIST_APPEND ); + aTreeListBox->Show(); SetText(IDEResId(RID_STR_STACKNAME).toString()); @@ -1913,7 +1921,14 @@ StackWindow::StackWindow (Layout* pParent) : StackWindow::~StackWindow() { + dispose(); +} + +void StackWindow::dispose() +{ GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this ); + aTreeListBox.disposeAndClear(); + DockingWindow::dispose(); } @@ -1936,20 +1951,20 @@ void StackWindow::Resize() if ( aBoxSz.Height() < 4 ) aBoxSz.Height() = 0; - aTreeListBox.SetSizePixel( aBoxSz ); + aTreeListBox->SetSizePixel( aBoxSz ); Invalidate(); } void StackWindow::UpdateCalls() { - aTreeListBox.SetUpdateMode(false); - aTreeListBox.Clear(); + aTreeListBox->SetUpdateMode(false); + aTreeListBox->Clear(); if ( StarBASIC::IsRunning() ) { SbxError eOld = SbxBase::GetError(); - aTreeListBox.SetSelectionMode( SINGLE_SELECTION ); + aTreeListBox->SetSelectionMode( SINGLE_SELECTION ); sal_Int32 nScope = 0; SbMethod* pMethod = StarBASIC::GetActiveMethod( nScope ); @@ -1998,7 +2013,7 @@ void StackWindow::UpdateCalls() } aEntry += ")"; } - aTreeListBox.InsertEntry( aEntry, 0, false, TREELIST_APPEND ); + aTreeListBox->InsertEntry( aEntry, 0, false, TREELIST_APPEND ); nScope++; pMethod = StarBASIC::GetActiveMethod( nScope ); } @@ -2009,11 +2024,11 @@ void StackWindow::UpdateCalls() } else { - aTreeListBox.SetSelectionMode( NO_SELECTION ); - aTreeListBox.InsertEntry( OUString(), 0, false, TREELIST_APPEND ); + aTreeListBox->SetSelectionMode( NO_SELECTION ); + aTreeListBox->InsertEntry( OUString(), 0, false, TREELIST_APPEND ); } - aTreeListBox.SetUpdateMode(true); + aTreeListBox->SetUpdateMode(true); } @@ -2024,18 +2039,33 @@ void StackWindow::UpdateCalls() ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) : Window( pParent, WB_3DLOOK | WB_CLIPCHILDREN ), - aBrkWindow(this, pParent), - aLineNumberWindow(this, pParent), - aEdtWindow(this, pParent), - aEWVScrollBar( this, WB_VSCROLL | WB_DRAG ) + aBrkWindow(new BreakPointWindow(this, pParent)), + aLineNumberWindow(new LineNumberWindow(this, pParent)), + aEdtWindow(new EditorWindow(this, pParent)), + aEWVScrollBar( new ScrollBar(this, WB_VSCROLL | WB_DRAG) ) +{ + aEdtWindow->Show(); + aBrkWindow->Show(); + + aEWVScrollBar->SetLineSize(nScrollLine); + aEWVScrollBar->SetPageSize(nScrollPage); + aEWVScrollBar->SetScrollHdl( LINK( this, ComplexEditorWindow, ScrollHdl ) ); + aEWVScrollBar->Show(); +} + + +ComplexEditorWindow::~ComplexEditorWindow() { - aEdtWindow.Show(); - aBrkWindow.Show(); + dispose(); +} - aEWVScrollBar.SetLineSize(nScrollLine); - aEWVScrollBar.SetPageSize(nScrollPage); - aEWVScrollBar.SetScrollHdl( LINK( this, ComplexEditorWindow, ScrollHdl ) ); - aEWVScrollBar.Show(); +void ComplexEditorWindow::dispose() +{ + aBrkWindow.disposeAndClear(); + aLineNumberWindow.disposeAndClear(); + aEdtWindow.disposeAndClear(); + aEWVScrollBar.disposeAndClear(); + vcl::Window::dispose(); } void ComplexEditorWindow::Resize() @@ -2045,40 +2075,40 @@ void ComplexEditorWindow::Resize() aSz.Width() -= 2*DWBORDER; aSz.Height() -= 2*DWBORDER; long nBrkWidth = 20; - long nSBWidth = aEWVScrollBar.GetSizePixel().Width(); + long nSBWidth = aEWVScrollBar->GetSizePixel().Width(); Size aBrkSz(nBrkWidth, aSz.Height()); - Size aLnSz(aLineNumberWindow.GetWidth(), aSz.Height()); + Size aLnSz(aLineNumberWindow->GetWidth(), aSz.Height()); - if (aLineNumberWindow.IsVisible()) + if (aLineNumberWindow->IsVisible()) { - aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz ); - aLineNumberWindow.SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aLnSz); - Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow.GetWidth() - nSBWidth + 2, aSz.Height()); - aEdtWindow.SetPosSizePixel( Point( DWBORDER + aBrkSz.Width() + aLnSz.Width() - 1, DWBORDER ), aEWSz ); + aBrkWindow->SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz ); + aLineNumberWindow->SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aLnSz); + Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow->GetWidth() - nSBWidth + 2, aSz.Height()); + aEdtWindow->SetPosSizePixel( Point( DWBORDER + aBrkSz.Width() + aLnSz.Width() - 1, DWBORDER ), aEWSz ); } else { - aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz ); + aBrkWindow->SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz ); Size aEWSz(aSz.Width() - nBrkWidth - nSBWidth + 2, aSz.Height()); - aEdtWindow.SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aEWSz); + aEdtWindow->SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aEWSz); } - aEWVScrollBar.SetPosSizePixel( Point( aOutSz.Width() - DWBORDER - nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) ); + aEWVScrollBar->SetPosSizePixel( Point( aOutSz.Width() - DWBORDER - nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) ); } IMPL_LINK( ComplexEditorWindow, ScrollHdl, ScrollBar *, pCurScrollBar ) { - if ( aEdtWindow.GetEditView() ) + if ( aEdtWindow->GetEditView() ) { - DBG_ASSERT( pCurScrollBar == &aEWVScrollBar, "Wer scrollt hier ?" ); - long nDiff = aEdtWindow.GetEditView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos(); - aEdtWindow.GetEditView()->Scroll( 0, nDiff ); - aBrkWindow.DoScroll( 0, nDiff ); - aLineNumberWindow.DoScroll(0, nDiff); - aEdtWindow.GetEditView()->ShowCursor(false, true); - pCurScrollBar->SetThumbPos( aEdtWindow.GetEditView()->GetStartDocPos().Y() ); + DBG_ASSERT( pCurScrollBar == aEWVScrollBar.get(), "Wer scrollt hier ?" ); + long nDiff = aEdtWindow->GetEditView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos(); + aEdtWindow->GetEditView()->Scroll( 0, nDiff ); + aBrkWindow->DoScroll( 0, nDiff ); + aLineNumberWindow->DoScroll(0, nDiff); + aEdtWindow->GetEditView()->ShowCursor(false, true); + pCurScrollBar->SetThumbPos( aEdtWindow->GetEditView()->GetStartDocPos().Y() ); } return 0; @@ -2102,7 +2132,7 @@ void ComplexEditorWindow::DataChanged(DataChangedEvent const & rDCEvt) void ComplexEditorWindow::SetLineNumberDisplay(bool b) { - aLineNumberWindow.Show(b); + aLineNumberWindow->Show(b); Resize(); } @@ -2135,6 +2165,11 @@ WatchTreeListBox::WatchTreeListBox( vcl::Window* pParent, WinBits nWinBits ) WatchTreeListBox::~WatchTreeListBox() { + dispose(); +} + +void WatchTreeListBox::dispose() +{ // Destroy user data SvTreeListEntry* pEntry = First(); while ( pEntry ) @@ -2142,6 +2177,7 @@ WatchTreeListBox::~WatchTreeListBox() delete static_cast<WatchItem*>(pEntry->GetUserData()); pEntry = Next( pEntry ); } + SvHeaderTabListBox::dispose(); } void WatchTreeListBox::SetTabs() @@ -2815,6 +2851,17 @@ pListBox( new CodeCompleteListBox(this) ) InitListBox(); } +CodeCompleteWindow::~CodeCompleteWindow() +{ + dispose(); +} + +void CodeCompleteWindow::dispose() +{ + delete pListBox; + vcl::Window::dispose(); +} + void CodeCompleteWindow::InitListBox() { pListBox->SetSizePixel( Size(150,150) ); //default, this will adopt the line length diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 12af69212e83..7a6a04ee6708 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -100,9 +100,6 @@ DialogWindow::DialogWindow ( SetReadOnly(true); } -DialogWindow::~DialogWindow() -{ } - void DialogWindow::LoseFocus() { if ( IsModified() ) @@ -1411,11 +1408,17 @@ DialogWindowLayout::DialogWindowLayout (vcl::Window* pParent, ObjectCatalog& rOb DialogWindowLayout::~DialogWindowLayout() { + dispose(); +} + +void DialogWindowLayout::dispose() +{ if (pPropertyBrowser != 0) { Remove(pPropertyBrowser); delete pPropertyBrowser; } + Layout::dispose(); } // shows the property browser (and creates if necessary) diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index eabb0a24b03d..2f1e8fdc7304 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -330,7 +330,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq ) case SID_BASICIDE_OBJCAT: // toggling object catalog - aObjectCatalog.Show(!aObjectCatalog.IsVisible()); + aObjectCatalog->Show(!aObjectCatalog->IsVisible()); if (pLayout) pLayout->ArrangeWindows(); // refresh the button state @@ -750,7 +750,7 @@ void Shell::GetState(SfxItemSet &rSet) break; case SID_BASICIDE_OBJCAT: if (pLayout) - rSet.Put(SfxBoolItem(nWh, aObjectCatalog.IsVisible())); + rSet.Put(SfxBoolItem(nWh, aObjectCatalog->IsVisible())); else rSet.Put(SfxVisibilityItem(nWh, false)); break; @@ -1032,7 +1032,7 @@ void Shell::SetCurWindow( BaseWindow* pNewWin, bool bUpdateTabBar, bool bRemembe GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW ); SfxObjectShell::SetCurrentComponent(0); } - aObjectCatalog.SetCurrentEntry(pCurWin); + aObjectCatalog->SetCurrentEntry(pCurWin); SetUndoManager( pCurWin ? pCurWin->GetUndoManager() : 0 ); InvalidateBasicIDESlots(); EnableScrollbars(pCurWin != 0); @@ -1188,13 +1188,13 @@ void Shell::AdjustPosSizePixel( const Point &rPos, const Size &rSize ) return; Size aSz( rSize ); - Size aScrollBarBoxSz( aScrollBarBox.GetSizePixel() ); + Size aScrollBarBoxSz( aScrollBarBox->GetSizePixel() ); aSz.Height() -= aScrollBarBoxSz.Height(); Size aOutSz( aSz ); aSz.Width() -= aScrollBarBoxSz.Width(); - aScrollBarBox.SetPosPixel( Point( rSize.Width() - aScrollBarBoxSz.Width(), rSize.Height() - aScrollBarBoxSz.Height() ) ); - aVScrollBar.SetPosSizePixel( Point( rPos.X()+aSz.Width(), rPos.Y() ), Size( aScrollBarBoxSz.Width(), aSz.Height() ) ); + aScrollBarBox->SetPosPixel( Point( rSize.Width() - aScrollBarBoxSz.Width(), rSize.Height() - aScrollBarBoxSz.Height() ) ); + aVScrollBar->SetPosSizePixel( Point( rPos.X()+aSz.Width(), rPos.Y() ), Size( aScrollBarBoxSz.Width(), aSz.Height() ) ); if ( bTabBarSplitted ) { // SplitSize is 0 at a resize! @@ -1203,12 +1203,12 @@ void Shell::AdjustPosSizePixel( const Point &rPos, const Size &rSize ) nSplitPos = aSz.Width(); pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( nSplitPos, aScrollBarBoxSz.Height() ) ); long nScrlStart = rPos.X() + nSplitPos; - aHScrollBar.SetPosSizePixel( Point( nScrlStart, rPos.Y()+aSz.Height() ), Size( aSz.Width() - nScrlStart + 1, aScrollBarBoxSz.Height() ) ); - aHScrollBar.Update(); + aHScrollBar->SetPosSizePixel( Point( nScrlStart, rPos.Y()+aSz.Height() ), Size( aSz.Width() - nScrlStart + 1, aScrollBarBoxSz.Height() ) ); + aHScrollBar->Update(); } else { - aHScrollBar.SetPosSizePixel( Point( rPos.X()+ aSz.Width()/2 - 1, rPos.Y()+aSz.Height() ), Size( aSz.Width()/2 + 2, aScrollBarBoxSz.Height() ) ); + aHScrollBar->SetPosSizePixel( Point( rPos.X()+ aSz.Width()/2 - 1, rPos.Y()+aSz.Height() ), Size( aSz.Width()/2 + 2, aScrollBarBoxSz.Height() ) ); pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( aSz.Width()/2, aScrollBarBoxSz.Height() ) ); } diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx index 874f797f46f3..70cda63abde1 100644 --- a/basctl/source/basicide/basides2.cxx +++ b/basctl/source/basicide/basides2.cxx @@ -166,7 +166,7 @@ ModulWindow* Shell::CreateBasWin( const ScriptDocument& rDocument, const OUStrin { // new module window if (!pModulLayout) - pModulLayout.reset(new ModulWindowLayout(&GetViewFrame()->GetWindow(), aObjectCatalog)); + pModulLayout.reset(new ModulWindowLayout(&GetViewFrame()->GetWindow(), *aObjectCatalog.get())); pWin = new ModulWindow(pModulLayout.get(), rDocument, aLibName, aModName, aModule); nKey = InsertWindowInTable( pWin ); } @@ -195,7 +195,7 @@ ModulWindow* Shell::CreateBasWin( const ScriptDocument& rDocument, const OUStrin pTabBar->Sort(); if(pWin) { - pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar ); + pWin->GrabScrollBars( aHScrollBar.get(), aVScrollBar.get() ); if ( !pCurWin ) SetCurWindow( pWin, false, false ); } diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx index ff53a779c932..8112a1790d5c 100644 --- a/basctl/source/basicide/basides3.cxx +++ b/basctl/source/basicide/basides3.cxx @@ -77,7 +77,7 @@ DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUStri // new dialog window if (!pDialogLayout) - pDialogLayout.reset(new DialogWindowLayout(&GetViewFrame()->GetWindow(), aObjectCatalog)); + pDialogLayout.reset(new DialogWindowLayout(&GetViewFrame()->GetWindow(), *aObjectCatalog.get())); pWin = new DialogWindow(pDialogLayout.get(), rDocument, aLibName, aDlgName, xDialogModel); nKey = InsertWindowInTable( pWin ); } @@ -96,7 +96,7 @@ DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUStri if( pWin ) { - pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar ); + pWin->GrabScrollBars( aHScrollBar.get(), aVScrollBar.get() ); pTabBar->InsertPage( (sal_uInt16)nKey, aDlgName ); pTabBar->Sort(); if ( !pCurWin ) diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 665b78f62760..bf9af424fe6f 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -155,11 +155,11 @@ unsigned Shell::nShellCount = 0; Shell::Shell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) : SfxViewShell( pFrame_, ShellFlags ), m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ), - aHScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG ) ), - aVScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG ) ), - aScrollBarBox( &GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE ) ), + aHScrollBar( new ScrollBar(&GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG )) ), + aVScrollBar( new ScrollBar(&GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG )) ), + aScrollBarBox( new ScrollBarBox(&GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE )) ), pLayout(0), - aObjectCatalog(&GetViewFrame()->GetWindow()), + aObjectCatalog(new ObjectCatalog(&GetViewFrame()->GetWindow())), m_bAppBasicModified( false ), m_aNotifier( *this ) { @@ -416,15 +416,15 @@ bool Shell::PrepareClose( bool bUI ) void Shell::InitScrollBars() { - aVScrollBar.SetLineSize( 300 ); - aVScrollBar.SetPageSize( 2000 ); - aHScrollBar.SetLineSize( 300 ); - aHScrollBar.SetPageSize( 2000 ); - aHScrollBar.Enable(); - aVScrollBar.Enable(); - aVScrollBar.Show(); - aHScrollBar.Show(); - aScrollBarBox.Show(); + aVScrollBar->SetLineSize( 300 ); + aVScrollBar->SetPageSize( 2000 ); + aHScrollBar->SetLineSize( 300 ); + aHScrollBar->SetPageSize( 2000 ); + aHScrollBar->Enable(); + aVScrollBar->Enable(); + aVScrollBar->Show(); + aHScrollBar->Show(); + aScrollBarBox->Show(); } @@ -492,16 +492,16 @@ bool Shell::NextPage( bool bPrev ) void Shell::ArrangeTabBar() { - long nBoxPos = aScrollBarBox.GetPosPixel().X() - 1; + long nBoxPos = aScrollBarBox->GetPosPixel().X() - 1; long nPos = pTabBar->GetSplitSize(); if ( nPos <= nBoxPos ) { Point aPnt( pTabBar->GetPosPixel() ); - long nH = aHScrollBar.GetSizePixel().Height(); + long nH = aHScrollBar->GetSizePixel().Height(); pTabBar->SetPosSizePixel( aPnt, Size( nPos, nH ) ); long nScrlStart = aPnt.X() + nPos; - aHScrollBar.SetPosSizePixel( Point( nScrlStart, aPnt.Y() ), Size( nBoxPos - nScrlStart + 2, nH ) ); - aHScrollBar.Update(); + aHScrollBar->SetPosSizePixel( Point( nScrlStart, aPnt.Y() ), Size( nBoxPos - nScrlStart + 2, nH ) ); + aHScrollBar->Update(); } } @@ -530,7 +530,7 @@ void Shell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&, case SFX_HINT_DYING: { EndListening( rBC, true /* log off all */ ); - aObjectCatalog.UpdateEntries(); + aObjectCatalog->UpdateEntries(); } break; } @@ -908,8 +908,8 @@ void Shell::InvalidateBasicIDESlots() void Shell::EnableScrollbars( bool bEnable ) { - aHScrollBar.Enable(bEnable); - aVScrollBar.Enable(bEnable); + aHScrollBar->Enable(bEnable); + aVScrollBar->Enable(bEnable); } void Shell::SetCurLib( const ScriptDocument& rDocument, const OUString& aLibName, bool bUpdateWindows, bool bCheck ) diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index 5d105dbe1082..8abf2302a3bb 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -206,6 +206,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTreeListBox(vcl::Windo TreeListBox::~TreeListBox () { + dispose(); +} + +void TreeListBox::dispose() +{ m_aNotifier.dispose(); // destroy user data @@ -215,6 +220,7 @@ TreeListBox::~TreeListBox () delete static_cast<Entry*>(pEntry->GetUserData()); pEntry = Next( pEntry ); } + SvTreeListBox::dispose(); } void TreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ) diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx index 2b51b175091d..f18e4721c5d6 100644 --- a/basctl/source/basicide/bastype2.hxx +++ b/basctl/source/basicide/bastype2.hxx @@ -208,6 +208,7 @@ public: TreeListBox(vcl::Window* pParent, const ResId& rRes); TreeListBox(vcl::Window* pParent, WinBits nStyle); virtual ~TreeListBox(); + virtual void dispose() SAL_OVERRIDE; void ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ); void ScanAllEntries(); diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 88fd1cec6323..0da73c2c1c90 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -55,10 +55,16 @@ BaseWindow::BaseWindow( vcl::Window* pParent, const ScriptDocument& rDocument, c BaseWindow::~BaseWindow() { + dispose(); +} + +void BaseWindow::dispose() +{ if ( pShellVScrollBar ) pShellVScrollBar->SetScrollHdl( Link() ); if ( pShellHScrollBar ) pShellHScrollBar->SetScrollHdl( Link() ); + vcl::Window::dispose(); } diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx index 961a7bde65e4..58db3a74dbb1 100644 --- a/basctl/source/basicide/layout.cxx +++ b/basctl/source/basicide/layout.cxx @@ -53,10 +53,6 @@ Layout::Layout (vcl::Window* pParent) : SetFont(aFont); } -// virtual dtor -Layout::~Layout() -{ } - // removes a docking window void Layout::Remove (DockingWindow* pWin) { @@ -166,9 +162,9 @@ Layout::SplittedSide::SplittedSide (Layout* pParent, Side eSide) : bVertical(eSide == Left || eSide == Right), bLower(eSide == Left || eSide == Top), nSize(0), - aSplitter(pParent, bVertical ? WB_HSCROLL : WB_VSCROLL) + aSplitter(new Splitter(pParent, bVertical ? WB_HSCROLL : WB_VSCROLL)) { - InitSplitter(aSplitter); + InitSplitter(*aSplitter.get()); } @@ -267,19 +263,19 @@ void Layout::SplittedSide::ArrangeIn (Rectangle const& rRect) // shown if any of the windows is docked if (!bEmpty) { - aSplitter.Show(); + aSplitter->Show(); // split position - aSplitter.SetSplitPosPixel((bLower ? nSize : nPos1) - nSplitThickness); + aSplitter->SetSplitPosPixel((bLower ? nSize : nPos1) - nSplitThickness); // the actual position and size - aSplitter.SetPosSizePixel( - MakePoint(nPos2, aSplitter.GetSplitPosPixel()), + aSplitter->SetPosSizePixel( + MakePoint(nPos2, aSplitter->GetSplitPosPixel()), MakeSize(nLength, nSplitThickness) ); // dragging rectangle - aSplitter.SetDragRectPixel(aRect); + aSplitter->SetDragRectPixel(aRect); } else - aSplitter.Hide(); + aSplitter->Hide(); // positioning separator lines and windows bool bPrevDocking = false; // is the previous window docked? @@ -350,7 +346,7 @@ IMPL_LINK(Layout::SplittedSide, SplitHdl, Splitter*, pSplitter) // checking margins CheckMarginsFor(pSplitter); // changing stored sizes - if (pSplitter == &aSplitter) + if (pSplitter == aSplitter.get()) { // nSize if (bLower) diff --git a/basctl/source/basicide/layout.hxx b/basctl/source/basicide/layout.hxx index fac9bdc86b69..56e69a2f28f9 100644 --- a/basctl/source/basicide/layout.hxx +++ b/basctl/source/basicide/layout.hxx @@ -21,6 +21,7 @@ #define INCLUDED_BASCTL_SOURCE_BASICIDE_LAYOUT_HXX #include <vcl/split.hxx> +#include <vcl/vclptr.hxx> class DockingWindow; @@ -51,7 +52,6 @@ public: protected: Layout (vcl::Window* pParent); - virtual ~Layout (); void AddToLeft (DockingWindow* pWin, Size const& rSize) { aLeftSide.Add(pWin, rSize); } void AddToBottom (DockingWindow* pWin, Size const& rSize) { aBottomSide.Add(pWin, rSize); } @@ -96,7 +96,7 @@ private: // size (width or height) long nSize; // the main splitting line - Splitter aSplitter; + VclPtr<Splitter> aSplitter; // the dockable windows (and some data) struct Item { diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx index 2ba7043207da..e3b49bf2dc39 100644 --- a/basctl/source/basicide/linenumberwindow.cxx +++ b/basctl/source/basicide/linenumberwindow.cxx @@ -25,9 +25,6 @@ LineNumberWindow::LineNumberWindow (vcl::Window* pParent, ModulWindow* pModulWin m_nWidth = m_nBaseWidth * 3 + m_nBaseWidth / 2; } -LineNumberWindow::~LineNumberWindow() -{ } - void LineNumberWindow::Paint( const Rectangle& ) { if(SyncYOffset()) diff --git a/basctl/source/basicide/linenumberwindow.hxx b/basctl/source/basicide/linenumberwindow.hxx index caa7f15350c0..6a6bcd201714 100644 --- a/basctl/source/basicide/linenumberwindow.hxx +++ b/basctl/source/basicide/linenumberwindow.hxx @@ -30,7 +30,6 @@ protected: public: LineNumberWindow (vcl::Window* pParent, ModulWindow* pModulWin); - virtual ~LineNumberWindow(); void DoScroll( long nHorzScroll, long nVertScroll ); diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index 0f70973e74c1..53355ef68bad 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -112,8 +112,14 @@ MacroChooser::MacroChooser( vcl::Window* pParnt, bool bCreateEntries ) MacroChooser::~MacroChooser() { + dispose(); +} + +void MacroChooser::dispose() +{ if ( bForceStoreBasic ) SfxGetpApp()->SaveBasicAndDialogContainer(); + SfxModalDialog::dispose(); } void MacroChooser::StoreMacroDescription() diff --git a/basctl/source/basicide/macrodlg.hxx b/basctl/source/basicide/macrodlg.hxx index 212dc7f6ebb9..71892b3ea1a8 100644 --- a/basctl/source/basicide/macrodlg.hxx +++ b/basctl/source/basicide/macrodlg.hxx @@ -87,6 +87,7 @@ private: public: MacroChooser( vcl::Window* pParent, bool bCreateEntries = true ); virtual ~MacroChooser(); + virtual void dispose() SAL_OVERRIDE; SbMethod* GetMacro(); void DeleteMacro(); diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index ea06d718b3cb..9907076da27e 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -161,6 +161,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeCheckBox(vcl::Window * CheckBox::~CheckBox() { + dispose(); +} + +void CheckBox::dispose() +{ delete pCheckButton; // delete user data @@ -170,6 +175,7 @@ CheckBox::~CheckBox() delete static_cast<LibUserData*>(pEntry->GetUserData()); pEntry = Next( pEntry ); } + SvTabListBox::dispose(); } void CheckBox::Init() @@ -476,12 +482,18 @@ LibPage::LibPage(vcl::Window * pParent) LibPage::~LibPage() { + dispose(); +} + +void LibPage::dispose() +{ sal_uInt16 nCount = m_pBasicsBox->GetEntryCount(); for ( sal_uInt16 i = 0; i < nCount; ++i ) { DocumentEntry* pEntry = static_cast<DocumentEntry*>(m_pBasicsBox->GetEntryData( i )); delete pEntry; } + TabPage::dispose(); } void LibPage::CheckButtons() diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index dd39719b39da..fd15d17e8350 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -62,9 +62,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeExtTreeListBox(vcl::Wi return new ExtTreeListBox(pParent, nWinBits); } -ExtTreeListBox::~ExtTreeListBox () -{ } - bool ExtTreeListBox::EditingEntry( SvTreeListEntry* pEntry, Selection& ) { bool bRet = false; @@ -489,8 +486,14 @@ OrganizeDialog::OrganizeDialog(vcl::Window* pParent, sal_Int16 tabId, OrganizeDialog::~OrganizeDialog() { + dispose(); +} + +void OrganizeDialog::dispose() +{ for ( sal_uInt16 i = 0; i < m_pTabCtrl->GetPageCount(); i++ ) delete m_pTabCtrl->GetTabPage( m_pTabCtrl->GetPageId( i ) ); + TabDialog::dispose(); }; short OrganizeDialog::Execute() diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx index a1c3f79e8e45..00abbe158ca9 100644 --- a/basctl/source/basicide/moduldlg.hxx +++ b/basctl/source/basicide/moduldlg.hxx @@ -107,7 +107,6 @@ protected: public: ExtTreeListBox(vcl::Window* pParent, WinBits nStyle); - virtual ~ExtTreeListBox(); }; class CheckBox : public SvTabListBox @@ -121,6 +120,7 @@ private: public: CheckBox(vcl::Window* pParent, WinBits nStyle); virtual ~CheckBox(); + virtual void dispose() SAL_OVERRIDE; SvTreeListEntry* DoInsertEntry( const OUString& rStr, sal_uLong nPos = LISTBOX_APPEND ); SvTreeListEntry* FindEntry( const OUString& rName ); @@ -168,6 +168,7 @@ private: public: OrganizeDialog( vcl::Window* pParent, sal_Int16 tabId, EntryDescriptor& rDesc ); virtual ~OrganizeDialog(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; @@ -246,6 +247,7 @@ protected: public: LibPage( vcl::Window* pParent ); virtual ~LibPage(); + virtual void dispose() SAL_OVERRIDE; void SetTabDlg( TabDialog* p ) { pTabDlg = p;} }; diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx index 7bc31392b8c9..14d943f82375 100644 --- a/basctl/source/basicide/objdlg.cxx +++ b/basctl/source/basicide/objdlg.cxx @@ -30,27 +30,27 @@ namespace basctl ObjectCatalog::ObjectCatalog (vcl::Window* pParent) : DockingWindow(pParent), - aTitle(this), - aTree(this, IDEResId(RID_TLB_MACROS)) + aTitle(new FixedText(this)), + aTree(new TreeListBox(this, IDEResId(RID_TLB_MACROS))) { SetHelpId("basctl:FloatingWindow:RID_BASICIDE_OBJCAT"); SetText(IDEResId(RID_BASICIDE_OBJCAT).toString()); // title - aTitle.SetText(IDEResId(RID_BASICIDE_OBJCAT).toString()); - aTitle.SetStyle(WB_CENTER); + aTitle->SetText(IDEResId(RID_BASICIDE_OBJCAT).toString()); + aTitle->SetStyle(WB_CENTER); // tree list - aTree.Hide(); - aTree.SetStyle( + aTree->Hide(); + aTree->SetStyle( WB_BORDER | WB_TABSTOP | WB_HSCROLL | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HASBUTTONSATROOT ); - aTree.SetAccessibleName(IDEResId(RID_STR_TLB_MACROS).toString()); - aTree.SetHelpId(HID_BASICIDE_OBJECTCAT); - aTree.ScanAllEntries(); - aTree.GrabFocus(); + aTree->SetAccessibleName(IDEResId(RID_STR_TLB_MACROS).toString()); + aTree->SetHelpId(HID_BASICIDE_OBJECTCAT); + aTree->ScanAllEntries(); + aTree->GrabFocus(); { // centered after AppWin: @@ -67,9 +67,17 @@ ObjectCatalog::ObjectCatalog (vcl::Window* pParent) : GetParent()->GetSystemWindow()->GetTaskPaneList()->AddWindow(this); } -ObjectCatalog::~ObjectCatalog () +ObjectCatalog::~ObjectCatalog() +{ + dispose(); +} + +void ObjectCatalog::dispose() { GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow(this); + aTitle.disposeAndClear(); + aTree.disposeAndClear(); + DockingWindow::dispose(); } // Resize() -- called by Window @@ -97,14 +105,14 @@ void ObjectCatalog::ArrangeWindows () // title // (showing only if no title bar) if (bFloating) - aTitle.Hide(); + aTitle->Hide(); else { Size aTitleSize = LogicToPixel(Size(3, 10), MAP_APPFONT); aTitleSize.Width() = aSize.Width() - 2*aTitleSize.Width(); - aTitle.SetPosPixel(LogicToPixel(Point(3, 3), MAP_APPFONT)); - aTitle.SetSizePixel(aTitleSize); - aTitle.Show(); + aTitle->SetPosPixel(LogicToPixel(Point(3, 3), MAP_APPFONT)); + aTitle->SetSizePixel(aTitleSize); + aTitle->Show(); } // tree @@ -116,11 +124,11 @@ void ObjectCatalog::ArrangeWindows () ); if (aTreeSize.Height() > 0) { - aTree.SetPosSizePixel(aTreePos, aTreeSize); - aTree.Show(); + aTree->SetPosSizePixel(aTreePos, aTreeSize); + aTree->Show(); } else - aTree.Hide(); + aTree->Hide(); } void ObjectCatalog::SetCurrentEntry (BaseWindow* pCurWin) @@ -128,7 +136,7 @@ void ObjectCatalog::SetCurrentEntry (BaseWindow* pCurWin) EntryDescriptor aDescriptor; if (pCurWin) aDescriptor = pCurWin->CreateEntryDescriptor(); - aTree.SetCurrentEntry(aDescriptor); + aTree->SetCurrentEntry(aDescriptor); } diff --git a/basctl/source/basicide/objdlg.hxx b/basctl/source/basicide/objdlg.hxx index aca869793836..1ce7389044c4 100644 --- a/basctl/source/basicide/objdlg.hxx +++ b/basctl/source/basicide/objdlg.hxx @@ -37,15 +37,16 @@ class ObjectCatalog : public DockingWindow public: ObjectCatalog (vcl::Window* pParent); virtual ~ObjectCatalog (); + virtual void dispose() SAL_OVERRIDE; public: - void UpdateEntries () { aTree.UpdateEntries(); } + void UpdateEntries () { aTree->UpdateEntries(); } void SetCurrentEntry (BaseWindow* pCurWin); private: // title: "Object Catalog" - FixedText aTitle; + VclPtr<FixedText> aTitle; // the tree-list of the objects - TreeListBox aTree; + VclPtr<TreeListBox> aTree; private: virtual void Resize () SAL_OVERRIDE; // Window diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx index fb513dc637db..ed304b218d5d 100644 --- a/basctl/source/dlged/managelang.cxx +++ b/basctl/source/dlged/managelang.cxx @@ -75,7 +75,13 @@ ManageLanguageDialog::ManageLanguageDialog(vcl::Window* pParent, boost::shared_p ManageLanguageDialog::~ManageLanguageDialog() { + dispose(); +} + +void ManageLanguageDialog::dispose() +{ ClearLanguageBox(); + ModalDialog::dispose(); } void ManageLanguageDialog::Init() diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx index e38c26632a82..caf5caba3207 100644 --- a/basctl/source/dlged/propbrw.cxx +++ b/basctl/source/dlged/propbrw.cxx @@ -190,8 +190,14 @@ void PropBrw::ImplReCreateController() PropBrw::~PropBrw() { + dispose(); +} + +void PropBrw::dispose() +{ if ( m_xBrowserController.is() ) ImplDestroyController(); + DockingWindow::dispose(); } diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx index b73b9e571b6e..644ccbad2721 100644 --- a/basctl/source/inc/baside3.hxx +++ b/basctl/source/inc/baside3.hxx @@ -81,8 +81,7 @@ protected: public: TYPEINFO_OVERRIDE(); DialogWindow (DialogWindowLayout* pParent, ScriptDocument const& rDocument, const OUString& aLibName, const OUString& aName, com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> const& xDialogModel); - DialogWindow( DialogWindow* pCurView ); // never implemented - virtual ~DialogWindow(); + DialogWindow( DialogWindow* pCurView ); // never implemented virtual void ExecuteCommand( SfxRequest& rReq ) SAL_OVERRIDE; virtual void GetState( SfxItemSet& ) SAL_OVERRIDE; @@ -129,6 +128,7 @@ class DialogWindowLayout : public Layout public: DialogWindowLayout (vcl::Window* pParent, ObjectCatalog&); virtual ~DialogWindowLayout(); + virtual void dispose() SAL_OVERRIDE; public: void ShowPropertyBrowser (); void UpdatePropertyBrowser (); diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index 1ed8f9f950a1..216f06518316 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -71,9 +71,9 @@ private: OUString m_aCurLibName; boost::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr; - ScrollBar aHScrollBar; - ScrollBar aVScrollBar; - ScrollBarBox aScrollBarBox; + VclPtr<ScrollBar> aHScrollBar; + VclPtr<ScrollBar> aVScrollBar; + VclPtr<ScrollBarBox> aScrollBarBox; boost::scoped_ptr<TabBar> pTabBar; // basctl::TabBar bool bTabBarSplitted; bool bCreatingWindow; @@ -83,7 +83,7 @@ private: // the active layout window Layout* pLayout; // common object catalog window - ObjectCatalog aObjectCatalog; + VclPtr<ObjectCatalog> aObjectCatalog; bool m_bAppBasicModified; DocumentEventNotifier m_aNotifier; @@ -163,9 +163,9 @@ public: OUString const& GetCurLibName() const { return m_aCurLibName; } boost::shared_ptr<LocalizationMgr> GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; } - ScrollBar& GetHScrollBar() { return aHScrollBar; } - ScrollBar& GetVScrollBar() { return aVScrollBar; } - ScrollBarBox& GetScrollBarBox() { return aScrollBarBox; } + ScrollBar& GetHScrollBar() { return *aHScrollBar.get(); } + ScrollBar& GetVScrollBar() { return *aVScrollBar.get(); } + ScrollBarBox& GetScrollBarBox() { return *aScrollBarBox.get(); } TabBar& GetTabBar() { return *pTabBar; } WindowTable& GetWindowTable() { return aWindowTable; } sal_uInt16 GetWindowId (BaseWindow const* pWin) const; @@ -212,7 +212,7 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetCurrentDocument() const SAL_OVERRIDE; - void UpdateObjectCatalog () { aObjectCatalog.UpdateEntries(); } + void UpdateObjectCatalog () { aObjectCatalog->UpdateEntries(); } void RemoveWindow (BaseWindow* pWindow, bool bDestroy, bool bAllowChangeCurWindow = true); }; diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx index 646fb3279a62..37e11306111d 100644 --- a/basctl/source/inc/bastypes.hxx +++ b/basctl/source/inc/bastypes.hxx @@ -168,6 +168,7 @@ public: TYPEINFO(); BaseWindow( vcl::Window* pParent, const ScriptDocument& rDocument, const OUString& aLibName, const OUString& aName ); virtual ~BaseWindow(); + virtual void dispose() SAL_OVERRIDE; void Init(); virtual void DoInit(); diff --git a/basctl/source/inc/managelang.hxx b/basctl/source/inc/managelang.hxx index 8b07b27c0f80..ab6fb62ceab9 100644 --- a/basctl/source/inc/managelang.hxx +++ b/basctl/source/inc/managelang.hxx @@ -74,6 +74,7 @@ private: public: ManageLanguageDialog( vcl::Window* pParent, boost::shared_ptr<LocalizationMgr> _pLMgr ); virtual ~ManageLanguageDialog(); + virtual void dispose() SAL_OVERRIDE; }; class SetDefaultLanguageDialog : public ModalDialog diff --git a/basctl/source/inc/propbrw.hxx b/basctl/source/inc/propbrw.hxx index 8469624ec8e0..1beda1254b9b 100644 --- a/basctl/source/inc/propbrw.hxx +++ b/basctl/source/inc/propbrw.hxx @@ -75,6 +75,7 @@ protected: public: explicit PropBrw (DialogWindowLayout&); virtual ~PropBrw(); + virtual void dispose() SAL_OVERRIDE; using Window::Update; // note: changing the Context document to an instance other than the one given in the ctor is not supported // currently |