diff options
28 files changed, 83 insertions, 86 deletions
diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx index 7adfb4e83826..28adf1959c8e 100644 --- a/avmedia/source/framework/mediaplayer.cxx +++ b/avmedia/source/framework/mediaplayer.cxx @@ -40,7 +40,7 @@ namespace avmedia MediaPlayer::MediaPlayer( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* _pBindings, SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) { - pWindow = VclPtr<MediaFloater>::Create( _pBindings, this, _pParent ); + pWindow.reset( VclPtr<MediaFloater>::Create( _pBindings, this, _pParent ) ); eChildAlignment = SfxChildAlignment::NOALIGNMENT; static_cast< MediaFloater* >( pWindow.get() )->Initialize( pInfo ); }; diff --git a/avmedia/source/framework/mediatoolbox.cxx b/avmedia/source/framework/mediatoolbox.cxx index 124da20680ed..4f20a781c676 100644 --- a/avmedia/source/framework/mediatoolbox.cxx +++ b/avmedia/source/framework/mediatoolbox.cxx @@ -124,9 +124,9 @@ void MediaToolBoxControl::StateChanged( sal_uInt16 /* nSID */, SfxItemState eSta -vcl::Window* MediaToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> MediaToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - return( pParent ? new MediaToolBoxControl_Impl( *pParent, *this ) : NULL ); + return ( pParent ? VclPtr<MediaToolBoxControl_Impl>::Create( *pParent, *this ) : nullptr ); } diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx index 615aed48c4aa..a774c1bd796d 100644 --- a/basctl/source/basicide/basicbox.cxx +++ b/basctl/source/basicide/basicbox.cxx @@ -65,9 +65,9 @@ void LibBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPool -vcl::Window* LibBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> LibBoxControl::CreateItemWindow( vcl::Window *pParent ) { - return new LibBox( pParent, m_xFrame ); + return VclPtr<LibBox>::Create( pParent, m_xFrame ); } @@ -362,9 +362,9 @@ void LanguageBoxControl::StateChanged( sal_uInt16 nID, SfxItemState eState, cons } } -vcl::Window* LanguageBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> LanguageBoxControl::CreateItemWindow( vcl::Window *pParent ) { - return new LanguageBox( pParent ); + return VclPtr<LanguageBox>::Create( pParent ); } // class basctl::LanguageBox ----------------------------------------------- diff --git a/basctl/source/basicide/basicbox.hxx b/basctl/source/basicide/basicbox.hxx index f13e0ea6e85f..1f87750cea4e 100644 --- a/basctl/source/basicide/basicbox.hxx +++ b/basctl/source/basicide/basicbox.hxx @@ -36,7 +36,7 @@ public: virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; /** base class for list boxes which need to update their content according to the list @@ -110,7 +110,7 @@ public: LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; class LanguageBox : public DocListenerBox diff --git a/include/avmedia/mediatoolbox.hxx b/include/avmedia/mediatoolbox.hxx index 4c512979288a..fb61d33b865f 100644 --- a/include/avmedia/mediatoolbox.hxx +++ b/include/avmedia/mediatoolbox.hxx @@ -45,7 +45,7 @@ public: virtual ~MediaToolBoxControl(); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; private: diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx index 6061a5b77025..5284bcc3c1e4 100644 --- a/include/sfx2/tbxctrl.hxx +++ b/include/sfx2/tbxctrl.hxx @@ -203,7 +203,7 @@ protected: virtual SfxPopupWindowType GetPopupWindowType() const; virtual SfxPopupWindow* CreatePopupWindow(); virtual SfxPopupWindow* CreatePopupWindowCascading(); - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ); + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ); // Must be called by subclass to set a new popup window instance void SetPopupWindow( SfxPopupWindow* pWindow ); @@ -306,7 +306,7 @@ class SfxDragToolBoxControl_Impl : public SfxToolBoxControl public: SFX_DECL_TOOLBOX_CONTROL(); SfxDragToolBoxControl_Impl( sal_uInt16 nId, ToolBox& rBox ); - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE; }; diff --git a/include/svx/fillctrl.hxx b/include/svx/fillctrl.hxx index fd7e5a0985d6..f196248a0555 100644 --- a/include/svx/fillctrl.hxx +++ b/include/svx/fillctrl.hxx @@ -67,7 +67,7 @@ public: virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE; void Update(const SfxPoolItem* pState); - virtual vcl::Window* CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; }; diff --git a/include/svx/grafctrl.hxx b/include/svx/grafctrl.hxx index acfd5f356cfa..473133b35ef1 100644 --- a/include/svx/grafctrl.hxx +++ b/include/svx/grafctrl.hxx @@ -68,7 +68,7 @@ public: virtual ~SvxGrafToolBoxControl(); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; @@ -160,7 +160,7 @@ public: virtual ~SvxGrafModeToolBoxControl(); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx index a853dd802125..4b5ccec56f71 100644 --- a/include/svx/linectrl.hxx +++ b/include/svx/linectrl.hxx @@ -52,7 +52,7 @@ public: virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; void Update( const SfxPoolItem* pState ); - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; @@ -69,7 +69,7 @@ public: virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx index 329bb208145b..28358d2d36e0 100644 --- a/include/svx/tbcontrl.hxx +++ b/include/svx/tbcontrl.hxx @@ -163,7 +163,7 @@ public: SvxStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox); virtual ~SvxStyleToolBoxControl(); - virtual vcl::Window* CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE; @@ -210,7 +210,7 @@ public: virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; }; class BorderColorStatus diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx index 618a5af268a9..b93ec720901c 100644 --- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx +++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx @@ -79,14 +79,14 @@ void ScZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState } } -vcl::Window* ScZoomSliderControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> ScZoomSliderControl::CreateItemWindow( vcl::Window *pParent ) { // #i98000# Don't try to get a value via SfxViewFrame::Current here. // The view's value is always notified via StateChanged later. - ScZoomSliderWnd* pSlider = new ScZoomSliderWnd( pParent, + VclPtrInstance<ScZoomSliderWnd> pSlider( pParent, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >( m_xFrame->getController(), ::com::sun::star::uno::UNO_QUERY ), m_xFrame, 100 ); - return pSlider; + return pSlider.get(); } struct ScZoomSliderWnd::ScZoomSliderWnd_Impl diff --git a/sc/source/ui/inc/tbzoomsliderctrl.hxx b/sc/source/ui/inc/tbzoomsliderctrl.hxx index 442202ddff60..0768db7dba2f 100644 --- a/sc/source/ui/inc/tbzoomsliderctrl.hxx +++ b/sc/source/ui/inc/tbzoomsliderctrl.hxx @@ -34,7 +34,7 @@ public: virtual ~ScZoomSliderControl(); virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; class ScZoomSliderWnd: public vcl::Window diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 225b0038d23f..5dc88fc466b6 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -537,7 +537,7 @@ VclPtr<SfxTabPage> ScPreviewShell::CreatePrintOptionsPage( vcl::Window *pParent, OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT ); if ( ScTpPrintOptionsCreate ) - return VclPtr<SfxTabPage>((*ScTpPrintOptionsCreate)( pParent, &rOptions) + return VclPtr<SfxTabPage>((*ScTpPrintOptionsCreate)( pParent, &rOptions), SAL_NO_ACQUIRE); return VclPtr<SfxTabPage>(); } diff --git a/sd/source/ui/dlg/diactrl.cxx b/sd/source/ui/dlg/diactrl.cxx index 41c2754c2a4f..e2307ac7c2c8 100644 --- a/sd/source/ui/dlg/diactrl.cxx +++ b/sd/source/ui/dlg/diactrl.cxx @@ -132,9 +132,9 @@ void SdTbxCtlDiaPages::StateChanged( sal_uInt16, } } -vcl::Window* SdTbxCtlDiaPages::CreateItemWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> SdTbxCtlDiaPages::CreateItemWindow( vcl::Window* pParent ) { - return new SdPagesField( pParent, m_xFrame ); + return VclPtrInstance<SdPagesField>( pParent, m_xFrame ).get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx index b21f7104b53c..181dd7af049f 100644 --- a/sd/source/ui/dlg/gluectrl.cxx +++ b/sd/source/ui/dlg/gluectrl.cxx @@ -160,14 +160,12 @@ void SdTbxCtlGlueEscDir::StateChanged( sal_uInt16 nSId, SfxToolBoxControl::StateChanged( nSId, eState, pState ); } -vcl::Window* SdTbxCtlGlueEscDir::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SdTbxCtlGlueEscDir::CreateItemWindow( vcl::Window *pParent ) { if( GetSlotId() == SID_GLUE_ESCDIR ) - { - return new GlueEscDirLB( pParent, m_xFrame ); - } + return VclPtr<GlueEscDirLB>::Create( pParent, m_xFrame ).get(); - return NULL; + return VclPtr<vcl::Window>(); } /** diff --git a/sd/source/ui/inc/diactrl.hxx b/sd/source/ui/inc/diactrl.hxx index fdb61e8dca23..a6f6006445ad 100644 --- a/sd/source/ui/inc/diactrl.hxx +++ b/sd/source/ui/inc/diactrl.hxx @@ -55,7 +55,7 @@ class SdTbxCtlDiaPages : public SfxToolBoxControl public: virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; SFX_DECL_TOOLBOX_CONTROL(); diff --git a/sd/source/ui/inc/gluectrl.hxx b/sd/source/ui/inc/gluectrl.hxx index d3b2e0a8055b..fde273c0aaa3 100644 --- a/sd/source/ui/inc/gluectrl.hxx +++ b/sd/source/ui/inc/gluectrl.hxx @@ -51,7 +51,7 @@ private: public: virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; SFX_DECL_TOOLBOX_CONTROL(); diff --git a/sfx2/inc/inettbc.hxx b/sfx2/inc/inettbc.hxx index 9bcfe6aeed57..dcc6b1120076 100644 --- a/sfx2/inc/inettbc.hxx +++ b/sfx2/inc/inettbc.hxx @@ -53,7 +53,7 @@ public: SfxURLToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); virtual ~SfxURLToolBoxControl_Impl(); - virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; }; diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index 29a5168987f0..81f89fbf3aa3 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -152,13 +152,12 @@ IMPL_STATIC_LINK_NOINSTANCE( SfxURLToolBoxControl_Impl, ExecuteHdl_Impl, Execute } -vcl::Window* SfxURLToolBoxControl_Impl::CreateItemWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> SfxURLToolBoxControl_Impl::CreateItemWindow( vcl::Window* pParent ) { - SvtURLBox* pURLBox = new SvtURLBox( pParent ); + VclPtrInstance<SvtURLBox> pURLBox( pParent ); pURLBox->SetOpenHdl( LINK( this, SfxURLToolBoxControl_Impl, OpenHdl ) ); pURLBox->SetSelectHdl( LINK( this, SfxURLToolBoxControl_Impl, SelectHdl ) ); - - return pURLBox; + return pURLBox.get(); } IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, SelectHdl) diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 4fedbfaa334d..f229d8d6a5ab 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -989,9 +989,9 @@ SfxPopupWindow* SfxToolBoxControl::CreatePopupWindowCascading() -vcl::Window* SfxToolBoxControl::CreateItemWindow( vcl::Window * ) +VclPtr<vcl::Window> SfxToolBoxControl::CreateItemWindow( vcl::Window * ) { - return 0; + return VclPtr<vcl::Window>(); } diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx index 6cd514a4aab4..98e4ea2111d9 100644 --- a/svx/source/form/tbxform.cxx +++ b/svx/source/form/tbxform.cxx @@ -270,11 +270,11 @@ void SvxFmTbxCtlAbsRec::StateChanged( sal_uInt16 nSID, SfxItemState eState, cons } -vcl::Window* SvxFmTbxCtlAbsRec::CreateItemWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> SvxFmTbxCtlAbsRec::CreateItemWindow( vcl::Window* pParent ) { - SvxFmAbsRecWin* pWin = new SvxFmAbsRecWin( pParent, this ); + VclPtrInstance<SvxFmAbsRecWin> pWin( pParent, this ); pWin->SetUniqueId( UID_ABSOLUTE_RECORD_WINDOW ); - return pWin; + return pWin.get(); } SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecText, SfxBoolItem ); @@ -290,10 +290,10 @@ SvxFmTbxCtlRecText::~SvxFmTbxCtlRecText() } -vcl::Window* SvxFmTbxCtlRecText::CreateItemWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> SvxFmTbxCtlRecText::CreateItemWindow( vcl::Window* pParent ) { OUString aText(SVX_RESSTR(RID_STR_REC_TEXT)); - FixedText* pFixedText = new FixedText( pParent ); + VclPtrInstance<FixedText> pFixedText( pParent ); Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) ); pFixedText->SetText( aText ); aSize.Width() += 6; @@ -316,16 +316,16 @@ SvxFmTbxCtlRecFromText::~SvxFmTbxCtlRecFromText() } -vcl::Window* SvxFmTbxCtlRecFromText::CreateItemWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> SvxFmTbxCtlRecFromText::CreateItemWindow( vcl::Window* pParent ) { OUString aText(SVX_RESSTR(RID_STR_REC_FROM_TEXT)); - FixedText* pFixedText = new FixedText( pParent, WB_CENTER ); + VclPtrInstance<FixedText> pFixedText( pParent, WB_CENTER ); Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) ); aSize.Width() += 12; pFixedText->SetText( aText ); pFixedText->SetSizePixel( aSize ); pFixedText->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); - return pFixedText; + return pFixedText.get(); } SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecTotal, SfxStringItem ); @@ -343,9 +343,9 @@ SvxFmTbxCtlRecTotal::~SvxFmTbxCtlRecTotal() } -vcl::Window* SvxFmTbxCtlRecTotal::CreateItemWindow( vcl::Window* pParent ) +VclPtr<vcl::Window> SvxFmTbxCtlRecTotal::CreateItemWindow( vcl::Window* pParent ) { - pFixedText = new FixedText( pParent ); + pFixedText.reset(VclPtr<FixedText>::Create( pParent )); OUString aSample("123456"); Size aSize( pFixedText->GetTextWidth( aSample ), pFixedText->GetTextHeight( ) ); aSize.Width() += 12; diff --git a/svx/source/inc/tbxform.hxx b/svx/source/inc/tbxform.hxx index 0014ba65d4b9..a1877d87bfe6 100644 --- a/svx/source/inc/tbxform.hxx +++ b/svx/source/inc/tbxform.hxx @@ -71,7 +71,7 @@ public: SvxFmTbxCtlAbsRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); virtual ~SvxFmTbxCtlAbsRec(); - virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; @@ -86,7 +86,7 @@ public: SvxFmTbxCtlRecText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); virtual ~SvxFmTbxCtlRecText(); - virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; }; @@ -98,7 +98,7 @@ public: SvxFmTbxCtlRecFromText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); virtual ~SvxFmTbxCtlRecFromText(); - virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; }; @@ -112,7 +112,7 @@ public: SvxFmTbxCtlRecTotal( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); virtual ~SvxFmTbxCtlRecTotal(); - virtual vcl::Window* CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) SAL_OVERRIDE; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; }; diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index bd0ca3900705..54c960442ac9 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -502,11 +502,11 @@ void SvxFillToolBoxControl::Update(const SfxPoolItem* pState) } } -vcl::Window* SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent) +VclPtr<vcl::Window> SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent) { if(GetSlotId() == SID_ATTR_FILL_STYLE) { - mpFillControl = new FillControl(pParent); + mpFillControl.reset(VclPtr<FillControl>::Create(pParent)); // Thus the FillControl is known by SvxFillToolBoxControl // (and in order to remain compatible) mpFillControl->SetData(this); @@ -528,9 +528,9 @@ vcl::Window* SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent) mpStyleItem = new XFillStyleItem(drawing::FillStyle_SOLID); } - return mpFillControl; + return mpFillControl.get(); } - return NULL; + return VclPtr<vcl::Window>(); } FillControl::FillControl(vcl::Window* pParent,WinBits nStyle) diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index c7306c0d7a00..c73aedd75038 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.cxx @@ -487,9 +487,9 @@ void SvxGrafToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const } } -vcl::Window* SvxGrafToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SvxGrafToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - return( new ImplGrafControl( pParent, m_aCommandURL, m_xFrame ) ); + return VclPtr<ImplGrafControl>::Create( pParent, m_aCommandURL, m_xFrame ).get(); } SFX_IMPL_TOOLBOX_CONTROL( SvxGrafRedToolBoxControl, SfxInt16Item ); @@ -574,9 +574,9 @@ void SvxGrafModeToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, c } } -vcl::Window* SvxGrafModeToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SvxGrafModeToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - return( new ImplGrafModeControl( pParent, m_xFrame ) ); + return VclPtr<ImplGrafModeControl>::Create( pParent, m_xFrame ).get(); } void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView ) diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index fb591df68d04..8a360f5178ad 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -183,9 +183,9 @@ void SvxLineStyleToolBoxControl::Update( const SfxPoolItem* pState ) -vcl::Window* SvxLineStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SvxLineStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - return new SvxLineBox( pParent, m_xFrame ); + return VclPtr<SvxLineBox>::Create( pParent, m_xFrame ).get(); } SvxLineWidthToolBoxControl::SvxLineWidthToolBoxControl( @@ -244,9 +244,9 @@ void SvxLineWidthToolBoxControl::StateChanged( -vcl::Window* SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - return( new SvxMetricField( pParent, m_xFrame ) ); + return VclPtr<SvxMetricField>::Create( pParent, m_xFrame ).get(); } SvxLineEndWindow::SvxLineEndWindow( diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index db4067ce8430..f9d8ce8f5262 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2374,22 +2374,22 @@ void SvxStyleToolBoxControl::StateChanged( Update(); } -vcl::Window* SvxStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent ) -{ - SvxStyleBox_Impl* pBox = new SvxStyleBox_Impl( pParent, - OUString( ".uno:StyleApply" ), - SFX_STYLE_FAMILY_PARA, - Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), - m_xFrame, - pImpl->aClearForm, - pImpl->aMore, - pImpl->bSpecModeWriter || pImpl->bSpecModeCalc ); +VclPtr<vcl::Window> SvxStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +{ + VclPtrInstance<SvxStyleBox_Impl> pBox( pParent, + OUString( ".uno:StyleApply" ), + SFX_STYLE_FAMILY_PARA, + Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), + m_xFrame, + pImpl->aClearForm, + pImpl->aMore, + pImpl->bSpecModeWriter || pImpl->bSpecModeCalc ); if( !pImpl->aDefaultStyles.empty()) pBox->SetDefaultStyle( pImpl->aDefaultStyles[0] ); // Set visibility listener to bind/unbind controller pBox->SetVisibilityListener( LINK( this, SvxStyleToolBoxControl, VisibilityNotification )); - return pBox; + return pBox.get(); } SvxFontNameToolBoxControl::SvxFontNameToolBoxControl( @@ -2434,12 +2434,12 @@ void SvxFontNameToolBoxControl::StateChanged( rTbx.EnableItem( nId, SfxItemState::DISABLED != eState ); } -vcl::Window* SvxFontNameToolBoxControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SvxFontNameToolBoxControl::CreateItemWindow( vcl::Window *pParent ) { - SvxFontNameBox_Impl* pBox = new SvxFontNameBox_Impl( pParent, - Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), - m_xFrame,0); - return pBox; + VclPtrInstance<SvxFontNameBox_Impl> pBox( pParent, + Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), + m_xFrame,0); + return pBox.get(); } /* Note: diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx index ba68c1f04d97..201510ccabc7 100644 --- a/sw/source/uibase/inc/workctrl.hxx +++ b/sw/source/uibase/inc/workctrl.hxx @@ -181,7 +181,7 @@ public: SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; + virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index 8fe62f95f5ca..3b5bc23807f5 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -716,10 +716,10 @@ void SwPreviewZoomControl::StateChanged( sal_uInt16 /*nSID*/, } } -vcl::Window* SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent ) +VclPtr<vcl::Window> SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent ) { - SwZoomBox_Impl* pRet = new SwZoomBox_Impl( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY )); - return pRet; + VclPtrInstance<SwZoomBox_Impl> pRet( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY )); + return pRet.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |