diff options
1576 files changed, 20932 insertions, 10073 deletions
diff --git a/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx b/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx index 098c8e5d0d43..363a54450e52 100644 --- a/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx +++ b/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx @@ -35,6 +35,7 @@ #include <comphelper/broadcasthelper.hxx> #include <comphelper/accessibletexthelper.hxx> #include <tools/gen.hxx> +#include <vcl/vclptr.hxx> // forward @@ -63,7 +64,7 @@ namespace accessibility { private: /** The treelistbox control */ - SvtIconChoiceCtrl* m_pIconCtrl; + VclPtr<SvtIconChoiceCtrl> m_pIconCtrl; sal_Int32 m_nIndex; protected: diff --git a/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx b/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx index 81401f177564..ed920c89399d 100644 --- a/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx +++ b/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx @@ -22,6 +22,7 @@ #include <comphelper/accessiblecomponenthelper.hxx> #include <tools/link.hxx> +#include <vcl/vclptr.hxx> class TabBar; class VCLExternalSolarLock; @@ -57,7 +58,7 @@ private: protected: VCLExternalSolarLock* m_pExternalLock; - TabBar* m_pTabBar; + VclPtr<TabBar> m_pTabBar; }; diff --git a/accessibility/inc/accessibility/extended/accessibletablistbox.hxx b/accessibility/inc/accessibility/extended/accessibletablistbox.hxx index e5e16809b038..f6e1d416bf30 100644 --- a/accessibility/inc/accessibility/extended/accessibletablistbox.hxx +++ b/accessibility/inc/accessibility/extended/accessibletablistbox.hxx @@ -43,7 +43,7 @@ class AccessibleTabListBox ,public ::svt::IAccessibleTabListBox { private: - SvHeaderTabListBox* m_pTabListBox; + VclPtr<SvHeaderTabListBox> m_pTabListBox; public: /** ctor() diff --git a/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx index 92e6fe996706..89bfd7ef437c 100644 --- a/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx +++ b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx @@ -37,7 +37,7 @@ typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelecti class AccessibleTabListBoxTable : public AccessibleBrowseBoxTable, public AccessibleTabListBoxTableImplHelper { private: - SvHeaderTabListBox* m_pTabListBox; + VclPtr<SvHeaderTabListBox> m_pTabListBox; ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xCurChild; diff --git a/accessibility/inc/accessibility/extended/listboxaccessible.hxx b/accessibility/inc/accessibility/extended/listboxaccessible.hxx index fc3bb245b2c4..4ce38c5090b6 100644 --- a/accessibility/inc/accessibility/extended/listboxaccessible.hxx +++ b/accessibility/inc/accessibility/extended/listboxaccessible.hxx @@ -22,6 +22,7 @@ #include <com/sun/star/uno/RuntimeException.hpp> #include <tools/link.hxx> +#include <vcl/vclptr.hxx> class SvTreeListBox; class VclSimpleEvent; @@ -41,7 +42,7 @@ namespace accessibility class ListBoxAccessibleBase { private: - SvTreeListBox* m_pWindow; + VclPtr<SvTreeListBox> m_pWindow; protected: inline SvTreeListBox* getListBox() const @@ -49,7 +50,7 @@ namespace accessibility return const_cast< ListBoxAccessibleBase* >( this )->m_pWindow; } - inline bool isAlive() const { return NULL != m_pWindow; } + inline bool isAlive() const { return nullptr != m_pWindow; } public: ListBoxAccessibleBase( SvTreeListBox& _rWindow ); diff --git a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx index a24e8c94af77..2846113057a2 100644 --- a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx +++ b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx @@ -99,7 +99,7 @@ public: private: ::Link m_aListener; - vcl::Window * m_pNotifier; + VclPtr<vcl::Window> m_pNotifier; }; class ParagraphInfo diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx index 2ca6def7ba42..b6dc89864fec 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx @@ -21,6 +21,7 @@ #define INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUBAR_HXX #include <accessibility/standard/accessiblemenucomponent.hxx> +#include <vcl/vclptr.hxx> class VclSimpleEvent; class VclWindowEvent; @@ -34,7 +35,7 @@ namespace vcl { class Window; } class VCLXAccessibleMenuBar : public OAccessibleMenuComponent { protected: - vcl::Window* m_pWindow; + VclPtr<vcl::Window> m_pWindow; virtual bool IsFocused() SAL_OVERRIDE; diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx index a07e4502c111..249f5cafa6ec 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx @@ -21,6 +21,7 @@ #define INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBAR_HXX #include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <vcl/vclptr.hxx> #include <vector> @@ -36,7 +37,7 @@ private: typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren; AccessibleChildren m_aAccessibleChildren; - StatusBar* m_pStatusBar; + VclPtr<StatusBar> m_pStatusBar; protected: void UpdateShowing( sal_Int32 i, bool bShowing ); diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx index f720374f3af5..0432abc9db7a 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx @@ -24,7 +24,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <comphelper/accessibletexthelper.hxx> #include <cppuhelper/implbase2.hxx> - +#include <vcl/vclptr.hxx> class StatusBar; class VCLExternalSolarLock; @@ -51,14 +51,14 @@ class VCLXAccessibleStatusBarItem : public AccessibleTextHelper_BASE, private: VCLExternalSolarLock* m_pExternalLock; - StatusBar* m_pStatusBar; + VclPtr<StatusBar> m_pStatusBar; sal_uInt16 m_nItemId; OUString m_sItemName; OUString m_sItemText; - bool m_bShowing; + bool m_bShowing; protected: - bool IsShowing(); + bool IsShowing(); void SetShowing( bool bShowing ); void SetItemName( const OUString& sItemName ); OUString GetItemName(); diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx index b4e7b54fd197..358213855df2 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx @@ -22,6 +22,7 @@ #include <toolkit/awt/vclxaccessiblecomponent.hxx> #include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <vcl/vclptr.hxx> #include <vector> @@ -42,7 +43,7 @@ private: typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren; AccessibleChildren m_aAccessibleChildren; - TabControl* m_pTabControl; + VclPtr<TabControl> m_pTabControl; protected: void UpdateFocused(); diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx index 182235a0ad12..8c0aa5dcac5b 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <comphelper/accessibletexthelper.hxx> #include <cppuhelper/implbase2.hxx> +#include <vcl/vclptr.hxx> class TabControl; @@ -51,7 +52,7 @@ class VCLXAccessibleTabPage : public AccessibleTextHelper_BASE, private: VCLExternalSolarLock* m_pExternalLock; - TabControl* m_pTabControl; + VclPtr<TabControl> m_pTabControl; sal_uInt16 m_nPageId; bool m_bFocused; bool m_bSelected; diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx index 0fb8f614bd0c..9393579b6883 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx @@ -21,6 +21,7 @@ #define INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGEWINDOW_HXX #include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <vcl/vclptr.hxx> class TabControl; @@ -34,8 +35,8 @@ class TabPage; class VCLXAccessibleTabPageWindow : public VCLXAccessibleComponent { private: - TabControl* m_pTabControl; - TabPage* m_pTabPage; + VclPtr<TabControl> m_pTabControl; + VclPtr<TabPage> m_pTabPage; sal_uInt16 m_nPageId; protected: diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx index b7d3c15fd3f8..a05f31b89d1f 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx @@ -30,6 +30,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/implbase4.hxx> #include <comphelper/accessibletexthelper.hxx> +#include <vcl/vclptr.hxx> class ToolBox; @@ -46,13 +47,13 @@ class VCLXAccessibleToolBoxItem : public AccessibleTextHelper_BASE, { private: OUString m_sOldName; - ToolBox* m_pToolBox; + VclPtr<ToolBox> m_pToolBox; VCLExternalSolarLock* m_pExternalLock; sal_Int32 m_nIndexInParent; sal_Int16 m_nRole; - sal_uInt16 m_nItemId; - bool m_bHasFocus; - bool m_bIsChecked; + sal_uInt16 m_nItemId; + bool m_bHasFocus; + bool m_bIsChecked; bool m_bIndeterminate; ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xChild; @@ -80,9 +81,9 @@ public: VCLXAccessibleToolBoxItem( ToolBox* _pToolBox, sal_Int32 _nPos ); void SetFocus( bool _bFocus ); - inline bool HasFocus() const { return m_bHasFocus; } + inline bool HasFocus() const { return m_bHasFocus; } void SetChecked( bool _bCheck ); - inline bool IsChecked() const { return m_bIsChecked; } + inline bool IsChecked() const { return m_bIsChecked; } void SetIndeterminate( bool _bIndeterminate ); inline bool IsIndeterminate() const { return m_bIndeterminate; } inline void ReleaseToolBox() { m_pToolBox = NULL; } diff --git a/accessibility/source/extended/AccessibleToolPanelDeck.cxx b/accessibility/source/extended/AccessibleToolPanelDeck.cxx index dfb8ede26120..4f69764bcf29 100644 --- a/accessibility/source/extended/AccessibleToolPanelDeck.cxx +++ b/accessibility/source/extended/AccessibleToolPanelDeck.cxx @@ -76,7 +76,7 @@ namespace accessibility ); void checkDisposed(); - bool isDisposed() const { return m_pPanelDeck == NULL; } + bool isDisposed() const { return m_pPanelDeck == nullptr; } void dispose(); virtual ~AccessibleToolPanelDeck_Impl(); @@ -95,7 +95,7 @@ namespace accessibility public: AccessibleToolPanelDeck& m_rAntiImpl; Reference< XAccessible > m_xAccessibleParent; - ::svt::ToolPanelDeck* m_pPanelDeck; + VclPtr<::svt::ToolPanelDeck> m_pPanelDeck; Reference< XAccessible > m_xActivePanelAccessible; }; @@ -141,7 +141,7 @@ namespace accessibility { ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" ); m_pPanelDeck->RemoveListener( *this ); - m_pPanelDeck = NULL; + m_pPanelDeck.clear(); m_xAccessibleParent.clear(); } diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx index 757c45257c6e..1700aed946b1 100644 --- a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx +++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx @@ -120,7 +120,7 @@ namespace accessibility AccessibleToolPanelTabBar& m_rAntiImpl; Reference< XAccessible > m_xAccessibleParent; ::svt::IToolPanelDeck* m_pPanelDeck; - ::svt::PanelTabBar* m_pTabBar; + VclPtr<::svt::PanelTabBar> m_pTabBar; ::std::vector< Reference< XAccessible > > m_aChildren; }; @@ -163,7 +163,7 @@ namespace accessibility m_pTabBar->GetScrollButton( true ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); m_pTabBar->GetScrollButton( false ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); - m_pTabBar = NULL; + m_pTabBar.clear(); m_xAccessibleParent.clear(); } diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx index 33bca93ae759..f89cb3d7f807 100644 --- a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx +++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx @@ -105,7 +105,7 @@ namespace accessibility AccessibleToolPanelDeckTabBarItem& m_rAntiImpl; Reference< XAccessible > m_xAccessibleParent; ::svt::IToolPanelDeck* m_pPanelDeck; - ::svt::PanelTabBar* m_pTabBar; + VclPtr<::svt::PanelTabBar> m_pTabBar; size_t m_nItemPos; }; @@ -139,7 +139,7 @@ namespace accessibility m_xAccessibleParent.clear(); m_pPanelDeck->RemoveListener( *this ); m_pPanelDeck = NULL; - m_pTabBar = NULL; + m_pTabBar.clear(); } Reference< XAccessibleComponent > AccessibleToolPanelDeckTabBarItem_Impl::getParentAccessibleComponent() const diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx index a24d05bc9135..794524017735 100644 --- a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx +++ b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx @@ -91,7 +91,7 @@ throw(RuntimeException, std::exception) if ( _rSource.Source == m_xParent ) { dispose(); - OSL_ENSURE( !m_xParent.is() && ( NULL == m_pIconCtrl ), "" ); + OSL_ENSURE( !m_xParent.is() && ( nullptr == m_pIconCtrl ), "" ); } } diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 2dd16ace0380..fbe72a0e9d07 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -47,17 +47,17 @@ void SfxListenerGuard::endListening() void WindowListenerGuard::startListening(vcl::Window & rNotifier) { - OSL_ENSURE(m_pNotifier == 0, "called more than once"); + OSL_ENSURE(m_pNotifier == nullptr, "called more than once"); m_pNotifier = &rNotifier; m_pNotifier->AddEventListener(m_aListener); } void WindowListenerGuard::endListening() { - if (m_pNotifier != 0) + if (m_pNotifier) { m_pNotifier->RemoveEventListener(m_aListener); - m_pNotifier = 0; + m_pNotifier = nullptr; } } diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx index baabdd5555f1..c76babf32697 100644 --- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx +++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx @@ -93,13 +93,13 @@ void VCLXAccessibleRadioButton::FillAccessibleRelationSet( utl::AccessibleRelati RadioButton* pRadioButton = dynamic_cast< RadioButton* >( GetWindow() ); if ( pRadioButton ) { - ::std::vector< RadioButton* > aGroup(pRadioButton->GetRadioButtonGroup(true)); + ::std::vector< VclPtr<RadioButton> > aGroup(pRadioButton->GetRadioButtonGroup(true)); if (!aGroup.empty()) { sal_Int32 i = 0; Sequence< Reference< XInterface > > aSequence( static_cast< sal_Int32 >( aGroup.size() ) ); - ::std::vector< RadioButton* >::const_iterator aEndItr = aGroup.end(); - for ( ::std::vector< RadioButton* >::const_iterator aItr = aGroup.begin(); aItr < aEndItr; ++aItr ) + auto aEndItr = aGroup.end(); + for ( auto aItr = aGroup.begin(); aItr < aEndItr; ++aItr ) { aSequence[i++] = (*aItr)->GetAccessible(); } diff --git a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx index 6b43aa3d4b2c..d8d47320f9c9 100644 --- a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx +++ b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx @@ -50,7 +50,7 @@ VCLXAccessibleTabPageWindow::VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindo for ( sal_uInt16 i = 0, nCount = m_pTabControl->GetPageCount(); i < nCount; ++i ) { sal_uInt16 nPageId = m_pTabControl->GetPageId( i ); - if ( m_pTabControl->GetTabPage( nPageId ) == m_pTabPage ) + if ( m_pTabControl->GetTabPage( nPageId ) == m_pTabPage.get() ) m_nPageId = nPageId; } } diff --git a/avmedia/inc/mediacontrol.hxx b/avmedia/inc/mediacontrol.hxx index 9a1933b7e0a8..b24e1a590ee7 100644 --- a/avmedia/inc/mediacontrol.hxx +++ b/avmedia/inc/mediacontrol.hxx @@ -95,7 +95,7 @@ private: VclPtr<ToolBox> maMuteToolBox; VclPtr<Slider> maVolumeSlider; VclPtr<ToolBox> maZoomToolBox; - ListBox* mpZoomListBox; + VclPtr<ListBox> mpZoomListBox; VclPtr<Edit> maTimeEdit; Size maMinSize; MediaControlStyle meControlStyle; diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index 617bbc340e08..24defd8d3141 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -202,8 +202,7 @@ MediaControl::~MediaControl() void MediaControl::dispose() { maZoomToolBox->SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, NULL ); - delete mpZoomListBox; - mpZoomListBox = NULL; + mpZoomListBox.clear(); maTimeEdit.disposeAndClear(); maZoomToolBox.disposeAndClear(); maVolumeSlider.disposeAndClear(); diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx index f9dee9a3bf16..deccd8f17ea4 100644 --- a/avmedia/source/framework/mediaplayer.cxx +++ b/avmedia/source/framework/mediaplayer.cxx @@ -42,7 +42,7 @@ MediaPlayer::MediaPlayer( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* _p { pWindow = new MediaFloater( _pBindings, this, _pParent ); eChildAlignment = SfxChildAlignment::NOALIGNMENT; - static_cast< MediaFloater* >( pWindow )->Initialize( pInfo ); + static_cast< MediaFloater* >( pWindow.get() )->Initialize( pInfo ); }; diff --git a/avmedia/source/viewer/mediaevent_impl.cxx b/avmedia/source/viewer/mediaevent_impl.cxx index 86e18175101c..3e42ebb223b4 100644 --- a/avmedia/source/viewer/mediaevent_impl.cxx +++ b/avmedia/source/viewer/mediaevent_impl.cxx @@ -45,7 +45,7 @@ MediaEventListenersImpl::~MediaEventListenersImpl() void MediaEventListenersImpl::cleanUp() { - Application::RemoveMouseAndKeyEvents( reinterpret_cast< vcl::Window* >( mpNotifyWindow ) ); + Application::RemoveMouseAndKeyEvents( reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ) ); mpNotifyWindow = NULL; } @@ -72,7 +72,7 @@ void SAL_CALL MediaEventListenersImpl::keyPressed( const ::com::sun::star::awt:: ( ( e.Modifiers & 4 ) ? KEY_MOD2 : 0 ) ); KeyEvent aVCLKeyEvt( e.KeyChar, aVCLKeyCode ); - Application::PostKeyEvent( VCLEVENT_WINDOW_KEYINPUT, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLKeyEvt ); + Application::PostKeyEvent( VCLEVENT_WINDOW_KEYINPUT, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLKeyEvt ); } } @@ -91,7 +91,7 @@ void SAL_CALL MediaEventListenersImpl::keyReleased( const ::com::sun::star::awt: ( ( e.Modifiers & 2 ) ? KEY_MOD1 : 0 ) | ( ( e.Modifiers & 4 ) ? KEY_MOD2 : 0 ) ); KeyEvent aVCLKeyEvt( e.KeyChar, aVCLKeyCode ); - Application::PostKeyEvent( VCLEVENT_WINDOW_KEYUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLKeyEvt ); + Application::PostKeyEvent( VCLEVENT_WINDOW_KEYUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLKeyEvt ); } } @@ -112,7 +112,7 @@ void SAL_CALL MediaEventListenersImpl::mousePressed( const ::com::sun::star::awt ( ( e.Buttons & 2 ) ? MOUSE_RIGHT : 0 ) | ( ( e.Buttons & 4 ) ? MOUSE_MIDDLE : 0 ), e.Modifiers ); - Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt ); + Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLMouseEvt ); } } @@ -133,7 +133,7 @@ void SAL_CALL MediaEventListenersImpl::mouseReleased( const ::com::sun::star::aw ( ( e.Buttons & 2 ) ? MOUSE_RIGHT : 0 ) | ( ( e.Buttons & 4 ) ? MOUSE_MIDDLE : 0 ), e.Modifiers ); - Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt ); + Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLMouseEvt ); } } @@ -174,7 +174,7 @@ void SAL_CALL MediaEventListenersImpl::mouseDragged( const ::com::sun::star::awt if( mpNotifyWindow ) { MouseEvent aVCLMouseEvt( Point( e.X, e.Y ), 0, MouseEventModifiers::NONE, e.Buttons, e.Modifiers ); - Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt ); + Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLMouseEvt ); } } @@ -189,7 +189,7 @@ void SAL_CALL MediaEventListenersImpl::mouseMoved( const ::com::sun::star::awt:: if( mpNotifyWindow ) { MouseEvent aVCLMouseEvt( Point( e.X, e.Y ), 0, MouseEventModifiers::NONE, e.Buttons, e.Modifiers ); - Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt ); + Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow.get() ), &aVCLMouseEvt ); } } diff --git a/avmedia/source/viewer/mediaevent_impl.hxx b/avmedia/source/viewer/mediaevent_impl.hxx index 63e1a0d77ba2..27676c749d84 100644 --- a/avmedia/source/viewer/mediaevent_impl.hxx +++ b/avmedia/source/viewer/mediaevent_impl.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/awt/XMouseListener.hpp> #include <com/sun/star/awt/XMouseMotionListener.hpp> #include <com/sun/star/awt/XFocusListener.hpp> +#include <vcl/vclptr.hxx> namespace avmedia { @@ -69,7 +70,7 @@ namespace avmedia private: - vcl::Window* mpNotifyWindow; + VclPtr<vcl::Window> mpNotifyWindow; mutable ::osl::Mutex maMutex; }; } diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index b2716eebf5cc..c43f6829955d 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -204,8 +204,7 @@ void MediaWindowImpl::dispose() mpEmptyBmpEx = NULL; delete mpAudioBmpEx; mpAudioBmpEx = NULL; - delete mpMediaWindowControl; - mpMediaWindowControl = NULL; + mpMediaWindowControl.clear(); Control::dispose(); } diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx index 1311a2b4855f..40131c3c6fe2 100644 --- a/avmedia/source/viewer/mediawindow_impl.hxx +++ b/avmedia/source/viewer/mediawindow_impl.hxx @@ -173,7 +173,7 @@ namespace avmedia MediaEventListenersImpl* mpEvents; bool mbEventTransparent; std::unique_ptr<MediaChildWindow> mpChildWindow; - MediaWindowControl* mpMediaWindowControl; + VclPtr<MediaWindowControl> mpMediaWindowControl; BitmapEx* mpEmptyBmpEx; BitmapEx* mpAudioBmpEx; }; 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; }; diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index 1fe210fc2a43..529d9ed1769a 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -622,7 +622,7 @@ private: sal_Int32 mnStart; sal_Int32 mnEnd; bool bSet; - OpenGLWindow* mpOpenGLWindow; + VclPtr<OpenGLWindow> mpOpenGLWindow; }; } // namespace chart diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx index e0b65406b31e..b2d55cb8784f 100644 --- a/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx +++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx @@ -20,6 +20,7 @@ #define INCLUDED_CHART2_SOURCE_CONTROLLER_ACCESSIBILITY_ACCESSIBLEVIEWFORWARDER_HXX #include <vcl/mapmod.hxx> +#include <vcl/vclptr.hxx> #include <svx/IAccessibleViewForwarder.hxx> namespace vcl { class Window; } @@ -48,7 +49,7 @@ private: AccessibleViewForwarder& operator=( AccessibleViewForwarder& ) SAL_DELETED_FUNCTION; AccessibleChartView* m_pAccChartView; - vcl::Window* m_pWindow; + VclPtr<vcl::Window> m_pWindow; MapMode m_aMapMode; }; diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx index 14ce8e13b5da..7ea6c1c4b0c7 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx @@ -281,8 +281,8 @@ private: DECL_LINK( ChangeLineCountHdl, void* ); private: - FixedText* m_pFT_NumberOfLines; - NumericField* m_pMF_NumberOfLines; + VclPtr<FixedText> m_pFT_NumberOfLines; + VclPtr<NumericField> m_pMF_NumberOfLines; }; class BubbleChartDialogController : public ChartTypeDialogController diff --git a/chart2/source/controller/dialogs/dlg_ChartType.cxx b/chart2/source/controller/dialogs/dlg_ChartType.cxx index 33cf74763515..44436109dddd 100644 --- a/chart2/source/controller/dialogs/dlg_ChartType.cxx +++ b/chart2/source/controller/dialogs/dlg_ChartType.cxx @@ -60,8 +60,7 @@ ChartTypeDialog::~ChartTypeDialog() void ChartTypeDialog::dispose() { - delete m_pChartTypeTabPage; - m_pChartTypeTabPage = NULL; + m_pChartTypeTabPage.clear(); ModalDialog::dispose(); } diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx index 5a777db94004..66af10a37ccb 100644 --- a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx +++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx @@ -54,11 +54,7 @@ CreationWizardUnoDlg::CreationWizardUnoDlg( const uno::Reference< uno::XComponen CreationWizardUnoDlg::~CreationWizardUnoDlg() { SolarMutexGuard aSolarGuard; - if( m_pDialog ) - { - delete m_pDialog; - m_pDialog = 0; - } + m_pDialog.clear(); } // lang::XServiceInfo OUString SAL_CALL CreationWizardUnoDlg::getImplementationName() @@ -272,11 +268,7 @@ void SAL_CALL CreationWizardUnoDlg::disposing() m_xParentWindow.clear(); SolarMutexGuard aSolarGuard; - if( m_pDialog ) - { - delete m_pDialog; - m_pDialog = 0; - } + m_pDialog.clear(); try { diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.cxx b/chart2/source/controller/dialogs/dlg_DataEditor.cxx index 02a5578b99a0..5230792f51f2 100644 --- a/chart2/source/controller/dialogs/dlg_DataEditor.cxx +++ b/chart2/source/controller/dialogs/dlg_DataEditor.cxx @@ -106,6 +106,7 @@ void DataEditor::dispose() aMiscOptions.RemoveListenerLink( LINK( this, DataEditor, MiscHdl ) ); OSL_TRACE( "DataEditor: DTOR" ); + m_pTbxData.clear(); ModalDialog::dispose(); } diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx index 88c1a41f64fd..09e55375e734 100644 --- a/chart2/source/controller/dialogs/dlg_DataSource.cxx +++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx @@ -164,16 +164,14 @@ DataSourceDialog::~DataSourceDialog() void DataSourceDialog::dispose() { - delete m_pRangeChooserTabePage; - m_pRangeChooserTabePage = NULL; - delete m_pDataSourceTabPage; - m_pDataSourceTabPage = NULL; if (m_pTabControl) { m_nLastPageId = m_pTabControl->GetCurPageId(); - delete m_pTabControl; - m_pTabControl = NULL; } + m_pRangeChooserTabePage.clear(); + m_pDataSourceTabPage.clear(); + m_pTabControl.clear(); + m_pBtnOK.clear(); TabDialog::dispose(); } diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx index 345a6d79f150..670979af96ee 100644 --- a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx @@ -81,6 +81,23 @@ SchAxisDlg::SchAxisDlg(vcl::Window* pWindow, m_pCbSecondaryZ->Enable( rInput.aPossibilityList[5] ); } +SchAxisDlg::~SchAxisDlg() +{ + dispose(); +} + +void SchAxisDlg::dispose() +{ + m_pCbPrimaryX.clear(); + m_pCbPrimaryY.clear(); + m_pCbPrimaryZ.clear(); + m_pCbSecondaryX.clear(); + m_pCbSecondaryY.clear(); + m_pCbSecondaryZ.clear(); + ModalDialog::dispose(); +} + + void SchAxisDlg::getResult( InsertAxisOrGridDialogData& rOutput ) { rOutput.aExistenceList[0]=m_pCbPrimaryX->IsChecked(); diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx index 3769f2ef91c6..bb28a878bbb3 100644 --- a/chart2/source/controller/dialogs/dlg_View3D.cxx +++ b/chart2/source/controller/dialogs/dlg_View3D.cxx @@ -71,14 +71,12 @@ View3DDialog::~View3DDialog() void View3DDialog::dispose() { - delete m_pGeometry; - m_pGeometry = NULL; - delete m_pAppearance; - m_pAppearance = NULL; - delete m_pIllumination; - m_pIllumination = NULL; - - m_nLastPageId = m_pTabControl->GetCurPageId(); + if (m_pTabControl) + m_nLastPageId = m_pTabControl->GetCurPageId(); + m_pGeometry.clear(); + m_pAppearance.clear(); + m_pIllumination.clear(); + m_pTabControl.clear(); TabDialog::dispose(); } diff --git a/chart2/source/controller/dialogs/res_BarGeometry.hxx b/chart2/source/controller/dialogs/res_BarGeometry.hxx index 60af3af3ccd8..7a9eeb8c17f8 100644 --- a/chart2/source/controller/dialogs/res_BarGeometry.hxx +++ b/chart2/source/controller/dialogs/res_BarGeometry.hxx @@ -41,8 +41,8 @@ public: void SetSelectHdl( const Link& rLink ); private: - FixedText* m_pFT_Geometry; - ListBox* m_pLB_Geometry; + VclPtr<FixedText> m_pFT_Geometry; + VclPtr<ListBox> m_pLB_Geometry; }; } //namespace chart diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx index 9d6d0e01cd90..cfb4758cc29b 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.hxx +++ b/chart2/source/controller/dialogs/res_DataLabel.hxx @@ -45,28 +45,28 @@ public: void SetNumberFormatter( SvNumberFormatter* pFormatter ); private: - CheckBox* m_pCBNumber; - PushButton* m_pPB_NumberFormatForValue; - CheckBox* m_pCBPercent; - PushButton* m_pPB_NumberFormatForPercent; - FixedText* m_pFT_NumberFormatForPercent; - CheckBox* m_pCBCategory; - CheckBox* m_pCBSymbol; - - VclHBox* m_pSeparatorResources; - ListBox* m_pLB_Separator; + VclPtr<CheckBox> m_pCBNumber; + VclPtr<PushButton> m_pPB_NumberFormatForValue; + VclPtr<CheckBox> m_pCBPercent; + VclPtr<PushButton> m_pPB_NumberFormatForPercent; + VclPtr<FixedText> m_pFT_NumberFormatForPercent; + VclPtr<CheckBox> m_pCBCategory; + VclPtr<CheckBox> m_pCBSymbol; + + VclPtr<VclHBox> m_pSeparatorResources; + VclPtr<ListBox> m_pLB_Separator; OUString m_aEntryMap[NUMBER_SEPARATORS]; - VclHBox* m_pBxLabelPlacement; - ListBox* m_pLB_LabelPlacement; + VclPtr<VclHBox> m_pBxLabelPlacement; + VclPtr<ListBox> m_pLB_LabelPlacement; - VclHBox* m_pBxOrientation; - svx::DialControl* m_pDC_Dial; - FixedText* m_pFT_Dial; - NumericField* m_pNF_Degrees; + VclPtr<VclHBox> m_pBxOrientation; + VclPtr<svx::DialControl> m_pDC_Dial; + VclPtr<FixedText> m_pFT_Dial; + VclPtr<NumericField> m_pNF_Degrees; - VclHBox* m_pBxTextDirection; - TextDirectionListBox* m_pLB_TextDirection; + VclPtr<VclHBox> m_pBxTextDirection; + VclPtr<TextDirectionListBox> m_pLB_TextDirection; ::std::map< sal_Int32, sal_uInt16 > m_aPlacementToListBoxMap; ::std::map< sal_uInt16, sal_Int32 > m_aListBoxToPlacementMap; @@ -82,7 +82,7 @@ private: bool m_bSourceFormatForValue; bool m_bSourceFormatForPercent; - vcl::Window* m_pWindow; + VclPtr<vcl::Window> m_pWindow; SfxItemPool* m_pPool; DECL_LINK(NumberFormatDialogHdl, PushButton * ); diff --git a/chart2/source/controller/dialogs/res_Trendline.hxx b/chart2/source/controller/dialogs/res_Trendline.hxx index 0d4be04cdf4d..03c3ebe3bd87 100644 --- a/chart2/source/controller/dialogs/res_Trendline.hxx +++ b/chart2/source/controller/dialogs/res_Trendline.hxx @@ -46,29 +46,29 @@ public: void SetNbPoints( sal_Int32 nNbPoints ); private: - RadioButton* m_pRB_Linear; - RadioButton* m_pRB_Logarithmic; - RadioButton* m_pRB_Exponential; - RadioButton* m_pRB_Power; - RadioButton* m_pRB_Polynomial; - RadioButton* m_pRB_MovingAverage; - - FixedImage* m_pFI_Linear; - FixedImage* m_pFI_Logarithmic; - FixedImage* m_pFI_Exponential; - FixedImage* m_pFI_Power; - FixedImage* m_pFI_Polynomial; - FixedImage* m_pFI_MovingAverage; - - NumericField* m_pNF_Degree; - NumericField* m_pNF_Period; - Edit* m_pEE_Name; - FormattedField* m_pFmtFld_ExtrapolateForward; - FormattedField* m_pFmtFld_ExtrapolateBackward; - CheckBox* m_pCB_SetIntercept; - FormattedField* m_pFmtFld_InterceptValue; - CheckBox* m_pCB_ShowEquation; - CheckBox* m_pCB_ShowCorrelationCoeff; + VclPtr<RadioButton> m_pRB_Linear; + VclPtr<RadioButton> m_pRB_Logarithmic; + VclPtr<RadioButton> m_pRB_Exponential; + VclPtr<RadioButton> m_pRB_Power; + VclPtr<RadioButton> m_pRB_Polynomial; + VclPtr<RadioButton> m_pRB_MovingAverage; + + VclPtr<FixedImage> m_pFI_Linear; + VclPtr<FixedImage> m_pFI_Logarithmic; + VclPtr<FixedImage> m_pFI_Exponential; + VclPtr<FixedImage> m_pFI_Power; + VclPtr<FixedImage> m_pFI_Polynomial; + VclPtr<FixedImage> m_pFI_MovingAverage; + + VclPtr<NumericField> m_pNF_Degree; + VclPtr<NumericField> m_pNF_Period; + VclPtr<Edit> m_pEE_Name; + VclPtr<FormattedField> m_pFmtFld_ExtrapolateForward; + VclPtr<FormattedField> m_pFmtFld_ExtrapolateBackward; + VclPtr<CheckBox> m_pCB_SetIntercept; + VclPtr<FormattedField> m_pFmtFld_InterceptValue; + VclPtr<CheckBox> m_pCB_ShowEquation; + VclPtr<CheckBox> m_pCB_ShowCorrelationCoeff; SvxChartRegress m_eTrendLineType; diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx index ff20319c8eb9..d25e226fb19d 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx @@ -120,6 +120,20 @@ ThreeD_SceneAppearance_TabPage::ThreeD_SceneAppearance_TabPage( initControlsFromModel(); } +ThreeD_SceneAppearance_TabPage::~ThreeD_SceneAppearance_TabPage() +{ + dispose(); +} + +void ThreeD_SceneAppearance_TabPage::dispose() +{ + m_pLB_Scheme.clear(); + m_pCB_Shading.clear(); + m_pCB_ObjectLines.clear(); + m_pCB_RoundedEdge.clear(); + TabPage::dispose(); +} + void ThreeD_SceneAppearance_TabPage::ActivatePage() { updateScheme(); diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx index 23749c9da5d3..80720d031e87 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx @@ -38,6 +38,8 @@ public: vcl::Window* pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel, ControllerLockHelper & rControllerLockHelper ); + virtual ~ThreeD_SceneAppearance_TabPage(); + virtual void dispose() SAL_OVERRIDE; virtual void ActivatePage() SAL_OVERRIDE; @@ -55,11 +57,11 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xChartModel; - ListBox* m_pLB_Scheme; + VclPtr<ListBox> m_pLB_Scheme; - CheckBox* m_pCB_Shading; - CheckBox* m_pCB_ObjectLines; - CheckBox* m_pCB_RoundedEdge; + VclPtr<CheckBox> m_pCB_Shading; + VclPtr<CheckBox> m_pCB_ObjectLines; + VclPtr<CheckBox> m_pCB_RoundedEdge; bool m_bUpdateOtherControls; bool m_bCommitToModel; diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx index 0428b2d892be..b1f4dba975b1 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx @@ -147,6 +147,24 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage( vcl::Window* pWindow m_pMFPerspective->SetAccessibleRelationLabeledBy(m_pCbxPerspective); } +ThreeD_SceneGeometry_TabPage::~ThreeD_SceneGeometry_TabPage() +{ + dispose(); +} + +void ThreeD_SceneGeometry_TabPage::dispose() +{ + m_pCbxRightAngledAxes.clear(); + m_pMFXRotation.clear(); + m_pMFYRotation.clear(); + m_pFtZRotation.clear(); + m_pMFZRotation.clear(); + m_pCbxPerspective.clear(); + m_pMFPerspective.clear(); + TabPage::dispose(); +} + + void ThreeD_SceneGeometry_TabPage::commitPendingChanges() { ControllerLockHelperGuard aGuard( m_rControllerLockHelper ); diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx index bc19444f6403..cfd16ff23bd6 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx @@ -39,6 +39,8 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xSceneProperties, ControllerLockHelper & rControllerLockHelper ); + virtual ~ThreeD_SceneGeometry_TabPage(); + virtual void dispose() SAL_OVERRIDE; // has to be called in case the dialog was closed with OK void commitPendingChanges(); @@ -63,17 +65,17 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSceneProperties; - CheckBox* m_pCbxRightAngledAxes; + VclPtr<CheckBox> m_pCbxRightAngledAxes; - MetricField* m_pMFXRotation; + VclPtr<MetricField> m_pMFXRotation; - MetricField* m_pMFYRotation; + VclPtr<MetricField> m_pMFYRotation; - FixedText* m_pFtZRotation; - MetricField* m_pMFZRotation; + VclPtr<FixedText> m_pFtZRotation; + VclPtr<MetricField> m_pMFZRotation; - CheckBox* m_pCbxPerspective; - MetricField* m_pMFPerspective; + VclPtr<CheckBox> m_pCbxPerspective; + VclPtr<MetricField> m_pMFPerspective; //to keep old values when switching to right angled axes sal_Int64 m_nXRotation; diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx index 2c92a7521c1f..a4683a5b5cdb 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx @@ -78,7 +78,7 @@ struct LightSource struct LightSourceInfo { - LightButton* pButton; + VclPtr<LightButton> pButton; LightSource aLightSource; LightSourceInfo(); @@ -301,6 +301,19 @@ void ThreeD_SceneIllumination_TabPage::dispose() { delete[] m_pLightSourceInfoList; m_pLightSourceInfoList = NULL; + m_pBtn_Light1.clear(); + m_pBtn_Light2.clear(); + m_pBtn_Light3.clear(); + m_pBtn_Light4.clear(); + m_pBtn_Light5.clear(); + m_pBtn_Light6.clear(); + m_pBtn_Light7.clear(); + m_pBtn_Light8.clear(); + m_pLB_LightSource.clear(); + m_pBtn_LightSource_Color.clear(); + m_pLB_AmbientLight.clear(); + m_pBtn_AmbientLight_Color.clear(); + m_pCtl_Preview.clear(); TabPage::dispose(); } diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx index 06e27ae02650..b7f46f26e964 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx @@ -74,22 +74,22 @@ private: void applyLightSourceToModel( sal_uInt32 nLightNumber ); void applyLightSourcesToModel(); - LightButton* m_pBtn_Light1; - LightButton* m_pBtn_Light2; - LightButton* m_pBtn_Light3; - LightButton* m_pBtn_Light4; - LightButton* m_pBtn_Light5; - LightButton* m_pBtn_Light6; - LightButton* m_pBtn_Light7; - LightButton* m_pBtn_Light8; - - ColorLB* m_pLB_LightSource; - PushButton* m_pBtn_LightSource_Color; - - ColorLB* m_pLB_AmbientLight; - PushButton* m_pBtn_AmbientLight_Color; - - SvxLightCtl3D* m_pCtl_Preview; + VclPtr<LightButton> m_pBtn_Light1; + VclPtr<LightButton> m_pBtn_Light2; + VclPtr<LightButton> m_pBtn_Light3; + VclPtr<LightButton> m_pBtn_Light4; + VclPtr<LightButton> m_pBtn_Light5; + VclPtr<LightButton> m_pBtn_Light6; + VclPtr<LightButton> m_pBtn_Light7; + VclPtr<LightButton> m_pBtn_Light8; + + VclPtr<ColorLB> m_pLB_LightSource; + VclPtr<PushButton> m_pBtn_LightSource_Color; + + VclPtr<ColorLB> m_pLB_AmbientLight; + VclPtr<PushButton> m_pBtn_AmbientLight_Color; + + VclPtr<SvxLightCtl3D> m_pCtl_Preview; LightSourceInfo* m_pLightSourceInfoList; diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx index 0cded264a300..06d810b47815 100644 --- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx +++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx @@ -79,6 +79,23 @@ void SchAxisLabelTabPage::dispose() { delete m_pOrientHlp; m_pOrientHlp = NULL; + m_pCbShowDescription.clear(); + m_pFlOrder.clear(); + m_pRbSideBySide.clear(); + m_pRbUpDown.clear(); + m_pRbDownUp.clear(); + m_pRbAuto.clear(); + m_pFlTextFlow.clear(); + m_pCbTextOverlap.clear(); + m_pCbTextBreak.clear(); + m_pFtABCD.clear(); + m_pFlOrient.clear(); + m_pCtrlDial.clear(); + m_pFtRotate.clear(); + m_pNfRotate.clear(); + m_pCbStacked.clear(); + m_pFtTextDirection.clear(); + m_pLbTextDirection.clear(); SfxTabPage::dispose(); } diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.hxx b/chart2/source/controller/dialogs/tp_AxisLabel.hxx index 95474b805941..2f01f32e5ae8 100644 --- a/chart2/source/controller/dialogs/tp_AxisLabel.hxx +++ b/chart2/source/controller/dialogs/tp_AxisLabel.hxx @@ -35,27 +35,27 @@ namespace chart class SchAxisLabelTabPage : public SfxTabPage { private: - CheckBox* m_pCbShowDescription; + VclPtr<CheckBox> m_pCbShowDescription; - FixedText* m_pFlOrder; - RadioButton* m_pRbSideBySide; - RadioButton* m_pRbUpDown; - RadioButton* m_pRbDownUp; - RadioButton* m_pRbAuto; + VclPtr<FixedText> m_pFlOrder; + VclPtr<RadioButton> m_pRbSideBySide; + VclPtr<RadioButton> m_pRbUpDown; + VclPtr<RadioButton> m_pRbDownUp; + VclPtr<RadioButton> m_pRbAuto; - FixedText* m_pFlTextFlow; - CheckBox* m_pCbTextOverlap; - CheckBox* m_pCbTextBreak; - FixedText* m_pFtABCD; - FixedText* m_pFlOrient; - svx::DialControl* m_pCtrlDial; - FixedText* m_pFtRotate; - NumericField* m_pNfRotate; - TriStateBox* m_pCbStacked; + VclPtr<FixedText> m_pFlTextFlow; + VclPtr<CheckBox> m_pCbTextOverlap; + VclPtr<CheckBox> m_pCbTextBreak; + VclPtr<FixedText> m_pFtABCD; + VclPtr<FixedText> m_pFlOrient; + VclPtr<svx::DialControl> m_pCtrlDial; + VclPtr<FixedText> m_pFtRotate; + VclPtr<NumericField> m_pNfRotate; + VclPtr<TriStateBox> m_pCbStacked; svx::OrientationHelper* m_pOrientHlp; - FixedText* m_pFtTextDirection; - TextDirectionListBox* m_pLbTextDirection; + VclPtr<FixedText> m_pFtTextDirection; + VclPtr<TextDirectionListBox> m_pLbTextDirection; bool m_bShowStaggeringControls; diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.cxx b/chart2/source/controller/dialogs/tp_AxisPositions.cxx index 9bcb6e8e2938..0d33af228b69 100644 --- a/chart2/source/controller/dialogs/tp_AxisPositions.cxx +++ b/chart2/source/controller/dialogs/tp_AxisPositions.cxx @@ -84,6 +84,30 @@ AxisPositionsTabPage::AxisPositionsTabPage(vcl::Window* pWindow,const SfxItemSet m_pLB_PlaceTicks->SetDropDownLineCount( m_pLB_PlaceTicks->GetEntryCount() ); } +AxisPositionsTabPage::~AxisPositionsTabPage() +{ + dispose(); +} + +void AxisPositionsTabPage::dispose() +{ + m_pFL_AxisLine.clear(); + m_pLB_CrossesAt.clear(); + m_pED_CrossesAt.clear(); + m_pED_CrossesAtCategory.clear(); + m_pCB_AxisBetweenCategories.clear(); + m_pFL_Labels.clear(); + m_pLB_PlaceLabels.clear(); + m_pED_LabelDistance.clear(); + m_pCB_TicksInner.clear(); + m_pCB_TicksOuter.clear(); + m_pCB_MinorInner.clear(); + m_pCB_MinorOuter.clear(); + m_pBxPlaceTicks.clear(); + m_pLB_PlaceTicks.clear(); + SfxTabPage::dispose(); +} + SfxTabPage* AxisPositionsTabPage::Create(vcl::Window* pWindow,const SfxItemSet* rOutAttrs) { return new AxisPositionsTabPage(pWindow, *rOutAttrs); diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.hxx b/chart2/source/controller/dialogs/tp_AxisPositions.hxx index 3dfeecd8f3ff..ee73d5240366 100644 --- a/chart2/source/controller/dialogs/tp_AxisPositions.hxx +++ b/chart2/source/controller/dialogs/tp_AxisPositions.hxx @@ -33,6 +33,8 @@ class AxisPositionsTabPage : public SfxTabPage { public: AxisPositionsTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); + virtual ~AxisPositionsTabPage(); + virtual void dispose() SAL_OVERRIDE; static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rInAttrs ); virtual bool FillItemSet( SfxItemSet* rOutAttrs ) SAL_OVERRIDE; @@ -52,30 +54,30 @@ private: //methods: DECL_LINK( PlaceLabelsSelectHdl, void* ); private: //member: - VclFrame* m_pFL_AxisLine; - ListBox* m_pLB_CrossesAt; - FormattedField* m_pED_CrossesAt; - ComboBox* m_pED_CrossesAtCategory; - CheckBox* m_pCB_AxisBetweenCategories; + VclPtr<VclFrame> m_pFL_AxisLine; + VclPtr<ListBox> m_pLB_CrossesAt; + VclPtr<FormattedField> m_pED_CrossesAt; + VclPtr<ComboBox> m_pED_CrossesAtCategory; + VclPtr<CheckBox> m_pCB_AxisBetweenCategories; - VclFrame* m_pFL_Labels; - ListBox* m_pLB_PlaceLabels; - FormattedField* m_pED_LabelDistance; + VclPtr<VclFrame> m_pFL_Labels; + VclPtr<ListBox> m_pLB_PlaceLabels; + VclPtr<FormattedField> m_pED_LabelDistance; - CheckBox* m_pCB_TicksInner; - CheckBox* m_pCB_TicksOuter; + VclPtr<CheckBox> m_pCB_TicksInner; + VclPtr<CheckBox> m_pCB_TicksOuter; - CheckBox* m_pCB_MinorInner; - CheckBox* m_pCB_MinorOuter; + VclPtr<CheckBox> m_pCB_MinorInner; + VclPtr<CheckBox> m_pCB_MinorOuter; - VclBox* m_pBxPlaceTicks; - ListBox* m_pLB_PlaceTicks; + VclPtr<VclBox> m_pBxPlaceTicks; + VclPtr<ListBox> m_pLB_PlaceTicks; // Not implemented -// CheckBox* m_pCB_MajorGrid; -// PushButton* m_pPB_MajorGrid; -// CheckBox* m_pCB_MinorGrid; -// PushButton* m_pPB_MinorGrid; +// VclPtr<CheckBox> m_pCB_MajorGrid; +// VclPtr<PushButton> m_pPB_MajorGrid; +// VclPtr<CheckBox> m_pCB_MinorGrid; +// VclPtr<PushButton> m_pPB_MinorGrid; SvNumberFormatter* m_pNumFormatter; diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx index c7179039ae66..7618ef79adb0 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.cxx +++ b/chart2/source/controller/dialogs/tp_ChartType.cxx @@ -56,8 +56,8 @@ private: DECL_LINK( SelectSchemeHdl, void* ); private: - CheckBox* m_pCB_3DLook; - ListBox* m_pLB_Scheme; + VclPtr<CheckBox> m_pCB_3DLook; + VclPtr<ListBox> m_pLB_Scheme; }; Dim3DLookResourceGroup::Dim3DLookResourceGroup(VclBuilderContainer* pWindow) @@ -129,7 +129,7 @@ private: DECL_LINK( SortByXValuesCheckHdl, void* ); private: - CheckBox* m_pCB_XValueSorting; + VclPtr<CheckBox> m_pCB_XValueSorting; }; SortByXValuesResourceGroup::SortByXValuesResourceGroup(VclBuilderContainer* pWindow ) @@ -176,10 +176,10 @@ private: DECL_LINK( StackingEnableHdl, void* ); private: - CheckBox* m_pCB_Stacked; - RadioButton* m_pRB_Stack_Y; - RadioButton* m_pRB_Stack_Y_Percent; - RadioButton* m_pRB_Stack_Z; + VclPtr<CheckBox> m_pCB_Stacked; + VclPtr<RadioButton> m_pRB_Stack_Y; + VclPtr<RadioButton> m_pRB_Stack_Y_Percent; + VclPtr<RadioButton> m_pRB_Stack_Z; bool m_bShowDeepStacking; }; @@ -278,7 +278,7 @@ public: private: DECL_LINK( SettingChangedHdl, void* ); private: - CheckBox* m_pCB_RoundedEdge; + VclPtr<CheckBox> m_pCB_RoundedEdge; }; GL3DResourceGroup::GL3DResourceGroup( VclBuilderContainer* pWindow ) @@ -313,6 +313,8 @@ class SplinePropertiesDialog : public ModalDialog { public: SplinePropertiesDialog( vcl::Window* pParent ); + virtual ~SplinePropertiesDialog() { dispose(); } + virtual void dispose() SAL_OVERRIDE; void fillControls( const ChartTypeParameter& rParameter ); void fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines ); @@ -323,11 +325,11 @@ private: DECL_LINK( SplineTypeListBoxHdl, void* ); private: - ListBox* m_pLB_Spline_Type; + VclPtr<ListBox> m_pLB_Spline_Type; - NumericField* m_pMF_SplineResolution; - FixedText* m_pFT_SplineOrder; - NumericField* m_pMF_SplineOrder; + VclPtr<NumericField> m_pMF_SplineResolution; + VclPtr<FixedText> m_pFT_SplineOrder; + VclPtr<NumericField> m_pMF_SplineOrder; }; const sal_uInt16 CUBIC_SPLINE_POS = 0; @@ -346,6 +348,15 @@ SplinePropertiesDialog::SplinePropertiesDialog( vcl::Window* pParent ) m_pLB_Spline_Type->SetSelectHdl( LINK (this, SplinePropertiesDialog, SplineTypeListBoxHdl ) ); } +void SplinePropertiesDialog::dispose() +{ + m_pLB_Spline_Type.clear(); + m_pMF_SplineResolution.clear(); + m_pFT_SplineOrder.clear(); + m_pMF_SplineOrder.clear(); + ModalDialog::dispose(); +} + void SplinePropertiesDialog::StateChanged( StateChangedType nType ) { Dialog::StateChanged( nType ); @@ -395,6 +406,8 @@ class SteppedPropertiesDialog : public ModalDialog { public: SteppedPropertiesDialog( vcl::Window* pParent ); + virtual ~SteppedPropertiesDialog() { dispose(); } + virtual void dispose() SAL_OVERRIDE; void fillControls( const ChartTypeParameter& rParameter ); void fillParameter( ChartTypeParameter& rParameter, bool bSteppedLines ); @@ -404,10 +417,10 @@ public: private: private: - RadioButton* m_pRB_Start; - RadioButton* m_pRB_End; - RadioButton* m_pRB_CenterX; - RadioButton* m_pRB_CenterY; + VclPtr<RadioButton> m_pRB_Start; + VclPtr<RadioButton> m_pRB_End; + VclPtr<RadioButton> m_pRB_CenterX; + VclPtr<RadioButton> m_pRB_CenterY; }; SteppedPropertiesDialog::SteppedPropertiesDialog( vcl::Window* pParent ) @@ -421,6 +434,15 @@ SteppedPropertiesDialog::SteppedPropertiesDialog( vcl::Window* pParent ) SetText(SCH_RESSTR(STR_DLG_STEPPED_LINE_PROPERTIES)); } +void SteppedPropertiesDialog::dispose() +{ + m_pRB_Start.clear(); + m_pRB_End.clear(); + m_pRB_CenterX.clear(); + m_pRB_CenterY.clear(); + ModalDialog::dispose(); +} + void SteppedPropertiesDialog::StateChanged( StateChangedType nType ) { Dialog::StateChanged( nType ); @@ -480,9 +502,9 @@ private: SteppedPropertiesDialog& getSteppedPropertiesDialog(); private: - FixedText* m_pFT_LineType; - ListBox* m_pLB_LineType; - PushButton* m_pPB_DetailsDialog; + VclPtr<FixedText> m_pFT_LineType; + VclPtr<ListBox> m_pLB_LineType; + VclPtr<PushButton> m_pPB_DetailsDialog; boost::scoped_ptr< SplinePropertiesDialog > m_pSplinePropertiesDialog; boost::scoped_ptr< SteppedPropertiesDialog > m_pSteppedPropertiesDialog; }; @@ -791,6 +813,9 @@ void ChartTypeTabPage::dispose() m_pSortByXValuesResourceGroup = NULL; delete m_pGL3DResourceGroup; m_pGL3DResourceGroup = NULL; + m_pFT_ChooseType.clear(); + m_pMainTypeList.clear(); + m_pSubTypeList.clear(); svt::OWizardPage::dispose(); } diff --git a/chart2/source/controller/dialogs/tp_ChartType.hxx b/chart2/source/controller/dialogs/tp_ChartType.hxx index a8cb43c97703..4ed830b10535 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.hxx +++ b/chart2/source/controller/dialogs/tp_ChartType.hxx @@ -78,9 +78,9 @@ protected: DECL_LINK( SelectSubTypeHdl, void* ); protected: - FixedText* m_pFT_ChooseType; - ListBox* m_pMainTypeList; - ValueSet* m_pSubTypeList; + VclPtr<FixedText> m_pFT_ChooseType; + VclPtr<ListBox> m_pMainTypeList; + VclPtr<ValueSet> m_pSubTypeList; Dim3DLookResourceGroup* m_pDim3DLookResourceGroup; StackingResourceGroup* m_pStackingResourceGroup; diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index 0aec36a88576..f59465a4460c 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -273,6 +273,34 @@ DataSourceTabPage::DataSourceTabPage( m_pBTN_DOWN->SetAccessibleName(SCH_RESSTR(STR_BUTTON_DOWN)); } +DataSourceTabPage::~DataSourceTabPage() +{ + dispose(); +} + +void DataSourceTabPage::dispose() +{ + m_pFT_CAPTION.clear(); + m_pFT_SERIES.clear(); + m_pLB_SERIES.clear(); + m_pBTN_ADD.clear(); + m_pBTN_REMOVE.clear(); + m_pBTN_UP.clear(); + m_pBTN_DOWN.clear(); + m_pFT_ROLE.clear(); + m_pLB_ROLE.clear(); + m_pFT_RANGE.clear(); + m_pEDT_RANGE.clear(); + m_pIMB_RANGE_MAIN.clear(); + m_pFT_CATEGORIES.clear(); + m_pFT_DATALABELS.clear(); + m_pEDT_CATEGORIES.clear(); + m_pIMB_RANGE_CAT.clear(); + m_pCurrentRangeChoosingField.clear(); + m_pParentDialog.clear(); + ::svt::OWizardPage::dispose(); +} + void DataSourceTabPage::ActivatePage() { OWizardPage::ActivatePage(); diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx index b1ad81353d9e..59b92bf840c3 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.hxx +++ b/chart2/source/controller/dialogs/tp_DataSource.hxx @@ -58,6 +58,8 @@ public: ChartTypeTemplateProvider* pTemplateProvider, Dialog * pParentDialog, bool bHideDescription = false ); + virtual ~DataSourceTabPage(); + virtual void dispose() SAL_OVERRIDE; void commitPage(); @@ -117,34 +119,34 @@ protected: void fillRoleListBox(); private: - FixedText* m_pFT_CAPTION; - FixedText* m_pFT_SERIES; - SvTreeListBox* m_pLB_SERIES; - PushButton* m_pBTN_ADD; - PushButton* m_pBTN_REMOVE; - PushButton* m_pBTN_UP; - PushButton* m_pBTN_DOWN; - - FixedText* m_pFT_ROLE; - SvTabListBox* m_pLB_ROLE; - FixedText* m_pFT_RANGE; - Edit* m_pEDT_RANGE; - PushButton* m_pIMB_RANGE_MAIN; - - FixedText* m_pFT_CATEGORIES; - FixedText* m_pFT_DATALABELS;//used for xy charts - Edit* m_pEDT_CATEGORIES; - PushButton* m_pIMB_RANGE_CAT; + VclPtr<FixedText> m_pFT_CAPTION; + VclPtr<FixedText> m_pFT_SERIES; + VclPtr<SvTreeListBox> m_pLB_SERIES; + VclPtr<PushButton> m_pBTN_ADD; + VclPtr<PushButton> m_pBTN_REMOVE; + VclPtr<PushButton> m_pBTN_UP; + VclPtr<PushButton> m_pBTN_DOWN; + + VclPtr<FixedText> m_pFT_ROLE; + VclPtr<SvTabListBox> m_pLB_ROLE; + VclPtr<FixedText> m_pFT_RANGE; + VclPtr<Edit> m_pEDT_RANGE; + VclPtr<PushButton> m_pIMB_RANGE_MAIN; + + VclPtr<FixedText> m_pFT_CATEGORIES; + VclPtr<FixedText> m_pFT_DATALABELS;//used for xy charts + VclPtr<Edit> m_pEDT_CATEGORIES; + VclPtr<PushButton> m_pIMB_RANGE_CAT; OUString m_aFixedTextRange; ChartTypeTemplateProvider * m_pTemplateProvider; DialogModel & m_rDialogModel; - Edit * m_pCurrentRangeChoosingField; + VclPtr<Edit> m_pCurrentRangeChoosingField; bool m_bIsDirty; sal_Int32 m_nLastChartTypeGroupIndex; - Dialog * m_pParentDialog; + VclPtr<Dialog> m_pParentDialog; TabPageNotifiable * m_pTabPageNotifiable; }; diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.cxx b/chart2/source/controller/dialogs/tp_LegendPosition.cxx index 707324fb8610..31aef92a297f 100644 --- a/chart2/source/controller/dialogs/tp_LegendPosition.cxx +++ b/chart2/source/controller/dialogs/tp_LegendPosition.cxx @@ -41,6 +41,18 @@ SchLegendPosTabPage::SchLegendPosTabPage(vcl::Window* pWindow, const SfxItemSet& m_pLbTextDirection->SetDropDownLineCount(3); } +SchLegendPosTabPage::~SchLegendPosTabPage() +{ + dispose(); +} + +void SchLegendPosTabPage::dispose() +{ + m_pLbTextDirection.clear(); + SfxTabPage::dispose(); +} + + SfxTabPage* SchLegendPosTabPage::Create(vcl::Window* pWindow, const SfxItemSet* rOutAttrs) { return new SchLegendPosTabPage(pWindow, *rOutAttrs); diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.hxx b/chart2/source/controller/dialogs/tp_LegendPosition.hxx index 0d4f4acf0d07..bbf8e1d54f2b 100644 --- a/chart2/source/controller/dialogs/tp_LegendPosition.hxx +++ b/chart2/source/controller/dialogs/tp_LegendPosition.hxx @@ -33,10 +33,12 @@ class SchLegendPosTabPage : public SfxTabPage private: LegendPositionResources m_aLegendPositionResources; - TextDirectionListBox* m_pLbTextDirection; + VclPtr<TextDirectionListBox> m_pLbTextDirection; public: SchLegendPosTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs); + virtual ~SchLegendPosTabPage(); + virtual void dispose() SAL_OVERRIDE; static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rInAttrs); virtual bool FillItemSet(SfxItemSet* rOutAttrs) SAL_OVERRIDE; diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx index ff9db6088675..00fc6fe96a62 100644 --- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx +++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx @@ -44,6 +44,22 @@ PolarOptionsTabPage::PolarOptionsTabPage( vcl::Window* pWindow,const SfxItemSet& m_pAngleDial->SetLinkedField( m_pNF_StartingAngle ); } +PolarOptionsTabPage::~PolarOptionsTabPage() +{ + dispose(); +} + +void PolarOptionsTabPage::dispose() +{ + m_pCB_Clockwise.clear(); + m_pFL_StartingAngle.clear(); + m_pAngleDial.clear(); + m_pNF_StartingAngle.clear(); + m_pFL_PlotOptions.clear(); + m_pCB_IncludeHiddenCells.clear(); + SfxTabPage::dispose(); +} + SfxTabPage* PolarOptionsTabPage::Create( vcl::Window* pWindow,const SfxItemSet* rOutAttrs ) { return new PolarOptionsTabPage( pWindow, *rOutAttrs ); diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.hxx b/chart2/source/controller/dialogs/tp_PolarOptions.hxx index 4ade72189cf4..29e672857bb1 100644 --- a/chart2/source/controller/dialogs/tp_PolarOptions.hxx +++ b/chart2/source/controller/dialogs/tp_PolarOptions.hxx @@ -33,18 +33,20 @@ class PolarOptionsTabPage : public SfxTabPage public: PolarOptionsTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs ); + virtual ~PolarOptionsTabPage(); + virtual void dispose() SAL_OVERRIDE; static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rInAttrs); virtual bool FillItemSet(SfxItemSet* rOutAttrs) SAL_OVERRIDE; virtual void Reset(const SfxItemSet* rInAttrs) SAL_OVERRIDE; private: - CheckBox* m_pCB_Clockwise; - VclFrame* m_pFL_StartingAngle; - svx::DialControl* m_pAngleDial; - NumericField* m_pNF_StartingAngle; - VclFrame* m_pFL_PlotOptions; - CheckBox* m_pCB_IncludeHiddenCells; + VclPtr<CheckBox> m_pCB_Clockwise; + VclPtr<VclFrame> m_pFL_StartingAngle; + VclPtr<svx::DialControl> m_pAngleDial; + VclPtr<NumericField> m_pNF_StartingAngle; + VclPtr<VclFrame> m_pFL_PlotOptions; + VclPtr<CheckBox> m_pCB_IncludeHiddenCells; }; } //namespace chart diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx index 108aac0c77a8..700c3e04556f 100644 --- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx +++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx @@ -122,6 +122,30 @@ RangeChooserTabPage::RangeChooserTabPage( vcl::Window* pParent m_pEd_TimeEnd->SetModifyHdl( LINK( this, RangeChooserTabPage, ControlChangedHdl ) ); } +RangeChooserTabPage::~RangeChooserTabPage() +{ + dispose(); +} + +void RangeChooserTabPage::dispose() +{ + m_pFT_Caption.clear(); + m_pFT_Range.clear(); + m_pED_Range.clear(); + m_pIB_Range.clear(); + m_pRB_Rows.clear(); + m_pRB_Columns.clear(); + m_pCB_FirstRowAsLabel.clear(); + m_pCB_FirstColumnAsLabel.clear(); + m_pFTTitle.clear(); + m_pCB_TimeBased.clear(); + m_pEd_TimeStart.clear(); + m_pEd_TimeEnd.clear(); + m_pParentDialog.clear(); + OWizardPage::dispose(); +} + + void RangeChooserTabPage::ActivatePage() { OWizardPage::ActivatePage(); diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.hxx b/chart2/source/controller/dialogs/tp_RangeChooser.hxx index f7a0791fd6ff..5bcda3593f8b 100644 --- a/chart2/source/controller/dialogs/tp_RangeChooser.hxx +++ b/chart2/source/controller/dialogs/tp_RangeChooser.hxx @@ -48,6 +48,8 @@ public: , ChartTypeTemplateProvider* pTemplateProvider , Dialog * pParentDialog , bool bHideDescription = false ); + virtual ~RangeChooserTabPage(); + virtual void dispose() SAL_OVERRIDE; //RangeSelectionListenerParent virtual void listeningFinished( const OUString & rNewRange ) SAL_OVERRIDE; @@ -75,21 +77,21 @@ protected: //methods protected: //member - FixedText* m_pFT_Caption; - FixedText* m_pFT_Range; - Edit* m_pED_Range; - PushButton* m_pIB_Range; + VclPtr<FixedText> m_pFT_Caption; + VclPtr<FixedText> m_pFT_Range; + VclPtr<Edit> m_pED_Range; + VclPtr<PushButton> m_pIB_Range; - RadioButton* m_pRB_Rows; - RadioButton* m_pRB_Columns; + VclPtr<RadioButton> m_pRB_Rows; + VclPtr<RadioButton> m_pRB_Columns; - CheckBox* m_pCB_FirstRowAsLabel; - CheckBox* m_pCB_FirstColumnAsLabel; - FixedText* m_pFTTitle; + VclPtr<CheckBox> m_pCB_FirstRowAsLabel; + VclPtr<CheckBox> m_pCB_FirstColumnAsLabel; + VclPtr<FixedText> m_pFTTitle; - CheckBox* m_pCB_TimeBased; - Edit* m_pEd_TimeStart; - Edit* m_pEd_TimeEnd; + VclPtr<CheckBox> m_pCB_TimeBased; + VclPtr<Edit> m_pEd_TimeStart; + VclPtr<Edit> m_pEd_TimeEnd; sal_Int32 m_nChangingControlCalls; bool m_bIsDirty; @@ -105,7 +107,7 @@ protected: //member ChartTypeTemplateProvider* m_pTemplateProvider; DialogModel & m_rDialogModel; - Dialog * m_pParentDialog; + VclPtr<Dialog> m_pParentDialog; TabPageNotifiable * m_pTabPageNotifiable; }; diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx index bb92e78c095d..9db6bda24daf 100644 --- a/chart2/source/controller/dialogs/tp_Scale.cxx +++ b/chart2/source/controller/dialogs/tp_Scale.cxx @@ -122,6 +122,41 @@ ScaleTabPage::ScaleTabPage(vcl::Window* pWindow,const SfxItemSet& rInAttrs) : HideAllControls(); } +ScaleTabPage::~ScaleTabPage() +{ + dispose(); +} + +void ScaleTabPage::dispose() +{ + m_pCbxReverse.clear(); + m_pCbxLogarithm.clear(); + m_pBxType.clear(); + m_pLB_AxisType.clear(); + m_pBxMinMax.clear(); + m_pFmtFldMin.clear(); + m_pCbxAutoMin.clear(); + m_pFmtFldMax.clear(); + m_pCbxAutoMax.clear(); + m_pBxResolution.clear(); + m_pLB_TimeResolution.clear(); + m_pCbx_AutoTimeResolution.clear(); + m_pTxtMain.clear(); + m_pFmtFldStepMain.clear(); + m_pMt_MainDateStep.clear(); + m_pLB_MainTimeUnit.clear(); + m_pCbxAutoStepMain.clear(); + m_pTxtHelpCount.clear(); + m_pTxtHelp.clear(); + m_pMtStepHelp.clear(); + m_pLB_HelpTimeUnit.clear(); + m_pCbxAutoStepHelp.clear(); + m_pFmtFldOrigin.clear(); + m_pCbxAutoOrigin.clear(); + m_pBxOrigin.clear(); + SfxTabPage::dispose(); +} + IMPL_LINK( ScaleTabPage, FmtFieldModifiedHdl, FormattedField*, pFmtFied ) { if( pFmtFied ) diff --git a/chart2/source/controller/dialogs/tp_Scale.hxx b/chart2/source/controller/dialogs/tp_Scale.hxx index ff8bbe7e9d1b..529641da2a6e 100644 --- a/chart2/source/controller/dialogs/tp_Scale.hxx +++ b/chart2/source/controller/dialogs/tp_Scale.hxx @@ -33,6 +33,8 @@ class ScaleTabPage : public SfxTabPage { public: ScaleTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); + virtual ~ScaleTabPage(); + virtual void dispose() SAL_OVERRIDE; static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rInAttrs ); virtual bool FillItemSet( SfxItemSet* rOutAttrs ) SAL_OVERRIDE; @@ -48,38 +50,38 @@ public: virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE; private: - CheckBox* m_pCbxReverse; - CheckBox* m_pCbxLogarithm; - - VclBox* m_pBxType; - ListBox* m_pLB_AxisType; - - VclGrid* m_pBxMinMax; - FormattedField* m_pFmtFldMin; - CheckBox* m_pCbxAutoMin; - - FormattedField* m_pFmtFldMax; - CheckBox* m_pCbxAutoMax; - - VclBox* m_pBxResolution; - ListBox* m_pLB_TimeResolution; - CheckBox* m_pCbx_AutoTimeResolution; - - FixedText* m_pTxtMain; - FormattedField* m_pFmtFldStepMain; - MetricField* m_pMt_MainDateStep; - ListBox* m_pLB_MainTimeUnit; - CheckBox* m_pCbxAutoStepMain; - - FixedText* m_pTxtHelpCount; - FixedText* m_pTxtHelp; - MetricField* m_pMtStepHelp; - ListBox* m_pLB_HelpTimeUnit; - CheckBox* m_pCbxAutoStepHelp; - - FormattedField* m_pFmtFldOrigin; - CheckBox* m_pCbxAutoOrigin; - VclBox* m_pBxOrigin; + VclPtr<CheckBox> m_pCbxReverse; + VclPtr<CheckBox> m_pCbxLogarithm; + + VclPtr<VclBox> m_pBxType; + VclPtr<ListBox> m_pLB_AxisType; + + VclPtr<VclGrid> m_pBxMinMax; + VclPtr<FormattedField> m_pFmtFldMin; + VclPtr<CheckBox> m_pCbxAutoMin; + + VclPtr<FormattedField> m_pFmtFldMax; + VclPtr<CheckBox> m_pCbxAutoMax; + + VclPtr<VclBox> m_pBxResolution; + VclPtr<ListBox> m_pLB_TimeResolution; + VclPtr<CheckBox> m_pCbx_AutoTimeResolution; + + VclPtr<FixedText> m_pTxtMain; + VclPtr<FormattedField> m_pFmtFldStepMain; + VclPtr<MetricField> m_pMt_MainDateStep; + VclPtr<ListBox> m_pLB_MainTimeUnit; + VclPtr<CheckBox> m_pCbxAutoStepMain; + + VclPtr<FixedText> m_pTxtHelpCount; + VclPtr<FixedText> m_pTxtHelp; + VclPtr<MetricField> m_pMtStepHelp; + VclPtr<ListBox> m_pLB_HelpTimeUnit; + VclPtr<CheckBox> m_pCbxAutoStepHelp; + + VclPtr<FormattedField> m_pFmtFldOrigin; + VclPtr<CheckBox> m_pCbxAutoOrigin; + VclPtr<VclBox> m_pBxOrigin; double fMin; double fMax; diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx index 4f4a986df57a..0a5b50485d71 100644 --- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx +++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx @@ -63,6 +63,30 @@ SchOptionTabPage::SchOptionTabPage(vcl::Window* pWindow,const SfxItemSet& rInAtt m_pRbtAxis2->SetClickHdl( LINK( this, SchOptionTabPage, EnableHdl )); } +SchOptionTabPage::~SchOptionTabPage() +{ + dispose(); +} + +void SchOptionTabPage::dispose() +{ + m_pGrpAxis.clear(); + m_pRbtAxis1.clear(); + m_pRbtAxis2.clear(); + m_pGrpBar.clear(); + m_pMTGap.clear(); + m_pMTOverlap.clear(); + m_pCBConnect.clear(); + m_pCBAxisSideBySide.clear(); + m_pGrpPlotOptions.clear(); + m_pGridPlotOptions.clear(); + m_pRB_DontPaint.clear(); + m_pRB_AssumeZero.clear(); + m_pRB_ContinueLine.clear(); + m_pCBIncludeHiddenCells.clear(); + SfxTabPage::dispose(); +} + IMPL_LINK_NOARG(SchOptionTabPage, EnableHdl) { if( m_nAllSeriesAxisIndex == 0 ) diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx index f11c8e5ea24a..b50f90fff4fe 100644 --- a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx +++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx @@ -31,6 +31,8 @@ class SchOptionTabPage : public SfxTabPage { public: SchOptionTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs); + virtual ~SchOptionTabPage(); + virtual void dispose() SAL_OVERRIDE; static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rInAttrs); virtual bool FillItemSet(SfxItemSet* rOutAttrs) SAL_OVERRIDE; @@ -42,23 +44,23 @@ private: //methods void AdaptControlPositionsAndVisibility(); private: //member - VclFrame* m_pGrpAxis; - RadioButton* m_pRbtAxis1; - RadioButton* m_pRbtAxis2; - - VclFrame* m_pGrpBar; - MetricField* m_pMTGap; - MetricField* m_pMTOverlap; - CheckBox* m_pCBConnect; - CheckBox* m_pCBAxisSideBySide; - - VclFrame* m_pGrpPlotOptions; - VclGrid* m_pGridPlotOptions; - RadioButton* m_pRB_DontPaint; - RadioButton* m_pRB_AssumeZero; - RadioButton* m_pRB_ContinueLine; - - CheckBox* m_pCBIncludeHiddenCells; + VclPtr<VclFrame> m_pGrpAxis; + VclPtr<RadioButton> m_pRbtAxis1; + VclPtr<RadioButton> m_pRbtAxis2; + + VclPtr<VclFrame> m_pGrpBar; + VclPtr<MetricField> m_pMTGap; + VclPtr<MetricField> m_pMTOverlap; + VclPtr<CheckBox> m_pCBConnect; + VclPtr<CheckBox> m_pCBAxisSideBySide; + + VclPtr<VclGrid> m_pGrpPlotOptions; + VclPtr<VclGrid> m_pGridPlotOptions; + VclPtr<RadioButton> m_pRB_DontPaint; + VclPtr<RadioButton> m_pRB_AssumeZero; + VclPtr<RadioButton> m_pRB_ContinueLine; + + VclPtr<CheckBox> m_pCBIncludeHiddenCells; DECL_LINK(EnableHdl, void * ); diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx index a83373dcbc8b..c69eb46a482b 100644 --- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx +++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx @@ -64,6 +64,13 @@ void SchAlignmentTabPage::dispose() { delete m_pOrientHlp; m_pOrientHlp = NULL; + m_pCtrlDial.clear(); + m_pFtRotate.clear(); + m_pNfRotate.clear(); + m_pCbStacked.clear(); + m_pFtTextDirection.clear(); + m_pLbTextDirection.clear(); + m_pFtABCD.clear(); SfxTabPage::dispose(); } diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.hxx b/chart2/source/controller/dialogs/tp_TitleRotation.hxx index e5d2e240a153..8450d6a4a202 100644 --- a/chart2/source/controller/dialogs/tp_TitleRotation.hxx +++ b/chart2/source/controller/dialogs/tp_TitleRotation.hxx @@ -31,14 +31,14 @@ namespace chart class SchAlignmentTabPage : public SfxTabPage { private: - svx::DialControl* m_pCtrlDial; - FixedText* m_pFtRotate; - NumericField* m_pNfRotate; - TriStateBox* m_pCbStacked; + VclPtr<svx::DialControl> m_pCtrlDial; + VclPtr<FixedText> m_pFtRotate; + VclPtr<NumericField> m_pNfRotate; + VclPtr<TriStateBox> m_pCbStacked; svx::OrientationHelper* m_pOrientHlp; - FixedText* m_pFtTextDirection; - TextDirectionListBox* m_pLbTextDirection; - FixedText* m_pFtABCD; + VclPtr<FixedText> m_pFtTextDirection; + VclPtr<TextDirectionListBox> m_pLbTextDirection; + VclPtr<FixedText> m_pFtABCD; public: SchAlignmentTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs, bool bWithRotation = true); diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx index 90088b0b66ae..23986e1f2690 100644 --- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx +++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx @@ -57,6 +57,19 @@ TitlesAndObjectsTabPage::TitlesAndObjectsTabPage( svt::OWizardMachine* pParent m_pCB_Grid_Z->SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl )); } +TitlesAndObjectsTabPage::~TitlesAndObjectsTabPage() +{ + dispose(); +} + +void TitlesAndObjectsTabPage::dispose() +{ + m_pCB_Grid_X.clear(); + m_pCB_Grid_Y.clear(); + m_pCB_Grid_Z.clear(); + OWizardPage::dispose(); +} + void TitlesAndObjectsTabPage::initializePage() { m_bCommitToModel = false; diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx index 26e2cb2aebae..520453ce0452 100644 --- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx +++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx @@ -44,6 +44,8 @@ public: ::com::sun::star::chart2::XChartDocument >& xChartModel , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ); + virtual ~TitlesAndObjectsTabPage(); + virtual void dispose() SAL_OVERRIDE; virtual void initializePage() SAL_OVERRIDE; virtual bool commitPage( ::svt::WizardTypes::CommitPageReason eReason ) SAL_OVERRIDE; @@ -57,9 +59,9 @@ protected: boost::scoped_ptr< TitleResources > m_xTitleResources; boost::scoped_ptr< LegendPositionResources > m_xLegendPositionResources; - CheckBox* m_pCB_Grid_X; - CheckBox* m_pCB_Grid_Y; - CheckBox* m_pCB_Grid_Z; + VclPtr<CheckBox> m_pCB_Grid_X; + VclPtr<CheckBox> m_pCB_Grid_Y; + VclPtr<CheckBox> m_pCB_Grid_Z; ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > m_xChartModel; diff --git a/chart2/source/controller/inc/dlg_ChartType.hxx b/chart2/source/controller/inc/dlg_ChartType.hxx index 008ba07b3310..d8fecf56782e 100644 --- a/chart2/source/controller/inc/dlg_ChartType.hxx +++ b/chart2/source/controller/inc/dlg_ChartType.hxx @@ -41,7 +41,7 @@ public: virtual void dispose() SAL_OVERRIDE; private: - ChartTypeTabPage* m_pChartTypeTabPage; + VclPtr<ChartTypeTabPage> m_pChartTypeTabPage; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xChartModel; diff --git a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx index ce4f638dd442..a71d86aaf3ac 100644 --- a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx +++ b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx @@ -119,7 +119,7 @@ private: com::sun::star::uno::Reference< com::sun::star::awt::XWindow > m_xParentWindow; - CreationWizard* m_pDialog; + VclPtr<CreationWizard> m_pDialog; bool m_bUnlockControllersOnExecute; }; diff --git a/chart2/source/controller/inc/dlg_DataEditor.hxx b/chart2/source/controller/inc/dlg_DataEditor.hxx index 4432674fe6be..cff3f4fbbdc0 100644 --- a/chart2/source/controller/inc/dlg_DataEditor.hxx +++ b/chart2/source/controller/inc/dlg_DataEditor.hxx @@ -67,7 +67,7 @@ private: bool m_bReadOnly; boost::scoped_ptr<DataBrowser> m_xBrwData; - ToolBox* m_pTbxData; + VclPtr<ToolBox> m_pTbxData; ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > m_xChartDoc; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx index 5c6a60d72c36..bc3d22da9c8b 100644 --- a/chart2/source/controller/inc/dlg_DataSource.hxx +++ b/chart2/source/controller/inc/dlg_DataSource.hxx @@ -68,11 +68,11 @@ protected: ::std::unique_ptr< DialogModel > m_apDialogModel; private: - DataSourceTabControl* m_pTabControl; - OKButton* m_pBtnOK; + VclPtr<DataSourceTabControl> m_pTabControl; + VclPtr<OKButton> m_pBtnOK; - RangeChooserTabPage * m_pRangeChooserTabePage; - DataSourceTabPage * m_pDataSourceTabPage; + VclPtr<RangeChooserTabPage> m_pRangeChooserTabePage; + VclPtr<DataSourceTabPage> m_pDataSourceTabPage; bool m_bRangeChooserTabIsValid; bool m_bDataSourceTabIsValid; diff --git a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx index 960edffe422d..1ec0829f4eac 100644 --- a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx +++ b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx @@ -43,15 +43,17 @@ struct InsertAxisOrGridDialogData class SchAxisDlg : public ModalDialog { protected: - CheckBox* m_pCbPrimaryX; - CheckBox* m_pCbPrimaryY; - CheckBox* m_pCbPrimaryZ; - CheckBox* m_pCbSecondaryX; - CheckBox* m_pCbSecondaryY; - CheckBox* m_pCbSecondaryZ; + VclPtr<CheckBox> m_pCbPrimaryX; + VclPtr<CheckBox> m_pCbPrimaryY; + VclPtr<CheckBox> m_pCbPrimaryZ; + VclPtr<CheckBox> m_pCbSecondaryX; + VclPtr<CheckBox> m_pCbSecondaryY; + VclPtr<CheckBox> m_pCbSecondaryZ; public: SchAxisDlg(vcl::Window* pParent, const InsertAxisOrGridDialogData& rInput, bool bAxisDlg=true); + virtual ~SchAxisDlg(); + virtual void dispose() SAL_OVERRIDE; void getResult( InsertAxisOrGridDialogData& rOutput ); }; diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx index 64228fe8ea85..0ef93e8d1fea 100644 --- a/chart2/source/controller/inc/dlg_View3D.hxx +++ b/chart2/source/controller/inc/dlg_View3D.hxx @@ -47,11 +47,11 @@ public: virtual short Execute() SAL_OVERRIDE; private: - TabControl* m_pTabControl; + VclPtr<TabControl> m_pTabControl; - ThreeD_SceneGeometry_TabPage* m_pGeometry; - ThreeD_SceneAppearance_TabPage* m_pAppearance; - ThreeD_SceneIllumination_TabPage* m_pIllumination; + VclPtr<ThreeD_SceneGeometry_TabPage> m_pGeometry; + VclPtr<ThreeD_SceneAppearance_TabPage> m_pAppearance; + VclPtr<ThreeD_SceneIllumination_TabPage> m_pIllumination; ControllerLockHelper m_aControllerLocker; diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx index 0ad485c39990..85917809db48 100644 --- a/chart2/source/controller/inc/res_ErrorBar.hxx +++ b/chart2/source/controller/inc/res_ErrorBar.hxx @@ -67,36 +67,36 @@ public: private: // category - RadioButton* m_pRbNone; - RadioButton* m_pRbConst; - RadioButton* m_pRbPercent; - RadioButton* m_pRbFunction; - RadioButton* m_pRbRange; - ListBox* m_pLbFunction; + VclPtr<RadioButton> m_pRbNone; + VclPtr<RadioButton> m_pRbConst; + VclPtr<RadioButton> m_pRbPercent; + VclPtr<RadioButton> m_pRbFunction; + VclPtr<RadioButton> m_pRbRange; + VclPtr<ListBox> m_pLbFunction; // parameters - VclFrame* m_pFlParameters; - VclBox* m_pBxPositive; - MetricField* m_pMfPositive; - Edit* m_pEdRangePositive; - PushButton* m_pIbRangePositive; - VclBox* m_pBxNegative; - MetricField* m_pMfNegative; - Edit* m_pEdRangeNegative; - PushButton* m_pIbRangeNegative; - CheckBox* m_pCbSyncPosNeg; + VclPtr<VclFrame> m_pFlParameters; + VclPtr<VclBox> m_pBxPositive; + VclPtr<MetricField> m_pMfPositive; + VclPtr<Edit> m_pEdRangePositive; + VclPtr<PushButton> m_pIbRangePositive; + VclPtr<VclBox> m_pBxNegative; + VclPtr<MetricField> m_pMfNegative; + VclPtr<Edit> m_pEdRangeNegative; + VclPtr<PushButton> m_pIbRangeNegative; + VclPtr<CheckBox> m_pCbSyncPosNeg; // indicator - RadioButton* m_pRbBoth; - RadioButton* m_pRbPositive; - RadioButton* m_pRbNegative; - FixedImage* m_pFiBoth; - FixedImage* m_pFiPositive; - FixedImage* m_pFiNegative; + VclPtr<RadioButton> m_pRbBoth; + VclPtr<RadioButton> m_pRbPositive; + VclPtr<RadioButton> m_pRbNegative; + VclPtr<FixedImage> m_pFiBoth; + VclPtr<FixedImage> m_pFiPositive; + VclPtr<FixedImage> m_pFiNegative; - FixedText* m_pUIStringPos; - FixedText* m_pUIStringNeg; - FixedText* m_pUIStringRbRange; + VclPtr<FixedText> m_pUIStringPos; + VclPtr<FixedText> m_pUIStringNeg; + VclPtr<FixedText> m_pUIStringRbRange; SvxChartKindError m_eErrorKind; SvxChartIndicate m_eIndicate; @@ -116,9 +116,9 @@ private: double m_fPlusValue; double m_fMinusValue; - Dialog * m_pParentDialog; + VclPtr<Dialog> m_pParentDialog; boost::scoped_ptr< RangeSelectionHelper > m_apRangeSelectionHelper; - Edit * m_pCurrentRangeChoosingField; + VclPtr<Edit> m_pCurrentRangeChoosingField; bool m_bHasInternalDataProvider; bool m_bEnableDataTableDialog; diff --git a/chart2/source/controller/inc/res_LegendPosition.hxx b/chart2/source/controller/inc/res_LegendPosition.hxx index c8292db200af..7801895a6308 100644 --- a/chart2/source/controller/inc/res_LegendPosition.hxx +++ b/chart2/source/controller/inc/res_LegendPosition.hxx @@ -60,12 +60,12 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC; - CheckBox* m_pCbxShow; + VclPtr<CheckBox> m_pCbxShow; - RadioButton* m_pRbtLeft; - RadioButton* m_pRbtRight; - RadioButton* m_pRbtTop; - RadioButton* m_pRbtBottom; + VclPtr<RadioButton> m_pRbtLeft; + VclPtr<RadioButton> m_pRbtRight; + VclPtr<RadioButton> m_pRbtTop; + VclPtr<RadioButton> m_pRbtBottom; Link m_aChangeLink; }; diff --git a/chart2/source/controller/inc/res_Titles.hxx b/chart2/source/controller/inc/res_Titles.hxx index 1e4e8c67cd91..396c87af598f 100644 --- a/chart2/source/controller/inc/res_Titles.hxx +++ b/chart2/source/controller/inc/res_Titles.hxx @@ -40,22 +40,22 @@ public: void ClearModifyFlag(); private: - FixedText* m_pFT_Main; - FixedText* m_pFT_Sub; - Edit* m_pEd_Main; - Edit* m_pEd_Sub; + VclPtr<FixedText> m_pFT_Main; + VclPtr<FixedText> m_pFT_Sub; + VclPtr<Edit> m_pEd_Main; + VclPtr<Edit> m_pEd_Sub; - FixedText* m_pFT_XAxis; - FixedText* m_pFT_YAxis; - FixedText* m_pFT_ZAxis; - Edit* m_pEd_XAxis; - Edit* m_pEd_YAxis; - Edit* m_pEd_ZAxis; + VclPtr<FixedText> m_pFT_XAxis; + VclPtr<FixedText> m_pFT_YAxis; + VclPtr<FixedText> m_pFT_ZAxis; + VclPtr<Edit> m_pEd_XAxis; + VclPtr<Edit> m_pEd_YAxis; + VclPtr<Edit> m_pEd_ZAxis; - FixedText* m_pFT_SecondaryXAxis; - FixedText* m_pFT_SecondaryYAxis; - Edit* m_pEd_SecondaryXAxis; - Edit* m_pEd_SecondaryYAxis; + VclPtr<FixedText> m_pFT_SecondaryXAxis; + VclPtr<FixedText> m_pFT_SecondaryYAxis; + VclPtr<Edit> m_pEd_SecondaryXAxis; + VclPtr<Edit> m_pEd_SecondaryYAxis; }; } //namespace chart diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index 81382eadaab1..827e549c8e6b 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -508,7 +508,7 @@ private: TheModelRef m_aModel; //view - ChartWindow* m_pChartWindow; + VclPtr<ChartWindow> m_pChartWindow; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xViewWindow; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xChartView; diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx index 4a37ec38e583..d5275e1a0808 100644 --- a/chart2/source/controller/main/ChartWindow.cxx +++ b/chart2/source/controller/main/ChartWindow.cxx @@ -64,7 +64,7 @@ ChartWindow::ChartWindow( ChartController* pController, vcl::Window* pParent, Wi { m_pOpenGLWindow->Show(); uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(pController->getModel(), uno::UNO_QUERY_THROW); - sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(m_pOpenGLWindow); + sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(m_pOpenGLWindow.get()); x3DWindowProvider->setWindow(nWindowPtr); x3DWindowProvider->update(); } @@ -83,8 +83,7 @@ void ChartWindow::dispose() x3DWindowProvider->setWindow(0); x3DWindowProvider->update(); } - delete m_pOpenGLWindow; - m_pOpenGLWindow = NULL; + m_pOpenGLWindow.clear(); vcl::Window::dispose(); } diff --git a/chart2/source/controller/main/ChartWindow.hxx b/chart2/source/controller/main/ChartWindow.hxx index 73be579f6d6d..cd0afaa07d0a 100644 --- a/chart2/source/controller/main/ChartWindow.hxx +++ b/chart2/source/controller/main/ChartWindow.hxx @@ -68,7 +68,7 @@ public: private: ChartController* m_pWindowController; bool m_bInPaint; - OpenGLWindow* m_pOpenGLWindow; + VclPtr<OpenGLWindow> m_pOpenGLWindow; void adjustHighContrastMode(); }; diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx index 52b5f1f6d4e4..afea41029282 100644 --- a/chart2/source/controller/main/ShapeController.cxx +++ b/chart2/source/controller/main/ShapeController.cxx @@ -252,7 +252,7 @@ void ShapeController::executeDispatch_FormatLine() SolarMutexGuard aGuard; if ( m_pChartController ) { - vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow ); + vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow.get() ); DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper(); DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); if ( pParent && pDrawModelWrapper && pDrawViewWrapper ) @@ -292,7 +292,7 @@ void ShapeController::executeDispatch_FormatArea() SolarMutexGuard aGuard; if ( m_pChartController ) { - vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow ); + vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow.get() ); DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper(); DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); if ( pParent && pDrawModelWrapper && pDrawViewWrapper ) @@ -335,7 +335,7 @@ void ShapeController::executeDispatch_TextAttributes() SolarMutexGuard aGuard; if ( m_pChartController ) { - vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow ); + vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow.get() ); DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); if ( pParent && pDrawViewWrapper ) { @@ -372,7 +372,7 @@ void ShapeController::executeDispatch_TransformDialog() SolarMutexGuard aGuard; if ( m_pChartController ) { - vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow ); + vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow.get() ); DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); if ( pParent && pDrawViewWrapper ) { @@ -541,7 +541,7 @@ void ShapeController::executeDispatch_FontDialog() SolarMutexGuard aGuard; if ( m_pChartController ) { - vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow ); + vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow.get() ); DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper(); DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); if ( pParent && pDrawModelWrapper && pDrawViewWrapper ) @@ -564,7 +564,7 @@ void ShapeController::executeDispatch_ParagraphDialog() SolarMutexGuard aGuard; if ( m_pChartController ) { - vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow ); + vcl::Window* pParent = dynamic_cast< vcl::Window* >( m_pChartController->m_pChartWindow.get() ); DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); if ( pParent && pDrawViewWrapper ) { diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 6b778138309c..3fe29b0d7c0b 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -1487,7 +1487,7 @@ IMPL_LINK_NOARG(GL3DBarChart, UpdateTimerHdl) void GL3DBarChart::setOpenGLWindow(OpenGLWindow* pWindow) { - if (mpWindow != pWindow) + if (mpWindow.get() != pWindow) { mpWindow = pWindow; Size aSize = mpWindow->GetSizePixel(); diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx index c68a38510d66..eaff13a4ed93 100644 --- a/chart2/source/view/inc/GL3DBarChart.hxx +++ b/chart2/source/view/inc/GL3DBarChart.hxx @@ -124,7 +124,7 @@ private: boost::ptr_vector<opengl3D::Renderable3DObject> maShapes; boost::scoped_ptr<opengl3D::OpenGL3DRenderer> mpRenderer; - OpenGLWindow* mpWindow; + VclPtr<OpenGLWindow> mpWindow; opengl3D::Camera* mpCamera; bool mbValidContext; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index b9a1e37f348e..9ac3ad84d253 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1090,7 +1090,7 @@ public: private: ChartView* mpView; bool mbContextDestroyed; - OpenGLWindow* mpWindow; + VclPtr<OpenGLWindow> mpWindow; }; GL2DRenderer::GL2DRenderer(ChartView* pView): diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx index bf1f86e441d9..ba7da08dbc43 100644 --- a/compilerplugins/clang/vclwidgets.cxx +++ b/compilerplugins/clang/vclwidgets.cxx @@ -8,6 +8,7 @@ */ #include <string> +#include <iostream> #include "plugin.hxx" #include "compat.hxx" @@ -41,6 +42,8 @@ public: bool VisitCXXDestructorDecl(const CXXDestructorDecl *); + bool VisitCXXDeleteExpr(const CXXDeleteExpr *); + private: bool isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodDecl); }; @@ -55,10 +58,11 @@ bool BaseCheckNotWindowSubclass(const CXXRecordDecl *BaseDefinition, void *) { } bool isDerivedFromWindow(const CXXRecordDecl *decl) { - if (!decl->hasDefinition()) - return false; if (decl->getQualifiedNameAsString().compare("vcl::Window") == 0) return true; + if (!decl->hasDefinition()) { + return false; + } if (// not sure what hasAnyDependentBases() does, // but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1 !decl->hasAnyDependentBases() && @@ -68,9 +72,11 @@ bool isDerivedFromWindow(const CXXRecordDecl *decl) { return false; } -bool isPointerToWindowSubclass(const QualType& pType) { - if (!pType->isPointerType()) +bool isPointerToWindowSubclass(const Type* pType0) { + const Type* pType = pType0->getUnqualifiedDesugaredType(); + if (!pType->isPointerType()) { return false; + } QualType pointeeType = pType->getPointeeType(); const RecordType *recordType = pointeeType->getAs<RecordType>(); if (recordType == nullptr) { @@ -80,7 +86,27 @@ bool isPointerToWindowSubclass(const QualType& pType) { if (recordDecl == nullptr) { return false; } - return isDerivedFromWindow(recordDecl); + bool b = isDerivedFromWindow(recordDecl); + return b; +} + +bool containsPointerToWindowSubclass(const Type* pType0) { + const Type* pType = pType0->getUnqualifiedDesugaredType(); + const CXXRecordDecl* pRecordDecl = pType->getAsCXXRecordDecl(); + if (pRecordDecl) { + const ClassTemplateSpecializationDecl* pTemplate = dyn_cast<ClassTemplateSpecializationDecl>(pRecordDecl); + if (pTemplate) { + for(unsigned i=0; i<pTemplate->getTemplateArgs().size(); ++i) { + const TemplateArgument& rArg = pTemplate->getTemplateArgs()[i]; + if (rArg.getKind() == TemplateArgument::ArgKind::Type && + containsPointerToWindowSubclass(rArg.getAsType().getTypePtr())) + { + return true; + } + } + } + } + return isPointerToWindowSubclass(pType); } bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorDecl) @@ -88,7 +114,7 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD if (ignoreLocation(pCXXDestructorDecl)) { return true; } - if (!pCXXDestructorDecl->hasBody()) { + if (!pCXXDestructorDecl->isThisDeclarationADefinition()) { return true; } const CXXRecordDecl * pRecordDecl = pCXXDestructorDecl->getParent(); @@ -120,20 +146,20 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD } const CompoundStmt *pCompoundStatement = dyn_cast<CompoundStmt>(pCXXDestructorDecl->getBody()); // having an empty body and no dispose() method is fine - if (!foundVclPtrField && !foundDispose && pCompoundStatement->size() == 0) { + if (!foundVclPtrField && !foundDispose && pCompoundStatement && pCompoundStatement->size() == 0) { return true; } - if (foundVclPtrField && pCompoundStatement->size() == 0) { + if (foundVclPtrField && pCompoundStatement && pCompoundStatement->size() == 0) { report( DiagnosticsEngine::Warning, "vcl::Window subclass with VclPtr field must call dispose() from it's destructor.", - pCXXDestructorDecl->getBody()->getLocStart()) - << pCXXDestructorDecl->getBody()->getSourceRange(); + pCXXDestructorDecl->getLocStart()) + << pCXXDestructorDecl->getSourceRange(); return true; } // check that the destructor for a vcl::Window subclass does nothing except call into the dispose() method bool ok = false; - if (pCompoundStatement->size() == 1) { + if (pCompoundStatement && pCompoundStatement->size() == 1) { const CXXMemberCallExpr *pCallExpr = dyn_cast<CXXMemberCallExpr>(*pCompoundStatement->body_begin()); if (pCallExpr) { ok = true; @@ -143,9 +169,8 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD report( DiagnosticsEngine::Warning, "vcl::Window subclass should have nothing in it's destructor but a call to dispose().", - pCXXDestructorDecl->getBody()->getLocStart()) - << pCXXDestructorDecl->getBody()->getSourceRange() - << pCXXDestructorDecl->getCanonicalDecl()->getSourceRange(); + pCXXDestructorDecl->getLocStart()) + << pCXXDestructorDecl->getSourceRange(); return true; } return true; @@ -183,13 +208,13 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) { if (fieldDecl->isBitField()) { return true; } - if (isPointerToWindowSubclass(fieldDecl->getType())) { -/* report( - DiagnosticsEngine::Remark, + if (containsPointerToWindowSubclass(fieldDecl->getType().getTypePtr())) { + report( + DiagnosticsEngine::Warning, "vcl::Window subclass declared as a pointer field, should be wrapped in VclPtr.", fieldDecl->getLocation()) << fieldDecl->getSourceRange(); - return true;*/ + return true; } const RecordType *recordType = fieldDecl->getType()->getAs<RecordType>(); @@ -245,7 +270,15 @@ bool VCLWidgets::VisitParmVarDecl(ParmVarDecl const * pvDecl) && pMethodDecl->getParent()->getQualifiedNameAsString().find("VclPtr") != std::string::npos) { return true; } - if (pvDecl->getType().getAsString().find("VclPtr") != std::string::npos) { + // we exclude this method in VclBuilder because it's so useful to have it like this + if (pMethodDecl + && pMethodDecl->getNameAsString() == "get" + && (pMethodDecl->getParent()->getQualifiedNameAsString() == "VclBuilder" + || pMethodDecl->getParent()->getQualifiedNameAsString() == "VclBuilderContainer")) + { + return true; + } + if (!pvDecl->getType()->isReferenceType() && pvDecl->getType().getAsString().find("VclPtr") != std::string::npos) { report( DiagnosticsEngine::Warning, "vcl::Window subclass passed as a VclPtr parameter, should be passed as a raw pointer.", @@ -255,6 +288,43 @@ bool VCLWidgets::VisitParmVarDecl(ParmVarDecl const * pvDecl) return true; } +static void findDisposeAndClearStatements2(std::vector<std::string>& aVclPtrFields, const Stmt *pStmt); + +static void findDisposeAndClearStatements(std::vector<std::string>& aVclPtrFields, const CompoundStmt *pCompoundStatement) +{ + for(const Stmt* pStmt : pCompoundStatement->body()) { + findDisposeAndClearStatements2(aVclPtrFields, pStmt); + } +} + +static void findDisposeAndClearStatements2(std::vector<std::string>& aVclPtrFields, const Stmt *pStmt) +{ + if (isa<CompoundStmt>(pStmt)) { + findDisposeAndClearStatements(aVclPtrFields, dyn_cast<CompoundStmt>(pStmt)); + return; + } + if (!isa<CallExpr>(pStmt)) return; + const CallExpr *pCallExpr = dyn_cast<CallExpr>(pStmt); + + if (!pCallExpr->getDirectCallee()) return; + if (!isa<CXXMethodDecl>(pCallExpr->getDirectCallee())) return; + const CXXMethodDecl *pCalleeMethodDecl = dyn_cast<CXXMethodDecl>(pCallExpr->getDirectCallee()); + if (pCalleeMethodDecl->getNameAsString() != "disposeAndClear") return; + + if (!pCallExpr->getCallee()) return; + + if (!isa<MemberExpr>(pCallExpr->getCallee())) return; + const MemberExpr *pCalleeMemberExpr = dyn_cast<MemberExpr>(pCallExpr->getCallee()); + + if (!pCalleeMemberExpr->getBase()) return; + if (!isa<MemberExpr>(pCalleeMemberExpr->getBase())) return; + const MemberExpr *pCalleeMemberExprBase = dyn_cast<MemberExpr>(pCalleeMemberExpr->getBase()); + + std::string xxx = pCalleeMemberExprBase->getMemberDecl()->getNameAsString(); + aVclPtrFields.erase(std::remove(aVclPtrFields.begin(), aVclPtrFields.end(), xxx), aVclPtrFields.end()); +} + + bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl ) { if (ignoreLocation(functionDecl)) { @@ -263,16 +333,16 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl ) // ignore the stuff in the VclPtr template class const CXXMethodDecl *pMethodDecl = dyn_cast<CXXMethodDecl>(functionDecl); if (pMethodDecl - && pMethodDecl->getParent()->getQualifiedNameAsString().find("VclPtr") != std::string::npos) { + && pMethodDecl->getParent()->getQualifiedNameAsString() == "VclPtr") { return true; } // ignore the vcl::Window::dispose() method if (pMethodDecl - && pMethodDecl->getParent()->getQualifiedNameAsString().compare("vcl::Window") == 0) { + && pMethodDecl->getParent()->getQualifiedNameAsString() == "vcl::Window") { return true; } QualType t1 { compat::getReturnType(*functionDecl) }; - if (t1.getAsString().find("VclPtr") != std::string::npos) { + if (t1.getAsString().find("VclPtr") == 0) { report( DiagnosticsEngine::Warning, "VclPtr declared as a return type from a method/function, should be passed as a raw pointer.", @@ -286,55 +356,89 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl ) report( DiagnosticsEngine::Warning, "vcl::Window subclass dispose() method MUST call it's superclass dispose() as the last thing it does", - functionDecl->getBody()->getLocStart()) - << functionDecl->getBody()->getSourceRange(); + functionDecl->getLocStart()) + << functionDecl->getSourceRange(); } } } // check dispose method to make sure we are actually disposing all of the VclPtr fields - if (pMethodDecl && pMethodDecl->isInstance() && pMethodDecl->getBody() && pMethodDecl->param_size()==0 - && pMethodDecl->getNameAsString() == "dispose") + if (pMethodDecl && pMethodDecl->isInstance() && pMethodDecl->getBody() + && pMethodDecl->param_size()==0 + && pMethodDecl->getNameAsString() == "dispose" + && isDerivedFromWindow(pMethodDecl->getParent()) ) { + // exclude a couple of methods with hard-to-parse code + if (pMethodDecl->getQualifiedNameAsString() == "SvxRubyDialog::dispose") + return true; + if (pMethodDecl->getQualifiedNameAsString() == "SvxPersonalizationTabPage::dispose") + return true; + if (pMethodDecl->getQualifiedNameAsString() == "SelectPersonaDialog::dispose") + return true; + if (pMethodDecl->getQualifiedNameAsString() == "MappingDialog_Impl::dispose") + return true; + if (pMethodDecl->getQualifiedNameAsString() == "BibGeneralPage::dispose") + return true; + if (pMethodDecl->getQualifiedNameAsString() == "SwCreateAuthEntryDlg_Impl::dispose") + return true; + if (pMethodDecl->getQualifiedNameAsString() == "SwTableColumnPage::dispose") + return true; + if (pMethodDecl->getQualifiedNameAsString() == "SwAssignFieldsControl::dispose") + return true; + if (pMethodDecl->getQualifiedNameAsString() == "ScOptSolverDlg::dispose") + return true; + if (pMethodDecl->getQualifiedNameAsString() == "ScPivotFilterDlg::dispose") + return true; + if (pMethodDecl->getQualifiedNameAsString() == "SmToolBoxWindow::dispose") + return true; + if (pMethodDecl->getQualifiedNameAsString() == "dbaui::DlgOrderCrit::dispose") + return true; + std::vector<std::string> aVclPtrFields; for(auto fieldDecl : pMethodDecl->getParent()->fields()) { - const RecordType *pFieldRecordType = fieldDecl->getType()->getAs<RecordType>(); - if (pFieldRecordType) { - const CXXRecordDecl *pFieldRecordTypeDecl = dyn_cast<CXXRecordDecl>(pFieldRecordType->getDecl()); - if (pFieldRecordTypeDecl->getQualifiedNameAsString().compare(0, strlen(sVclPtr), sVclPtr) == 0) { - aVclPtrFields.push_back(fieldDecl->getNameAsString()); - } - } + if (fieldDecl->getType().getAsString().compare(0, strlen(sVclPtr), sVclPtr) == 0) { + aVclPtrFields.push_back(fieldDecl->getNameAsString()); + } } if (!aVclPtrFields.empty()) { - const CompoundStmt *pCompoundStatement = dyn_cast<CompoundStmt>(pMethodDecl->getBody()); - for(const Stmt* pStmt : pCompoundStatement->body()) { - const CallExpr *pCallExpr = dyn_cast<CallExpr>(pStmt); - if (!pCallExpr) continue; - if (!pCallExpr->getDirectCallee()) continue; - const CXXMethodDecl *pCalleeMethodDecl = dyn_cast<CXXMethodDecl>(pCallExpr->getDirectCallee()); - if (!pCalleeMethodDecl) continue; - if (pCalleeMethodDecl->getNameAsString() != "disposeAndClear") continue; - const MemberExpr *pCalleeMemberExpr = dyn_cast<MemberExpr>(pCallExpr->getCallee()); - if (!pCalleeMemberExpr) continue; - const MemberExpr *pCalleeMemberExprBase = dyn_cast<MemberExpr>(pCalleeMemberExpr->getBase()); - std::string xxx = pCalleeMemberExprBase->getMemberDecl()->getNameAsString(); - aVclPtrFields.erase(std::remove(aVclPtrFields.begin(), aVclPtrFields.end(), xxx), aVclPtrFields.end()); - } + if (pMethodDecl->getBody() && isa<CompoundStmt>(pMethodDecl->getBody())) + findDisposeAndClearStatements( aVclPtrFields, dyn_cast<CompoundStmt>(pMethodDecl->getBody()) ); if (!aVclPtrFields.empty()) { + //pMethodDecl->dump(); std::string aMessage = "vcl::Window subclass dispose() method does not call disposeAndClear() on the following field(s) "; for(auto s : aVclPtrFields) - aMessage += ", " + s; + aMessage += "\n " + s + ".clear();"; report( DiagnosticsEngine::Warning, aMessage, - functionDecl->getBody()->getLocStart()) - << functionDecl->getBody()->getSourceRange(); + functionDecl->getLocStart()) + << functionDecl->getSourceRange(); } } } return true; } +bool VCLWidgets::VisitCXXDeleteExpr(const CXXDeleteExpr *pCXXDeleteExpr) +{ + if (ignoreLocation(pCXXDeleteExpr)) { + return true; + } + const ImplicitCastExpr* pImplicitCastExpr = dyn_cast<ImplicitCastExpr>(pCXXDeleteExpr->getArgument()); + if (!pImplicitCastExpr) { + return true; + } + if (pImplicitCastExpr->getCastKind() != CK_UserDefinedConversion) { + return true; + } + report( + DiagnosticsEngine::Warning, + "calling delete on instance of VclPtr, must rather call disposeAndClear()", + pCXXDeleteExpr->getLocStart()) + << pCXXDeleteExpr->getSourceRange(); + return true; +} + + /** The AST looks like: `-CXXMemberCallExpr 0xb06d8b0 'void' @@ -347,6 +451,7 @@ bool VCLWidgets::isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodD { const CompoundStmt *pCompoundStatement = dyn_cast<CompoundStmt>(pMethodDecl->getBody()); if (!pCompoundStatement) return false; + if (pCompoundStatement->size() == 0) return false; // find the last statement const CXXMemberCallExpr *pCallExpr = dyn_cast<CXXMemberCallExpr>(*pCompoundStatement->body_rbegin()); if (!pCallExpr) return false; diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index a65e56568cdb..82e314ed58bf 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -672,6 +672,17 @@ void SfxAccCfgTabListBox_Impl::InitEntry(SvTreeListEntry* pEntry, SvTabListBox::InitEntry(pEntry, rText, rImage1, rImage2, eButtonKind); } +SfxAccCfgTabListBox_Impl::~SfxAccCfgTabListBox_Impl() +{ + dispose(); +} + +void SfxAccCfgTabListBox_Impl::dispose() +{ + m_pAccelConfigPage.clear(); + SvTabListBox::dispose(); +} + /** select the entry, which match the current key input ... excepting keys, which are used for the dialog itself. */ @@ -830,6 +841,18 @@ void SfxAcceleratorConfigPage::dispose() delete m_pFileDlg; m_pFileDlg = NULL; + m_pEntriesBox.clear(); + m_pOfficeButton.clear(); + m_pModuleButton.clear(); + m_pChangeButton.clear(); + m_pRemoveButton.clear(); + m_pGroupLBox.clear(); + m_pFunctionBox.clear(); + m_pKeyBox.clear(); + m_pLoadButton.clear(); + m_pSaveButton.clear(); + m_pResetButton.clear(); + SfxTabPage::dispose(); } diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 8fc2b26db078..3d0462fb7300 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -1395,6 +1395,17 @@ SvxMenuEntriesListBox::SvxMenuEntriesListBox(vcl::Window* pParent, SvxConfigPage SV_DRAGDROP_APP_DROP); } +SvxMenuEntriesListBox::~SvxMenuEntriesListBox() +{ + dispose(); +} + +void SvxMenuEntriesListBox::dispose() +{ + pPage.clear(); + SvTreeListBox::dispose(); +} + // drag and drop support DragDropMode SvxMenuEntriesListBox::NotifyStartDrag( TransferDataContainer& aTransferDataContainer, SvTreeListEntry* pEntry ) @@ -1542,6 +1553,32 @@ SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet) m_pDescriptionField->EnableCursor( false ); } +SvxConfigPage::~SvxConfigPage() +{ + dispose(); +} + +void SvxConfigPage::dispose() +{ + m_pTopLevel.clear(); + m_pTopLevelLabel.clear(); + m_pTopLevelListBox.clear(); + m_pNewTopLevelButton.clear(); + m_pModifyTopLevelButton.clear(); + m_pContents.clear(); + m_pContentsLabel.clear(); + m_pEntries.clear(); + m_pContentsListBox.clear(); + m_pAddCommandsButton.clear(); + m_pModifyCommandButton.clear(); + m_pMoveUpButton.clear(); + m_pMoveDownButton.clear(); + m_pSaveInListBox.clear(); + m_pDescriptionField.clear(); + m_pSelectorDlg.clear(); + SfxTabPage::dispose(); +} + void SvxConfigPage::Reset( const SfxItemSet* ) { // If we haven't initialised our XMultiServiceFactory reference @@ -2206,6 +2243,11 @@ SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSe LINK( this, SvxMenuConfigPage, EntrySelectHdl ) ); } +SvxMenuConfigPage::~SvxMenuConfigPage() +{ + dispose(); +} + // Populates the Menu combo box void SvxMenuConfigPage::Init() { @@ -2219,11 +2261,6 @@ void SvxMenuConfigPage::Init() m_pTopLevelListBox->GetSelectHdl().Call(this); } -SvxMenuConfigPage::~SvxMenuConfigPage() -{ - dispose(); -} - void SvxMenuConfigPage::dispose() { for ( sal_uInt16 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i ) @@ -2235,11 +2272,8 @@ void SvxMenuConfigPage::dispose() } m_pSaveInListBox->Clear(); - delete m_pSelectorDlg; - m_pSelectorDlg = NULL; - delete m_pContentsListBox; - m_pContentsListBox = NULL; - + m_pSelectorDlg.clear(); + m_pContentsListBox.clear(); SvxConfigPage::dispose(); } @@ -2547,7 +2581,7 @@ IMPL_LINK( SvxMenuConfigPage, AddCommandsHdl, Button *, pButton ) { (void)pButton; - if ( m_pSelectorDlg == NULL ) + if ( m_pSelectorDlg == nullptr ) { // Create Script Selector which also shows builtin commands m_pSelectorDlg = new SvxScriptSelectorDialog( this, true, m_xFrame ); @@ -2660,6 +2694,21 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog( LINK( this, SvxMainMenuOrganizerDialog, MoveHdl) ); } +SvxMainMenuOrganizerDialog::~SvxMainMenuOrganizerDialog() +{ + dispose(); +} + +void SvxMainMenuOrganizerDialog::dispose() +{ + m_pMenuBox.clear(); + m_pMenuNameEdit.clear(); + m_pMenuListBox.clear(); + m_pMoveUpButton.clear(); + m_pMoveDownButton.clear(); + ModalDialog::dispose(); +} + IMPL_LINK(SvxMainMenuOrganizerDialog, ModifyHdl, Edit*, pEdit) { (void)pEdit; @@ -2931,12 +2980,8 @@ void SvxToolbarConfigPage::dispose() } m_pSaveInListBox->Clear(); - delete m_pSelectorDlg; - m_pSelectorDlg = NULL; - - delete m_pContentsListBox; - m_pContentsListBox = NULL; - + m_pSelectorDlg.clear(); + m_pContentsListBox.clear(); SvxConfigPage::dispose(); } @@ -4457,7 +4502,7 @@ IMPL_LINK( SvxToolbarConfigPage, AddCommandsHdl, Button *, pButton ) { (void)pButton; - if ( m_pSelectorDlg == NULL ) + if ( m_pSelectorDlg == nullptr ) { // Create Script Selector which shows slot commands m_pSelectorDlg = new SvxScriptSelectorDialog( this, true, m_xFrame ); @@ -4537,6 +4582,7 @@ void SvxToolbarEntriesListBox::dispose() delete m_pButtonData; m_pButtonData = NULL; + pPage.clear(); SvxMenuEntriesListBox::dispose(); } @@ -4688,7 +4734,7 @@ TriState SvxToolbarEntriesListBox::NotifyCopying( if ( !m_bIsInternalDrag ) { // if the target is NULL then add function to the start of the list - static_cast<SvxToolbarConfigPage*>(pPage)->AddFunction( pTarget, pTarget == NULL ); + static_cast<SvxToolbarConfigPage*>(pPage.get())->AddFunction( pTarget, pTarget == NULL ); // Instant Apply changes to UI SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection(); @@ -4720,6 +4766,20 @@ SvxNewToolbarDialog::SvxNewToolbarDialog(vcl::Window* pWindow, const OUString& r m_pEdtName->SetModifyHdl(LINK(this, SvxNewToolbarDialog, ModifyHdl)); } +SvxNewToolbarDialog::~SvxNewToolbarDialog() +{ + dispose(); +} + +void SvxNewToolbarDialog::dispose() +{ + m_pEdtName.clear(); + m_pBtnOK.clear(); + m_pSaveInListBox.clear(); + ModalDialog::dispose(); +} + + IMPL_LINK(SvxNewToolbarDialog, ModifyHdl, Edit*, pEdit) { (void)pEdit; @@ -4940,9 +5000,12 @@ void SvxIconSelectorDialog::dispose() if ( xi != NULL ) xi->release(); } - pTbSymbol = NULL; } + pTbSymbol.clear(); + pFtNote.clear(); + pBtnImport.clear(); + pBtnDelete.clear(); ModalDialog::dispose(); } @@ -5388,4 +5451,16 @@ SvxIconChangeDialog::SvxIconChangeDialog( pLineEditDescription->SetText(aMessage); } +SvxIconChangeDialog::~SvxIconChangeDialog() +{ + dispose(); +} + +void SvxIconChangeDialog::dispose() +{ + pFImageInfo.clear(); + pLineEditDescription.clear(); + ModalDialog::dispose(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index 373f3b924421..0f399fda43f5 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -435,6 +435,7 @@ SfxConfigGroupListBox::~SfxConfigGroupListBox() void SfxConfigGroupListBox::dispose() { ClearAll(); + pFunctionListBox.clear(); SvTreeListBox::dispose(); } diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx index 79453fc1848d..3ab1816f37d5 100644 --- a/cui/source/customize/eventdlg.cxx +++ b/cui/source/customize/eventdlg.cxx @@ -118,6 +118,7 @@ void SvxEventConfigPage::dispose() pE->SetUserData((void*)0); pE = SvTreeListBox::NextSibling( pE ); } + m_pSaveInListBox.clear(); _SvxMacroTabPage::dispose(); } diff --git a/cui/source/customize/eventdlg.hxx b/cui/source/customize/eventdlg.hxx index 56ea3c41ddab..385df86d1bbb 100644 --- a/cui/source/customize/eventdlg.hxx +++ b/cui/source/customize/eventdlg.hxx @@ -29,7 +29,7 @@ class SvxEventConfigPage : public _SvxMacroTabPage { - ListBox* m_pSaveInListBox; + VclPtr<ListBox> m_pSaveInListBox; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocumentEvents; diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index 13ae5f461a00..656a2414ddd1 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -888,6 +888,18 @@ AssignComponentDialog::AssignComponentDialog( vcl::Window * pParent, const OUStr mpMethodEdit->SetText( aMethodName, Selection( 0, SELECTION_MAX ) ); } +AssignComponentDialog::~AssignComponentDialog() +{ + dispose(); +} + +void AssignComponentDialog::dispose() +{ + mpMethodEdit.clear(); + mpOKButton.clear(); + ModalDialog::dispose(); +} + IMPL_LINK( SvxMacroAssignSingleTabDialog, OKHdl_Impl, Button *, pButton ) { (void)pButton; //unused diff --git a/cui/source/customize/macropg_impl.hxx b/cui/source/customize/macropg_impl.hxx index 6ec8709a971e..d99a9712e1ff 100644 --- a/cui/source/customize/macropg_impl.hxx +++ b/cui/source/customize/macropg_impl.hxx @@ -25,14 +25,14 @@ class _SvxMacroTabPage_Impl public: _SvxMacroTabPage_Impl( const SfxItemSet& rAttrSet ); - PushButton* pAssignPB; - PushButton* pAssignComponentPB; - PushButton* pDeletePB; + VclPtr<PushButton> pAssignPB; + VclPtr<PushButton> pAssignComponentPB; + VclPtr<PushButton> pDeletePB; Image aMacroImg; Image aComponentImg; OUString sStrEvent; OUString sAssignedMacro; - MacroEventListBox* pEventLB; + VclPtr<MacroEventListBox> pEventLB; bool bReadOnly; bool bIDEDialogMode; }; @@ -40,8 +40,8 @@ public: class AssignComponentDialog : public ModalDialog { private: - Edit* mpMethodEdit; - OKButton* mpOKButton; + VclPtr<Edit> mpMethodEdit; + VclPtr<OKButton> mpOKButton; OUString maURL; @@ -49,6 +49,8 @@ private: public: AssignComponentDialog( vcl::Window * pParent, const OUString& rURL ); + virtual ~AssignComponentDialog(); + virtual void dispose() SAL_OVERRIDE; OUString getURL( void ) const { return maURL; } diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx index 5d0ffe6a9209..3aefef32d24b 100644 --- a/cui/source/customize/selector.cxx +++ b/cui/source/customize/selector.cxx @@ -239,6 +239,7 @@ SvxConfigGroupListBox::~SvxConfigGroupListBox() void SvxConfigGroupListBox::dispose() { ClearAll(); + pFunctionListBox.clear(); SvTreeListBox::dispose(); } @@ -918,6 +919,22 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog( UpdateUI(); } +SvxScriptSelectorDialog::~SvxScriptSelectorDialog() +{ + dispose(); +} + +void SvxScriptSelectorDialog::dispose() +{ + m_pDialogDescription.clear(); + m_pCategories.clear(); + m_pCommands.clear(); + m_pOKButton.clear(); + m_pCancelButton.clear(); + m_pDescriptionText.clear(); + ModelessDialog::dispose(); +} + IMPL_LINK( SvxScriptSelectorDialog, SelectHdl, Control*, pCtrl ) { if (pCtrl == m_pCategories) diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 5c81f1c02206..ac8aca049c02 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -261,6 +261,26 @@ void SpellDialog::dispose() delete pImpl; pImpl = NULL; } + m_pLanguageFT.clear(); + m_pLanguageLB.clear(); + m_pExplainFT.clear(); + m_pExplainLink.clear(); + m_pNotInDictFT.clear(); + m_pSentenceED.clear(); + m_pSuggestionFT.clear(); + m_pSuggestionLB.clear(); + m_pIgnorePB.clear(); + m_pIgnoreAllPB.clear(); + m_pIgnoreRulePB.clear(); + m_pAddToDictPB.clear(); + m_pAddToDictMB.clear(); + m_pChangePB.clear(); + m_pChangeAllPB.clear(); + m_pAutoCorrPB.clear(); + m_pCheckGrammarCB.clear(); + m_pOptionsPB.clear(); + m_pUndoPB.clear(); + m_pClosePB.clear(); SfxModelessDialog::dispose(); } diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index 867c8ce281e6..f146e698e49f 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -98,6 +98,23 @@ AboutDialog::AboutDialog(vcl::Window* pParent) get<PushButton>("close")->GrabFocus(); } +AboutDialog::~AboutDialog() +{ + dispose(); +} + +void AboutDialog::dispose() +{ + m_pVersion.clear(); + m_pDescriptionText.clear(); + m_pCopyrightText.clear(); + m_pLogoImage.clear(); + m_pLogoReplacement.clear(); + m_pCreditsButton.clear(); + m_pWebsiteButton.clear(); + SfxModalDialog::dispose(); +} + IMPL_LINK( AboutDialog, HandleClick, PushButton*, pButton ) { OUString sURL = ""; diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index 7edff10bf399..ad1f3e0d8f81 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -973,6 +973,8 @@ class ColorPickerDialog : public ModalDialog { public: ColorPickerDialog( vcl::Window* pParent, sal_Int32 nColor, sal_Int16 nMode ); + virtual ~ColorPickerDialog() { dispose(); } + virtual void dispose() SAL_OVERRIDE; void update_color( sal_uInt16 n = UPDATE_ALL ); @@ -992,35 +994,35 @@ private: double mdCyan, mdMagenta, mdYellow, mdKey; private: - ColorFieldControl* mpColorField; - ColorSliderControl* mpColorSlider; - ColorPreviewControl* mpColorPreview; - ColorPreviewControl* mpColorPrevious; + VclPtr<ColorFieldControl> mpColorField; + VclPtr<ColorSliderControl> mpColorSlider; + VclPtr<ColorPreviewControl> mpColorPreview; + VclPtr<ColorPreviewControl> mpColorPrevious; - FixedImage* mpFISliderLeft; - FixedImage* mpFISliderRight; + VclPtr<FixedImage> mpFISliderLeft; + VclPtr<FixedImage> mpFISliderRight; Image maSliderImage; - RadioButton* mpRBRed; - RadioButton* mpRBGreen; - RadioButton* mpRBBlue; - RadioButton* mpRBHue; - RadioButton* mpRBSaturation; - RadioButton* mpRBBrightness; - - MetricField* mpMFRed; - MetricField* mpMFGreen; - MetricField* mpMFBlue; - HexColorControl* mpEDHex; - - MetricField* mpMFHue; - MetricField* mpMFSaturation; - MetricField* mpMFBrightness; - - MetricField* mpMFCyan; - MetricField* mpMFMagenta; - MetricField* mpMFYellow; - MetricField* mpMFKey; + VclPtr<RadioButton> mpRBRed; + VclPtr<RadioButton> mpRBGreen; + VclPtr<RadioButton> mpRBBlue; + VclPtr<RadioButton> mpRBHue; + VclPtr<RadioButton> mpRBSaturation; + VclPtr<RadioButton> mpRBBrightness; + + VclPtr<MetricField> mpMFRed; + VclPtr<MetricField> mpMFGreen; + VclPtr<MetricField> mpMFBlue; + VclPtr<HexColorControl> mpEDHex; + + VclPtr<MetricField> mpMFHue; + VclPtr<MetricField> mpMFSaturation; + VclPtr<MetricField> mpMFBrightness; + + VclPtr<MetricField> mpMFCyan; + VclPtr<MetricField> mpMFMagenta; + VclPtr<MetricField> mpMFYellow; + VclPtr<MetricField> mpMFKey; }; ColorPickerDialog::ColorPickerDialog( vcl::Window* pParent, sal_Int32 nColor, sal_Int16 nMode ) @@ -1126,6 +1128,34 @@ ColorPickerDialog::ColorPickerDialog( vcl::Window* pParent, sal_Int32 nColor, sa update_color(); } +void ColorPickerDialog::dispose() +{ + mpColorField.clear(); + mpColorSlider.clear(); + mpColorPreview.clear(); + mpColorPrevious.clear(); + mpFISliderLeft.clear(); + mpFISliderRight.clear(); + mpRBRed.clear(); + mpRBGreen.clear(); + mpRBBlue.clear(); + mpRBHue.clear(); + mpRBSaturation.clear(); + mpRBBrightness.clear(); + mpMFRed.clear(); + mpMFGreen.clear(); + mpMFBlue.clear(); + mpEDHex.clear(); + mpMFHue.clear(); + mpMFSaturation.clear(); + mpMFBrightness.clear(); + mpMFCyan.clear(); + mpMFMagenta.clear(); + mpMFYellow.clear(); + mpMFKey.clear(); + ModalDialog::dispose(); +} + static int toInt( double dValue, double dRange ) { return static_cast< int >( std::floor((dValue * dRange) + 0.5 ) ); diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx index e992ab28d064..44f03fed1481 100644 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -100,6 +100,25 @@ SvxCharacterMap::SvxCharacterMap( vcl::Window* pParent, bool bOne_, const SfxIte CreateOutputItemSet( pSet ? *pSet->GetPool() : SfxGetpApp()->GetPool() ); } +SvxCharacterMap::~SvxCharacterMap() +{ + dispose(); +} + +void SvxCharacterMap::dispose() +{ + m_pShowSet.clear(); + m_pShowText.clear(); + m_pOKBtn.clear(); + m_pFontText.clear(); + m_pFontLB.clear(); + m_pSubsetText.clear(); + m_pSubsetLB.clear(); + m_pSymbolText.clear(); + m_pShowChar.clear(); + m_pCharCodeText.clear(); + SfxModalDialog::dispose(); +} void SvxCharacterMap::SetChar( sal_UCS4 c ) diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx index c8bbf0abab69..7e3a767a3bdd 100644 --- a/cui/source/dialogs/cuifmsearch.cxx +++ b/cui/source/dialogs/cuifmsearch.cxx @@ -176,6 +176,34 @@ void FmSearchDialog::dispose() delete m_pSearchEngine; m_pSea |