diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 11:41:31 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 15:08:48 +0100 |
commit | e8b97a52c96df9c8e8055407b1e40ed7cb9cfc67 (patch) | |
tree | b322529f4a54a6427862cb20cb4cf87fb6a5d065 /framework | |
parent | 2b0be6c0e9d23f1b8535ba7033732ae2e3bfb5c9 (diff) | |
parent | 0cde74f788a054fa2b65107a030dd463b8d11c7a (diff) |
Merge remote-tracking branch 'origin/feature/vclptr'
Resolve several thousand lines of conflicts.
Conflicts:
accessibility/source/extended/accessiblelistbox.cxx
accessibility/source/standard/vclxaccessiblecombobox.cxx
accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
accessibility/source/standard/vclxaccessiblelistbox.cxx
accessibility/source/standard/vclxaccessibletextfield.cxx
basctl/source/basicide/basidesh.cxx
cui/source/inc/chardlg.hxx
cui/source/tabpages/tpbitmap.cxx
dbaccess/source/ui/dlg/UserAdmin.cxx
dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
extensions/source/propctrlr/propertyeditor.hxx
extensions/source/scanner/sanedlg.cxx
filter/source/pdf/impdialog.cxx
include/sfx2/mgetempl.hxx
include/sfx2/sidebar/SidebarToolBox.hxx
include/sfx2/viewsh.hxx
include/svtools/brwbox.hxx
include/svtools/filectrl.hxx
include/svtools/scrwin.hxx
include/svx/dlgctrl.hxx
include/svx/sidebar/Popup.hxx
include/svx/sidebar/PopupContainer.hxx
include/svx/sidebar/PopupControl.hxx
include/svx/sidebar/SidebarDialControl.hxx
include/svx/sidebar/ValueSetWithTextControl.hxx
sc/source/ui/condformat/condformatdlgentry.cxx
sc/source/ui/navipi/navipi.cxx
sc/source/ui/sidebar/CellBorderStyleControl.hxx
sd/source/ui/animations/CustomAnimationDialog.cxx
sd/source/ui/inc/DrawViewShell.hxx
sd/source/ui/inc/Ruler.hxx
sd/source/ui/inc/SlideSorter.hxx
sd/source/ui/inc/ViewTabBar.hxx
sd/source/ui/inc/Window.hxx
sd/source/ui/inc/morphdlg.hxx
sd/source/ui/inc/sdpreslt.hxx
sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
sd/source/ui/sidebar/LayoutMenu.hxx
sd/source/ui/sidebar/MasterPagesSelector.hxx
sd/source/ui/sidebar/NavigatorWrapper.hxx
sd/source/ui/sidebar/PanelBase.hxx
sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
sd/source/ui/slideshow/showwindow.hxx
sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
sd/source/ui/view/ViewShellBase.cxx
sd/source/ui/view/drviewsa.cxx
sfx2/source/appl/fileobj.hxx
sfx2/source/appl/opengrf.cxx
sfx2/source/control/thumbnailviewacc.hxx
sfx2/source/dialog/securitypage.cxx
sfx2/source/dialog/templdlg.cxx
sfx2/source/doc/docinsert.cxx
sfx2/source/doc/guisaveas.cxx
sfx2/source/inc/alienwarn.hxx
sfx2/source/sidebar/Deck.cxx
sfx2/source/sidebar/Deck.hxx
sfx2/source/sidebar/DeckTitleBar.cxx
sfx2/source/sidebar/DeckTitleBar.hxx
sfx2/source/sidebar/MenuButton.cxx
sfx2/source/sidebar/MenuButton.hxx
sfx2/source/sidebar/Panel.cxx
sfx2/source/sidebar/Panel.hxx
sfx2/source/sidebar/PanelTitleBar.hxx
sfx2/source/sidebar/SidebarDockingWindow.hxx
sfx2/source/sidebar/SidebarToolBox.cxx
sfx2/source/sidebar/TabBar.hxx
sfx2/source/sidebar/TabItem.cxx
sfx2/source/sidebar/TabItem.hxx
sfx2/source/sidebar/TitleBar.hxx
sfx2/source/toolbox/imgmgr.cxx
starmath/inc/edit.hxx
starmath/inc/smmod.hxx
starmath/qa/cppunit/test_starmath.cxx
starmath/source/edit.cxx
starmath/source/smmod.cxx
svtools/source/brwbox/brwbox1.cxx
svtools/source/brwbox/datwin.hxx
svtools/source/contnr/fileview.cxx
svtools/source/contnr/simptabl.cxx
svtools/source/control/filectrl.cxx
svtools/source/control/valueimp.hxx
svx/inc/GalleryControl.hxx
svx/source/dialog/dlgctrl.cxx
svx/source/dialog/swframeexample.cxx
svx/source/fmcomp/fmgridif.cxx
svx/source/gallery2/GalleryControl.cxx
svx/source/sidebar/EmptyPanel.hxx
svx/source/sidebar/area/AreaPropertyPanel.hxx
svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
svx/source/sidebar/insert/InsertPropertyPanel.cxx
svx/source/sidebar/insert/InsertPropertyPanel.hxx
svx/source/sidebar/line/LinePropertyPanel.hxx
svx/source/sidebar/line/LineWidthControl.cxx
svx/source/sidebar/line/LineWidthControl.hxx
svx/source/sidebar/line/LineWidthValueSet.hxx
svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
svx/source/sidebar/possize/SidebarDialControl.cxx
svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
svx/source/sidebar/text/TextPropertyPanel.hxx
svx/source/sidebar/tools/PopupContainer.cxx
svx/source/sidebar/tools/PopupControl.cxx
svx/source/sidebar/tools/ValueSetWithTextControl.cxx
svx/source/svdraw/svdfmtf.hxx
svx/source/svdraw/svdibrow.cxx
svx/source/tbxctrls/colrctrl.cxx
svx/source/tbxctrls/tbcontrl.cxx
sw/source/ui/dbui/mmaddressblockpage.cxx
sw/source/ui/dialog/uiregionsw.cxx
sw/source/ui/index/cnttab.cxx
sw/source/uibase/inc/drpcps.hxx
sw/source/uibase/sidebar/PageColumnControl.hxx
sw/source/uibase/sidebar/PageMarginControl.hxx
sw/source/uibase/sidebar/PageOrientationControl.hxx
sw/source/uibase/sidebar/PagePropertyPanel.hxx
sw/source/uibase/sidebar/PageSizeControl.hxx
sw/source/uibase/uiview/view2.cxx
sw/source/uibase/utlui/navipi.cxx
vcl/inc/svdata.hxx
vcl/source/control/combobox.cxx
vcl/source/control/lstbox.cxx
vcl/source/window/dockwin.cxx
vcl/source/window/winproc.cxx
Change-Id: I056cf3026ff17d65cca0b6e6588bda4a88fa8d95
Diffstat (limited to 'framework')
36 files changed, 165 insertions, 130 deletions
diff --git a/framework/inc/classes/fwktabwindow.hxx b/framework/inc/classes/fwktabwindow.hxx index ebbac7fc80bb..ed3d82c80e2c 100644 --- a/framework/inc/classes/fwktabwindow.hxx +++ b/framework/inc/classes/fwktabwindow.hxx @@ -68,6 +68,7 @@ public: const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider ); virtual ~FwkTabPage(); + virtual void dispose() SAL_OVERRIDE; virtual void ActivatePage() SAL_OVERRIDE; virtual void DeactivatePage() SAL_OVERRIDE; @@ -77,8 +78,8 @@ public: struct TabEntry { sal_Int32 m_nIndex; - FwkTabPage* m_pPage; - OUString m_sPageURL; + ScopedVclPtr<FwkTabPage> m_pPage; + OUString m_sPageURL; css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl; TabEntry() : @@ -86,8 +87,7 @@ struct TabEntry TabEntry( sal_Int32 nIndex, const OUString& sURL, const css::uno::Reference< css::awt::XContainerWindowEventHandler > & rEventHdl ) : m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_xEventHdl( rEventHdl ) {} - - ~TabEntry() { delete m_pPage; } + ~TabEntry() { m_pPage.disposeAndClear(); } }; typedef std::vector< TabEntry* > TabEntryList; @@ -95,8 +95,8 @@ typedef std::vector< TabEntry* > TabEntryList; class FwkTabWindow : public vcl::Window { private: - FwkTabControl m_aTabCtrl; - TabEntryList m_TabList; + VclPtr<FwkTabControl> m_aTabCtrl; + TabEntryList m_TabList; css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider; @@ -110,6 +110,7 @@ private: public: FwkTabWindow( vcl::Window* pParent ); virtual ~FwkTabWindow(); + virtual void dispose() SAL_OVERRIDE; void AddEventListener( const Link& rEventListener ); void RemoveEventListener( const Link& rEventListener ); diff --git a/framework/inc/dispatch/closedispatcher.hxx b/framework/inc/dispatch/closedispatcher.hxx index 25c19f107e6b..e8e9d0567927 100644 --- a/framework/inc/dispatch/closedispatcher.hxx +++ b/framework/inc/dispatch/closedispatcher.hxx @@ -39,6 +39,7 @@ #include <boost/scoped_ptr.hpp> #include <cppuhelper/implbase2.hxx> #include <vcl/evntpost.hxx> +#include <vcl/vclptr.hxx> class SystemWindow; @@ -105,7 +106,7 @@ class CloseDispatcher : public ::cppu::WeakImplHelper2< /** @short holded alive for internally asynchronous operations! */ css::uno::Reference< css::frame::XDispatchResultListener > m_xResultListener; - SystemWindow* m_pSysWindow; + VclPtr<SystemWindow> m_pSysWindow; // native interface diff --git a/framework/inc/helper/vclstatusindicator.hxx b/framework/inc/helper/vclstatusindicator.hxx index 4a68b79d8271..c5e115567a5e 100644 --- a/framework/inc/helper/vclstatusindicator.hxx +++ b/framework/inc/helper/vclstatusindicator.hxx @@ -52,7 +52,7 @@ class VCLStatusIndicator : public ::cppu::WeakImplHelper1< css::task::XStatusIn Its guarded by the solarmutex only. Otherwise we have to lock two of them, which can force a deadlock ... */ - StatusBar* m_pStatusBar; + VclPtr<StatusBar> m_pStatusBar; /** knows the current info text of the progress. */ OUString m_sText; diff --git a/framework/inc/uielement/buttontoolbarcontroller.hxx b/framework/inc/uielement/buttontoolbarcontroller.hxx index 561ef253f587..8949b58e90c1 100644 --- a/framework/inc/uielement/buttontoolbarcontroller.hxx +++ b/framework/inc/uielement/buttontoolbarcontroller.hxx @@ -34,6 +34,7 @@ #include <comphelper/broadcasthelper.hxx> #include <cppuhelper/weak.hxx> +#include <vcl/vclptr.hxx> class ToolBox; @@ -84,13 +85,13 @@ class ButtonToolbarController : public ::com::sun::star::frame::XStatusListener, virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - bool m_bInitialized : 1, + bool m_bInitialized : 1, m_bDisposed : 1; - OUString m_aCommandURL; + OUString m_aCommandURL; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; - ToolBox* m_pToolbar; + VclPtr<ToolBox> m_pToolbar; }; } diff --git a/framework/inc/uielement/comboboxtoolbarcontroller.hxx b/framework/inc/uielement/comboboxtoolbarcontroller.hxx index d04537495217..1850c45eb669 100644 --- a/framework/inc/uielement/comboboxtoolbarcontroller.hxx +++ b/framework/inc/uielement/comboboxtoolbarcontroller.hxx @@ -78,7 +78,7 @@ class ComboboxToolbarController : public IComboBoxListener, virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const SAL_OVERRIDE; private: - ComboBoxControl* m_pComboBox; + VclPtr<ComboBoxControl> m_pComboBox; }; } diff --git a/framework/inc/uielement/complextoolbarcontroller.hxx b/framework/inc/uielement/complextoolbarcontroller.hxx index 88084f8d1661..b24186f644bf 100644 --- a/framework/inc/uielement/complextoolbarcontroller.hxx +++ b/framework/inc/uielement/complextoolbarcontroller.hxx @@ -28,6 +28,7 @@ #include <svtools/toolboxcontroller.hxx> #include <tools/link.hxx> +#include <vcl/vclptr.hxx> class ToolBox; namespace vcl { class Window; } @@ -87,9 +88,9 @@ class ComplexToolbarController : public svt::ToolboxController void notifyFocusLost(); void notifyTextChanged( const OUString& aText ); - ToolBox* m_pToolbar; + VclPtr<ToolBox> m_pToolbar; sal_uInt16 m_nID; - bool m_bMadeInvisible; + bool m_bMadeInvisible; mutable ::com::sun::star::util::URL m_aURL; ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; }; diff --git a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx index e9e09f27e813..9b3703687dc4 100644 --- a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx +++ b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx @@ -26,6 +26,7 @@ #include <uielement/complextoolbarcontroller.hxx> #include <vcl/lstbox.hxx> +#include <vcl/vclptr.hxx> class ToolBox; @@ -74,7 +75,7 @@ class DropdownToolbarController : public IListBoxListener, virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const SAL_OVERRIDE; private: - ListBoxControl* m_pListBoxControl; + VclPtr<ListBoxControl> m_pListBoxControl; }; } diff --git a/framework/inc/uielement/edittoolbarcontroller.hxx b/framework/inc/uielement/edittoolbarcontroller.hxx index 8ebdca95a37c..0b8f9b6c90dc 100644 --- a/framework/inc/uielement/edittoolbarcontroller.hxx +++ b/framework/inc/uielement/edittoolbarcontroller.hxx @@ -75,7 +75,7 @@ class EditToolbarController : public IEditListener, virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const SAL_OVERRIDE; private: - EditControl* m_pEditControl; + VclPtr<EditControl> m_pEditControl; }; } diff --git a/framework/inc/uielement/generictoolbarcontroller.hxx b/framework/inc/uielement/generictoolbarcontroller.hxx index c6d867b3b261..26ebeb61ab46 100644 --- a/framework/inc/uielement/generictoolbarcontroller.hxx +++ b/framework/inc/uielement/generictoolbarcontroller.hxx @@ -23,6 +23,7 @@ #include <svtools/toolboxcontroller.hxx> #include <tools/link.hxx> +#include <vcl/vclptr.hxx> class PopupMenu; class ToolBox; @@ -53,11 +54,11 @@ class GenericToolbarController : public svt::ToolboxController DECL_STATIC_LINK( GenericToolbarController, ExecuteHdl_Impl, ExecuteInfo* ); protected: - ToolBox* m_pToolbar; - sal_uInt16 m_nID; - bool m_bEnumCommand : 1, - m_bMadeInvisible : 1; - OUString m_aEnumCommand; + VclPtr<ToolBox> m_pToolbar; + sal_uInt16 m_nID; + bool m_bEnumCommand : 1, + m_bMadeInvisible : 1; + OUString m_aEnumCommand; }; class MenuToolbarController : public GenericToolbarController diff --git a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx index ebef21894081..7d9a8e86eec7 100644 --- a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx +++ b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx @@ -26,6 +26,7 @@ #include <uielement/complextoolbarcontroller.hxx> #include <vcl/spinfld.hxx> +#include <vcl/vclptr.hxx> class ToolBox; @@ -97,7 +98,7 @@ class SpinfieldToolbarController : public ISpinfieldListener, double m_nMin; double m_nValue; double m_nStep; - SpinfieldControl* m_pSpinfieldControl; + VclPtr<SpinfieldControl> m_pSpinfieldControl; OUString m_aOutFormat; }; diff --git a/framework/inc/uielement/statusbar.hxx b/framework/inc/uielement/statusbar.hxx index be957eaedfb7..c192d50b48b2 100644 --- a/framework/inc/uielement/statusbar.hxx +++ b/framework/inc/uielement/statusbar.hxx @@ -33,7 +33,6 @@ class FrameworkStatusBar : public StatusBar FrameworkStatusBar( vcl::Window* pParent, WinBits nWinBits ); - virtual ~FrameworkStatusBar(); void SetStatusBarManager( StatusBarManager* pStatusBarManager ); diff --git a/framework/inc/uielement/statusbaritem.hxx b/framework/inc/uielement/statusbaritem.hxx index e5afc02c5480..e05cd37ded3c 100644 --- a/framework/inc/uielement/statusbaritem.hxx +++ b/framework/inc/uielement/statusbaritem.hxx @@ -22,6 +22,7 @@ #include <com/sun/star/ui/XStatusbarItem.hpp> #include <cppuhelper/compbase1.hxx> #include <cppuhelper/basemutex.hxx> +#include <vcl/vclptr.hxx> class StatusBar; @@ -67,7 +68,7 @@ public: virtual void SAL_CALL repaint( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - StatusBar *m_pStatusBar; + VclPtr<StatusBar> m_pStatusBar; AddonStatusbarItemData *m_pItemData; sal_uInt16 m_nId; sal_uInt16 m_nStyle; diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx index efbe5486b0db..2167b0cc9e3d 100644 --- a/framework/inc/uielement/statusbarmanager.hxx +++ b/framework/inc/uielement/statusbarmanager.hxx @@ -37,6 +37,7 @@ #include <cppuhelper/implbase3.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <vcl/status.hxx> +#include <vcl/vclptr.hxx> #include <map> namespace framework @@ -98,13 +99,13 @@ class StatusBarManager : public ::cppu::WeakImplHelper3< protected: typedef std::map< sal_uInt16, ::com::sun::star::uno::Reference< com::sun::star::frame::XStatusbarController > > StatusBarControllerMap; - bool m_bDisposed : 1, + bool m_bDisposed : 1, m_bFrameActionRegistered : 1, m_bUpdateControllers : 1; - bool m_bModuleIdentified; - StatusBar* m_pStatusBar; - OUString m_aModuleIdentifier; - OUString m_aResourceName; + bool m_bModuleIdentified; + VclPtr<StatusBar> m_pStatusBar; + OUString m_aModuleIdentifier; + OUString m_aResourceName; com::sun::star::uno::Reference< com::sun::star::frame::XFrame > m_xFrame; com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_xUICommandLabels; StatusBarControllerMap m_aControllerMap; diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index 90b68ac4a139..95381c3120a4 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -189,7 +189,7 @@ class ToolBarManager : public ToolbarManager_Base long m_lImageRotation; - ToolBox* m_pToolBar; + VclPtr<ToolBox> m_pToolBar; OUString m_aModuleIdentifier; OUString m_aResourceName; diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx index 8a595a9878fa..0902ff36a9e1 100644 --- a/framework/inc/uielement/toolbarmerger.hxx +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -61,7 +61,7 @@ typedef ::std::vector< AddonToolbarItem > AddonToolbarItemContainer; struct ReferenceToolbarPathInfo { - ToolBox* pToolbar; + VclPtr<ToolBox> pToolbar; sal_uInt16 nPos; bool bResult; }; diff --git a/framework/source/classes/fwktabwindow.cxx b/framework/source/classes/fwktabwindow.cxx index b01cf418f48a..da2c187e9f68 100644 --- a/framework/source/classes/fwktabwindow.cxx +++ b/framework/source/classes/fwktabwindow.cxx @@ -81,8 +81,14 @@ FwkTabPage::FwkTabPage( FwkTabPage::~FwkTabPage() { + disposeOnce(); +} + +void FwkTabPage::dispose() +{ Hide(); DeactivatePage(); + TabPage::dispose(); } void FwkTabPage::CreateDialog() @@ -174,20 +180,27 @@ void FwkTabPage::Resize() // class FwkTabWindow --------------------------------------------- FwkTabWindow::FwkTabWindow( vcl::Window* pParent ) : Window(pParent) - , m_aTabCtrl(this) + , m_aTabCtrl(VclPtr<FwkTabControl>::Create(this)) { m_xWinProvider = awt::ContainerWindowProvider::create( ::comphelper::getProcessComponentContext() ); SetPaintTransparent(true); - m_aTabCtrl.SetActivatePageHdl( LINK( this, FwkTabWindow, ActivatePageHdl ) ); - m_aTabCtrl.SetDeactivatePageHdl( LINK( this, FwkTabWindow, DeactivatePageHdl ) ); - m_aTabCtrl.Show(); + m_aTabCtrl->SetActivatePageHdl( LINK( this, FwkTabWindow, ActivatePageHdl ) ); + m_aTabCtrl->SetDeactivatePageHdl( LINK( this, FwkTabWindow, DeactivatePageHdl ) ); + m_aTabCtrl->Show(); } FwkTabWindow::~FwkTabWindow() { + disposeOnce(); +} + +void FwkTabWindow::dispose() +{ ClearEntryList(); + m_aTabCtrl.disposeAndClear(); + vcl::Window::dispose(); } void FwkTabWindow::ClearEntryList() @@ -245,40 +258,40 @@ TabEntry* FwkTabWindow::FindEntry( sal_Int32 nIndex ) const IMPL_LINK_NOARG(FwkTabWindow, ActivatePageHdl) { - const sal_uInt16 nId = m_aTabCtrl.GetCurPageId(); - FwkTabPage* pTabPage = static_cast< FwkTabPage* >( m_aTabCtrl.GetTabPage( nId ) ); + const sal_uInt16 nId = m_aTabCtrl->GetCurPageId(); + FwkTabPage* pTabPage = static_cast< FwkTabPage* >( m_aTabCtrl->GetTabPage( nId ) ); if ( !pTabPage ) { TabEntry* pEntry = FindEntry( nId ); if ( pEntry ) { - pTabPage = new FwkTabPage( &m_aTabCtrl, pEntry->m_sPageURL, pEntry->m_xEventHdl, m_xWinProvider ); + pTabPage = VclPtr<FwkTabPage>::Create( m_aTabCtrl.get(), pEntry->m_sPageURL, pEntry->m_xEventHdl, m_xWinProvider ); pEntry->m_pPage = pTabPage; - m_aTabCtrl.SetTabPage( nId, pTabPage ); + m_aTabCtrl->SetTabPage( nId, pTabPage ); pTabPage->Show(); pTabPage->ActivatePage(); } } else { pTabPage->ActivatePage(); } - m_aTabCtrl.BroadcastEvent( VCLEVENT_TABPAGE_ACTIVATE ); + m_aTabCtrl->BroadcastEvent( VCLEVENT_TABPAGE_ACTIVATE ); return 1; } IMPL_LINK_NOARG(FwkTabWindow, DeactivatePageHdl) { - m_aTabCtrl.BroadcastEvent( VCLEVENT_TABPAGE_DEACTIVATE ); + m_aTabCtrl->BroadcastEvent( VCLEVENT_TABPAGE_DEACTIVATE ); return 1; } void FwkTabWindow::AddEventListener( const Link& rEventListener ) { - m_aTabCtrl.AddEventListener( rEventListener ); + m_aTabCtrl->AddEventListener( rEventListener ); } void FwkTabWindow::RemoveEventListener( const Link& rEventListener ) { - m_aTabCtrl.RemoveEventListener( rEventListener ); + m_aTabCtrl->RemoveEventListener( rEventListener ); } FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< beans::NamedValue >& rProperties ) @@ -311,20 +324,20 @@ FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< bea TabEntry* pEntry = new TabEntry( nIndex, sPageURL, xEventHdl ); m_TabList.push_back( pEntry ); sal_uInt16 nIdx = static_cast< sal_uInt16 >( nIndex ); - m_aTabCtrl.InsertPage( nIdx, sTitle ); + m_aTabCtrl->InsertPage( nIdx, sTitle ); if ( !sToolTip.isEmpty() ) - m_aTabCtrl.SetHelpText( nIdx, sToolTip ); + m_aTabCtrl->SetHelpText( nIdx, sToolTip ); if ( xImage.is() ) - m_aTabCtrl.SetPageImage( nIdx, Image( xImage ) ); + m_aTabCtrl->SetPageImage( nIdx, Image( xImage ) ); if ( bDisabled ) - m_aTabCtrl.EnablePage( nIdx, false ); + m_aTabCtrl->EnablePage( nIdx, false ); return pEntry->m_pPage; } void FwkTabWindow::ActivatePage( sal_Int32 nIndex ) { - m_aTabCtrl.SetCurPageId( static_cast< sal_uInt16 >( nIndex ) ); + m_aTabCtrl->SetCurPageId( static_cast< sal_uInt16 >( nIndex ) ); ActivatePageHdl( &m_aTabCtrl ); } @@ -333,7 +346,7 @@ void FwkTabWindow::RemovePage( sal_Int32 nIndex ) TabEntry* pEntry = FindEntry(nIndex); if ( pEntry ) { - m_aTabCtrl.RemovePage( static_cast< sal_uInt16 >( nIndex ) ); + m_aTabCtrl->RemovePage( static_cast< sal_uInt16 >( nIndex ) ); if (RemoveEntry(nIndex)) delete pEntry; } @@ -342,7 +355,7 @@ void FwkTabWindow::RemovePage( sal_Int32 nIndex ) void FwkTabWindow::Resize() { Size aPageSize = GetSizePixel(); - m_aTabCtrl.SetTabPageSizePixel( aPageSize ); + m_aTabCtrl->SetTabPageSizePixel( aPageSize ); } } // namespace framework diff --git a/framework/source/helper/vclstatusindicator.cxx b/framework/source/helper/vclstatusindicator.cxx index e02c4e747ca9..18f08294d489 100644 --- a/framework/source/helper/vclstatusindicator.cxx +++ b/framework/source/helper/vclstatusindicator.cxx @@ -48,7 +48,7 @@ void SAL_CALL VCLStatusIndicator::start(const OUString& sText , vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(m_xParentWindow); if (!m_pStatusBar) - m_pStatusBar = new StatusBar(pParentWindow, WB_3DLOOK|WB_BORDER); + m_pStatusBar = VclPtr<StatusBar>::Create(pParentWindow, WB_3DLOOK|WB_BORDER); VCLStatusIndicator::impl_recalcLayout(m_pStatusBar, pParentWindow); @@ -91,8 +91,7 @@ void SAL_CALL VCLStatusIndicator::end() m_pStatusBar->EndProgressMode(); m_pStatusBar->Show(false); - delete m_pStatusBar; - m_pStatusBar = 0; + m_pStatusBar.disposeAndClear(); } } diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index f3434b739541..6ccaf62f89e6 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -906,7 +906,7 @@ void LayoutManager::implts_createProgressBar() vcl::Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow ); if ( pWindow ) { - StatusBar* pStatusBar = new StatusBar( pWindow, WinBits( WB_LEFT | WB_3DLOOK ) ); + VclPtrInstance<StatusBar> pStatusBar( pWindow, WinBits( WB_LEFT | WB_3DLOOK ) ); Reference< awt::XWindow > xStatusBarWindow2( VCLUnoHelper::GetInterface( pStatusBar )); pWrapper->setStatusBar( xStatusBarWindow2, true ); } diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index f40b98d068f2..1b1b9fc41948 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -1031,14 +1031,14 @@ void ToolbarLayoutManager::setParentWindow( if ( xParentWindow.is() ) { SolarMutexGuard aGuard; - ::DockingAreaWindow* pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xTopDockWindow ) ); + VclPtr< ::DockingAreaWindow > pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xTopDockWindow ).get() ); if( pWindow ) pWindow->SetAlign( WINDOWALIGN_TOP ); - pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xBottomDockWindow ) ); - if( pWindow ) pWindow->SetAlign( WINDOWALIGN_BOTTOM ); - pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xLeftDockWindow ) ); - if( pWindow ) pWindow->SetAlign( WINDOWALIGN_LEFT ); - pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xRightDockWindow ) ); - if( pWindow ) pWindow->SetAlign( WINDOWALIGN_RIGHT ); + pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xBottomDockWindow ).get() ); + if( pWindow ) pWindow->SetAlign( WINDOWALIGN_BOTTOM ); + pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xLeftDockWindow ).get() ); + if( pWindow ) pWindow->SetAlign( WINDOWALIGN_LEFT ); + pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xRightDockWindow ).get() ); + if( pWindow ) pWindow->SetAlign( WINDOWALIGN_RIGHT ); implts_reparentToolbars(); } else diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index b235a624cd4e..0a23fa606e66 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -4205,11 +4205,11 @@ void AutoRecovery::impl_showFullDiscError() if (sBackupPath.getLength() < 1) sBackupPath = sBackupURL; - ErrorBox dlgError( - 0, WB_OK, + ScopedVclPtrInstance<ErrorBox> dlgError( + nullptr, WB_OK, sMsg.replaceAll("%PATH", sBackupPath)); - dlgError.SetButtonText(dlgError.GetButtonId(0), sBtn); - dlgError.Execute(); + dlgError->SetButtonText(dlgError->GetButtonId(0), sBtn); + dlgError->Execute(); } void AutoRecovery::impl_establishProgress(const AutoRecovery::TDocumentInfo& rInfo , diff --git a/framework/source/services/tabwindowservice.cxx b/framework/source/services/tabwindowservice.cxx index dd9c46e58235..f93aee07ed9a 100644 --- a/framework/source/services/tabwindowservice.cxx +++ b/framework/source/services/tabwindowservice.cxx @@ -68,8 +68,8 @@ struct TTabPageInfo public: ::sal_Int32 m_nIndex; - bool m_bCreated; - FwkTabPage* m_pPage; + bool m_bCreated; + VclPtr<FwkTabPage> m_pPage; css::uno::Sequence< css::beans::NamedValue > m_lProperties; }; @@ -159,7 +159,7 @@ private: css::uno::Reference< css::awt::XWindow > m_xTabWin; /// the VCL tab window - FwkTabWindow* m_pTabWin; + VclPtr<FwkTabWindow> m_pTabWin; /// container of inserted tab pages TTabPageInfoHash m_lTabPageInfos; @@ -356,7 +356,7 @@ void SAL_CALL TabWindowService::dispose() if (m_pTabWin) m_pTabWin->RemoveEventListener( LINK( this, TabWindowService, EventListener ) ); - m_pTabWin = NULL; + m_pTabWin.clear(); m_xTabWin.clear(); } diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx index 77987fa3c279..35506a24e86c 100644 --- a/framework/source/uielement/addonstoolbarwrapper.cxx +++ b/framework/source/uielement/addonstoolbarwrapper.cxx @@ -114,7 +114,7 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument { sal_uLong nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE; - pToolBar = new ToolBox( pWindow, nStyles ); + pToolBar = VclPtr<ToolBox>::Create( pWindow, nStyles ); pToolBarManager = new AddonsToolBarManager( m_xContext, xFrame, m_aResourceURL, pToolBar ); m_xToolBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pToolBarManager ), UNO_QUERY ); } diff --git a/framework/source/uielement/buttontoolbarcontroller.cxx b/framework/source/uielement/buttontoolbarcontroller.cxx index 2219b5c6ff97..aaf068591354 100644 --- a/framework/source/uielement/buttontoolbarcontroller.cxx +++ b/framework/source/uielement/buttontoolbarcontroller.cxx @@ -152,7 +152,7 @@ void SAL_CALL ButtonToolbarController::dispose() throw (::com::sun::star::uno::R m_xContext.clear(); m_xURLTransformer.clear(); m_xFrame.clear(); - m_pToolbar = 0; + m_pToolbar.clear(); m_bDisposed = true; } } diff --git a/framework/source/uielement/comboboxtoolbarcontroller.cxx b/framework/source/uielement/comboboxtoolbarcontroller.cxx index 2f3cefb4f4d0..15fb15cfd3a9 100644 --- a/framework/source/uielement/comboboxtoolbarcontroller.cxx +++ b/framework/source/uielement/comboboxtoolbarcontroller.cxx @@ -55,6 +55,7 @@ class ComboBoxControl : public ComboBox public: ComboBoxControl( vcl::Window* pParent, WinBits nStyle, IComboBoxListener* pComboBoxListener ); virtual ~ComboBoxControl(); + virtual void dispose() SAL_OVERRIDE; virtual void Select() SAL_OVERRIDE; virtual void DoubleClick() SAL_OVERRIDE; @@ -76,7 +77,13 @@ ComboBoxControl::ComboBoxControl( vcl::Window* pParent, WinBits nStyle, IComboBo ComboBoxControl::~ComboBoxControl() { + disposeOnce(); +} + +void ComboBoxControl::dispose() +{ m_pComboBoxListener = 0; + ComboBox::dispose(); } void ComboBoxControl::Select() @@ -142,7 +149,7 @@ ComboboxToolbarController::ComboboxToolbarController( ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand ) , m_pComboBox( 0 ) { - m_pComboBox = new ComboBoxControl( m_pToolbar, WB_DROPDOWN, this ); + m_pComboBox = VclPtr<ComboBoxControl>::Create( m_pToolbar, WB_DROPDOWN, this ); if ( nWidth == 0 ) nWidth = 100; @@ -164,11 +171,9 @@ throw ( RuntimeException, std::exception ) SolarMutexGuard aSolarMutexGuard; m_pToolbar->SetItemWindow( m_nID, 0 ); - delete m_pComboBox; + m_pComboBox.disposeAndClear(); ComplexToolbarController::dispose(); - - m_pComboBox = 0; } Sequence<PropertyValue> ComboboxToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const diff --git a/framework/source/uielement/complextoolbarcontroller.cxx b/framework/source/uielement/complextoolbarcontroller.cxx index 871c7b2bba6a..05f1d1c27a44 100644 --- a/framework/source/uielement/complextoolbarcontroller.cxx +++ b/framework/source/uielement/complextoolbarcontroller.cxx @@ -76,7 +76,7 @@ throw ( RuntimeException, std::exception ) svt::ToolboxController::dispose(); m_xURLTransformer.clear(); - m_pToolbar = 0; + m_pToolbar.clear(); m_nID = 0; } diff --git a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx index 5eb339284cb9..7d00fbcd70d9 100644 --- a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx +++ b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx @@ -54,6 +54,7 @@ class ListBoxControl : public ListBox public: ListBoxControl( vcl::Window* pParent, WinBits nStyle, IListBoxListener* pListBoxListener ); virtual ~ListBoxControl(); + virtual void dispose() SAL_OVERRIDE; virtual void Select() SAL_OVERRIDE; virtual void DoubleClick() SAL_OVERRIDE; @@ -73,7 +74,13 @@ ListBoxControl::ListBoxControl( vcl::Window* pParent, WinBits nStyle, IListBoxLi ListBoxControl::~ListBoxControl() { + disposeOnce(); +} + +void ListBoxControl::dispose() +{ m_pListBoxListener = 0; + ListBox::dispose(); } void ListBoxControl::Select() @@ -125,7 +132,7 @@ DropdownToolbarController::DropdownToolbarController( ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand ) , m_pListBoxControl( 0 ) { - m_pListBoxControl = new ListBoxControl( m_pToolbar, WB_DROPDOWN|WB_AUTOHSCROLL|WB_BORDER, this ); + m_pListBoxControl = VclPtr<ListBoxControl>::Create( m_pToolbar, WB_DROPDOWN|WB_AUTOHSCROLL|WB_BORDER, this ); if ( nWidth == 0 ) nWidth = 100; @@ -148,11 +155,9 @@ throw ( RuntimeException, std::exception ) SolarMutexGuard aSolarMutexGuard; m_pToolbar->SetItemWindow( m_nID, 0 ); - delete m_pListBoxControl; + m_pListBoxControl.disposeAndClear(); ComplexToolbarController::dispose(); - - m_pListBoxControl = 0; } Sequence<PropertyValue> DropdownToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const diff --git a/framework/source/uielement/edittoolbarcontroller.cxx b/framework/source/uielement/edittoolbarcontroller.cxx index 67cdcb1e2e3d..41403fd9f7e7 100644 --- a/framework/source/uielement/edittoolbarcontroller.cxx +++ b/framework/source/uielement/edittoolbarcontroller.cxx @@ -53,6 +53,7 @@ class EditControl : public Edit public: EditControl( vcl::Window* pParent, WinBits nStyle, IEditListener* pEditListener ); virtual ~EditControl(); + virtual void dispose() SAL_OVERRIDE; virtual void Modify() SAL_OVERRIDE; virtual void KeyInput( const ::KeyEvent& rKEvt ) SAL_OVERRIDE; @@ -72,7 +73,13 @@ EditControl::EditControl( vcl::Window* pParent, WinBits nStyle, IEditListener* p EditControl::~EditControl() { + disposeOnce(); +} + +void EditControl::dispose() +{ m_pEditListener = 0; + Edit::dispose(); } void EditControl::Modify() @@ -124,7 +131,7 @@ EditToolbarController::EditToolbarController( ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand ) , m_pEditControl( 0 ) { - m_pEditControl = new EditControl( m_pToolbar, WB_BORDER, this ); + m_pEditControl = VclPtr<EditControl>::Create( m_pToolbar, WB_BORDER, this ); if ( nWidth == 0 ) nWidth = 100; @@ -145,11 +152,9 @@ throw ( RuntimeException, std::exception ) SolarMutexGuard aSolarMutexGuard; m_pToolbar->SetItemWindow( m_nID, 0 ); - delete m_pEditControl; + m_pEditControl.disposeAndClear(); ComplexToolbarController::dispose(); - - m_pEditControl = 0; } Sequence<PropertyValue> EditToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx index 3e097655c9ab..7ad43146d4cc 100644 --- a/framework/source/uielement/fontsizemenucontroller.cxx +++ b/framework/source/uielement/fontsizemenucontroller.cxx @@ -135,7 +135,7 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r if ( pVCLPopupMenu ) { boost::scoped_ptr<FontList> pFontList; - boost::scoped_ptr<Printer> pInfoPrinter; + ScopedVclPtr<Printer> pInfoPrinter; OUString aPrinterName; SolarMutexGuard aSolarMutexGuard; @@ -144,7 +144,7 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r aPrinterName = retrievePrinterName( m_xFrame ); if ( !aPrinterName.isEmpty() ) { - pInfoPrinter.reset(new Printer( aPrinterName )); + pInfoPrinter.reset(VclPtr<Printer>::Create( aPrinterName )); if ( pInfoPrinter && pInfoPrinter->GetDevFontCount() > 0 ) pFontList.reset(new FontList( pInfoPrinter.get() )); } diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index c2cdf4058fe4..7bf96258312d 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -125,7 +125,7 @@ throw ( RuntimeException, std::exception ) svt::ToolboxController::dispose(); - m_pToolbar = 0; + m_pToolbar.clear(); m_nID = 0; } diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index 259601ea8855..c2e324717825 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -146,7 +146,7 @@ throw ( css::uno::Exception, css::uno::RuntimeException, std::exception ) } SolarMutexGuard aSolarLock; - ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); + VclPtr< ToolBox > pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() ); if ( pToolBox ) { ToolBoxItemBits nCurStyle( pToolBox->GetItemBits( m_nToolBoxId ) ); @@ -181,7 +181,7 @@ PopupMenuToolbarController::createPopupWindow() createPopupMenuController(); SolarMutexGuard aSolarLock; - ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); + VclPtr< ToolBox > pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() ); if ( !pToolBox ) return xRet; @@ -540,7 +540,7 @@ static bool Impl_ExistURLInMenu( void NewToolbarController::setItemImage( const OUString &rCommand ) { SolarMutexGuard aSolarLock; - ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); + VclPtr< ToolBox> pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() ); if ( !pToolBox ) return; diff --git a/framework/source/uielement/spinfieldtoolbarcontroller.cxx b/framework/source/uielement/spinfieldtoolbarcontroller.cxx index efe6a711877f..3d60f613e000 100644 --- a/framework/source/uielement/spinfieldtoolbarcontroller.cxx +++ b/framework/source/uielement/spinfieldtoolbarcontroller.cxx @@ -59,6 +59,7 @@ class SpinfieldControl : public SpinField public: SpinfieldControl( vcl::Window* pParent, WinBits nStyle, ISpinfieldListener* pSpinFieldListener ); virtual ~SpinfieldControl(); + virtual void dispose() SAL_OVERRIDE; virtual void Up() SAL_OVERRIDE; virtual void Down() SAL_OVERRIDE; @@ -84,7 +85,13 @@ SpinfieldControl::SpinfieldControl( vcl::Window* pParent, WinBits nStyle, ISpinf SpinfieldControl::~SpinfieldControl() { + disposeOnce(); +} + +void SpinfieldControl::dispose() +{ m_pSpinFieldListener = 0; + SpinField::dispose(); } void SpinfieldControl::Up() @@ -185,7 +192,7 @@ SpinfieldToolbarController::SpinfieldToolbarController( , m_nStep( 0.0 ) , m_pSpinfieldControl( 0 ) { - m_pSpinfieldControl = new SpinfieldControl( m_pToolbar, WB_SPIN|WB_BORDER, this ); + m_pSpinfieldControl = VclPtr<SpinfieldControl>::Create( m_pToolbar, WB_SPIN|WB_BORDER, this ); if ( nWidth == 0 ) nWidth = 100; @@ -206,11 +213,9 @@ throw ( RuntimeException, std::exception ) SolarMutexGuard aSolarMutexGuard; m_pToolbar->SetItemWindow( m_nID, 0 ); - delete m_pSpinfieldControl; + m_pSpinfieldControl.disposeAndClear(); ComplexToolbarController::dispose(); - - m_pSpinfieldControl = 0; } Sequence<PropertyValue> SpinfieldToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const diff --git a/framework/source/uielement/statusbar.cxx b/framework/source/uielement/statusbar.cxx index 9358efe228b2..2f520ec46d95 100644 --- a/framework/source/uielement/statusbar.cxx +++ b/framework/source/uielement/statusbar.cxx @@ -34,10 +34,6 @@ FrameworkStatusBar::FrameworkStatusBar( SetOutputSizePixel( CalcWindowSizePixel() ); } -FrameworkStatusBar::~FrameworkStatusBar() -{ -} - void FrameworkStatusBar::SetStatusBarManager( StatusBarManager* pStatusBarManager ) { SolarMutexGuard aSolarMutexGuard; diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx index d04529352636..f6bfb7eaf03e 100644 --- a/framework/source/uielement/statusbarmanager.cxx +++ b/framework/source/uielement/statusbarmanager.cxx @@ -200,40 +200,39 @@ void SAL_CALL StatusBarManager::dispose() throw( uno::RuntimeException, std::exc { SolarMutexGuard g; - if ( !m_bDisposed ) + if ( m_bDisposed ) + return; + + RemoveControllers(); + + // destroy the item data + for ( sal_uInt16 n = 0; n < m_pStatusBar->GetItemCount(); n++ ) { - RemoveControllers(); + AddonStatusbarItemData *pUserData = static_cast< AddonStatusbarItemData *>( + m_pStatusBar->GetItemData( m_pStatusBar->GetItemId( n ) ) ); + if ( pUserData ) + delete pUserData; + } - // destroy the item data - for ( sal_uInt16 n = 0; n < m_pStatusBar->GetItemCount(); n++ ) + m_pStatusBar.disposeAndClear(); + + if ( m_bFrameActionRegistered && m_xFrame.is() ) + { + try { - AddonStatusbarItemData *pUserData = static_cast< AddonStatusbarItemData *>( - m_pStatusBar->GetItemData( m_pStatusBar->GetItemId( n ) ) ); - if ( pUserData ) - delete pUserData; + m_xFrame->removeFrameActionListener( uno::Reference< frame::XFrameActionListener >( + static_cast< ::cppu::OWeakObject *>( this ), + uno::UNO_QUERY )); } - - delete m_pStatusBar; - m_pStatusBar = 0; - - if ( m_bFrameActionRegistered && m_xFrame.is() ) + catch ( const uno::Exception& ) { - try - { - m_xFrame->removeFrameActionListener( uno::Reference< frame::XFrameActionListener >( - static_cast< ::cppu::OWeakObject *>( this ), - uno::UNO_QUERY )); - } - catch ( const uno::Exception& ) - { - } } + } - m_xFrame.clear(); - m_xContext.clear(); + m_xFrame.clear(); + m_xContext.clear(); - m_bDisposed = true; - } + m_bDisposed = true; } } diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx index 7d5322f12e8a..2f1f74028a0c 100644 --- a/framework/source/uielement/statusbarwrapper.cxx +++ b/framework/source/uielement/statusbarwrapper.cxx @@ -110,7 +110,7 @@ void SAL_CALL StatusBarWrapper::initialize( const Sequence< Any >& aArguments ) { sal_uLong nStyles = WinBits( WB_LEFT | WB_3DLOOK ); - pStatusBar = new FrameworkStatusBar( pWindow, nStyles ); + pStatusBar = VclPtr<FrameworkStatusBar>::Create( pWindow, nStyles ); pStatusBarManager = new StatusBarManager( m_xContext, xFrame, m_aResourceURL, pStatusBar ); static_cast<FrameworkStatusBar*>(pStatusBar)->SetStatusBarManager( pStatusBarManager ); m_xStatusBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pStatusBarManager ), UNO_QUERY ); diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 4de9df463d66..aca1580fef76 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -1,4 +1,3 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * @@ -250,7 +249,7 @@ ToolBarManager::~ToolBarManager() void ToolBarManager::Destroy() { - OSL_ASSERT( m_pToolBar != 0 ); + OSL_ASSERT( m_pToolBar != nullptr ); SolarMutexGuard g; if ( m_bAddedToTaskPaneList ) { @@ -288,7 +287,7 @@ void ToolBarManager::Destroy() m_pToolBar->SetDataChangedHdl( aEmpty ); m_pToolBar->SetCommandHdl( aEmpty ); - m_pToolBar = 0; + m_pToolBar.clear(); SvtMiscOptions().RemoveListenerLink( LINK( this, ToolBarManager, MiscOptionsChanged ) ); } @@ -599,6 +598,7 @@ void SAL_CALL ToolBarManager::dispose() throw( RuntimeException, std::exception // We have to destroy our toolbar instance now. Destroy(); + m_pToolBar.clear(); if ( m_bFrameActionRegistered && m_xFrame.is() ) { @@ -727,7 +727,7 @@ void ToolBarManager::setToolBarImage(const Image& _aImage,const CommandToInfoMap { const ::std::vector< sal_uInt16 >& _rIDs = _pIter->second.aIds; m_pToolBar->SetItemImage( _pIter->second.nId, _aImage ); - ::std::for_each(_rIDs.begin(),_rIDs.end(),::boost::bind(&ToolBox::SetItemImage,m_pToolBar,_1,_aImage)); + ::std::for_each(_rIDs.begin(),_rIDs.end(),::boost::bind(&ToolBox::SetItemImage,m_pToolBar.get(),_1,_aImage)); } void SAL_CALL ToolBarManager::elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException, std::exception) diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx index ad609a20cca8..36f9909a250b 100644 --- a/framework/source/uielement/toolbarwrapper.cxx +++ b/framework/source/uielement/toolbarwrapper.cxx @@ -150,7 +150,7 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments ) th { sal_uLong nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE; - pToolBar = new ToolBox( pWindow, nStyles ); + pToolBar = VclPtr<ToolBox>::Create( pWindow, nStyles ); pToolBarManager = new ToolBarManager( m_xContext, xFrame, m_aResourceURL, pToolBar ); m_xToolBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pToolBarManager ), UNO_QUERY ); pToolBar->WillUsePopupMode( bPopupMode ); |