make CreateItemWindow return a VclPtr<>.

Change-Id: Id15ff8900376aaee4343d7ee08ae062e1c462ce4
This commit is contained in:
Michael Meeks
2015-04-16 21:05:18 +01:00
parent 384e705a9e
commit d24f93dcf0
28 changed files with 82 additions and 85 deletions

View File

@@ -40,7 +40,7 @@ namespace avmedia
MediaPlayer::MediaPlayer( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* _pBindings, SfxChildWinInfo* pInfo ) : MediaPlayer::MediaPlayer( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* _pBindings, SfxChildWinInfo* pInfo ) :
SfxChildWindow( _pParent, nId ) SfxChildWindow( _pParent, nId )
{ {
pWindow = VclPtr<MediaFloater>::Create( _pBindings, this, _pParent ); pWindow.reset( VclPtr<MediaFloater>::Create( _pBindings, this, _pParent ) );
eChildAlignment = SfxChildAlignment::NOALIGNMENT; eChildAlignment = SfxChildAlignment::NOALIGNMENT;
static_cast< MediaFloater* >( pWindow.get() )->Initialize( pInfo ); static_cast< MediaFloater* >( pWindow.get() )->Initialize( pInfo );
}; };

View File

@@ -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 );
} }

View File

@@ -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 ----------------------------------------------- // class basctl::LanguageBox -----------------------------------------------

View File

@@ -36,7 +36,7 @@ public:
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE; 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 /** 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 ); LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; 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 class LanguageBox : public DocListenerBox

View File

@@ -45,7 +45,7 @@ public:
virtual ~MediaToolBoxControl(); virtual ~MediaToolBoxControl();
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; 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: private:

View File

@@ -203,7 +203,7 @@ protected:
virtual SfxPopupWindowType GetPopupWindowType() const; virtual SfxPopupWindowType GetPopupWindowType() const;
virtual SfxPopupWindow* CreatePopupWindow(); virtual SfxPopupWindow* CreatePopupWindow();
virtual SfxPopupWindow* CreatePopupWindowCascading(); 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 // Must be called by subclass to set a new popup window instance
void SetPopupWindow( SfxPopupWindow* pWindow ); void SetPopupWindow( SfxPopupWindow* pWindow );
@@ -306,7 +306,7 @@ class SfxDragToolBoxControl_Impl : public SfxToolBoxControl
public: public:
SFX_DECL_TOOLBOX_CONTROL(); SFX_DECL_TOOLBOX_CONTROL();
SfxDragToolBoxControl_Impl( sal_uInt16 nId, ToolBox& rBox ); 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; virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE;
}; };

View File

@@ -67,7 +67,7 @@ public:
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE; virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE;
void Update(const SfxPoolItem* pState); void Update(const SfxPoolItem* pState);
virtual vcl::Window* CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE; virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) SAL_OVERRIDE;
}; };

View File

@@ -68,7 +68,7 @@ public:
virtual ~SvxGrafToolBoxControl(); virtual ~SvxGrafToolBoxControl();
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; 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 ~SvxGrafModeToolBoxControl();
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; 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;
}; };

View File

@@ -52,7 +52,7 @@ public:
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE; const SfxPoolItem* pState ) SAL_OVERRIDE;
void Update( const SfxPoolItem* pState ); 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, virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE; const SfxPoolItem* pState ) SAL_OVERRIDE;
virtual vcl::Window* CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE; virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
}; };

View File

@@ -163,7 +163,7 @@ public:
SvxStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox); SvxStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
virtual ~SvxStyleToolBoxControl(); 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, virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState) SAL_OVERRIDE; const SfxPoolItem* pState) SAL_OVERRIDE;
@@ -210,7 +210,7 @@ public:
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState) SAL_OVERRIDE; 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 class BorderColorStatus

View File

@@ -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. // #i98000# Don't try to get a value via SfxViewFrame::Current here.
// The view's value is always notified via StateChanged later. // 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::Reference< ::com::sun::star::frame::XDispatchProvider >( m_xFrame->getController(),
::com::sun::star::uno::UNO_QUERY ), m_xFrame, 100 ); ::com::sun::star::uno::UNO_QUERY ), m_xFrame, 100 );
return pSlider; return pSlider.get();
} }
struct ScZoomSliderWnd::ScZoomSliderWnd_Impl struct ScZoomSliderWnd::ScZoomSliderWnd_Impl

View File

@@ -34,7 +34,7 @@ public:
virtual ~ScZoomSliderControl(); virtual ~ScZoomSliderControl();
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; 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 class ScZoomSliderWnd: public vcl::Window

View File

@@ -537,7 +537,7 @@ VclPtr<SfxTabPage> ScPreviewShell::CreatePrintOptionsPage( vcl::Window *pParent,
OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT ); ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_PRINT );
if ( ScTpPrintOptionsCreate ) if ( ScTpPrintOptionsCreate )
return VclPtr<SfxTabPage>((*ScTpPrintOptionsCreate)( pParent, &rOptions) return VclPtr<SfxTabPage>((*ScTpPrintOptionsCreate)( pParent, &rOptions),
SAL_NO_ACQUIRE); SAL_NO_ACQUIRE);
return VclPtr<SfxTabPage>(); return VclPtr<SfxTabPage>();
} }

View File

@@ -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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -160,14 +160,12 @@ void SdTbxCtlGlueEscDir::StateChanged( sal_uInt16 nSId,
SfxToolBoxControl::StateChanged( nSId, eState, pState ); 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 ) if( GetSlotId() == SID_GLUE_ESCDIR )
{ return VclPtr<GlueEscDirLB>::Create( pParent, m_xFrame ).get();
return new GlueEscDirLB( pParent, m_xFrame );
}
return NULL; return VclPtr<vcl::Window>();
} }
/** /**

View File

@@ -55,7 +55,7 @@ class SdTbxCtlDiaPages : public SfxToolBoxControl
public: public:
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE; 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(); SFX_DECL_TOOLBOX_CONTROL();

View File

@@ -51,7 +51,7 @@ private:
public: public:
virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE; 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(); SFX_DECL_TOOLBOX_CONTROL();

View File

@@ -53,7 +53,7 @@ public:
SfxURLToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); SfxURLToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox );
virtual ~SfxURLToolBoxControl_Impl(); 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; virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
}; };

View File

@@ -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->SetOpenHdl( LINK( this, SfxURLToolBoxControl_Impl, OpenHdl ) );
pURLBox->SetSelectHdl( LINK( this, SfxURLToolBoxControl_Impl, SelectHdl ) ); pURLBox->SetSelectHdl( LINK( this, SfxURLToolBoxControl_Impl, SelectHdl ) );
return pURLBox.get();
return pURLBox;
} }
IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, SelectHdl) IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, SelectHdl)

View File

@@ -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>();
} }

View File

@@ -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 ); pWin->SetUniqueId( UID_ABSOLUTE_RECORD_WINDOW );
return pWin; return pWin.get();
} }
SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecText, SfxBoolItem ); 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)); OUString aText(SVX_RESSTR(RID_STR_REC_TEXT));
FixedText* pFixedText = new FixedText( pParent ); VclPtrInstance<FixedText> pFixedText( pParent );
Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) ); Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) );
pFixedText->SetText( aText ); pFixedText->SetText( aText );
aSize.Width() += 6; 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)); 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( ) ); Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) );
aSize.Width() += 12; aSize.Width() += 12;
pFixedText->SetText( aText ); pFixedText->SetText( aText );
pFixedText->SetSizePixel( aSize ); pFixedText->SetSizePixel( aSize );
pFixedText->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); pFixedText->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
return pFixedText; return pFixedText.get();
} }
SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecTotal, SfxStringItem ); 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"); OUString aSample("123456");
Size aSize( pFixedText->GetTextWidth( aSample ), pFixedText->GetTextHeight( ) ); Size aSize( pFixedText->GetTextWidth( aSample ), pFixedText->GetTextHeight( ) );
aSize.Width() += 12; aSize.Width() += 12;

View File

@@ -71,7 +71,7 @@ public:
SvxFmTbxCtlAbsRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); SvxFmTbxCtlAbsRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual ~SvxFmTbxCtlAbsRec(); 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, virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE; const SfxPoolItem* pState ) SAL_OVERRIDE;
@@ -86,7 +86,7 @@ public:
SvxFmTbxCtlRecText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); SvxFmTbxCtlRecText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual ~SvxFmTbxCtlRecText(); 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 ); SvxFmTbxCtlRecFromText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual ~SvxFmTbxCtlRecFromText(); 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 ); SvxFmTbxCtlRecTotal( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual ~SvxFmTbxCtlRecTotal(); 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, virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE; const SfxPoolItem* pState ) SAL_OVERRIDE;
}; };

View File

@@ -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) if(GetSlotId() == SID_ATTR_FILL_STYLE)
{ {
mpFillControl = new FillControl(pParent); mpFillControl.reset(VclPtr<FillControl>::Create(pParent));
// Thus the FillControl is known by SvxFillToolBoxControl // Thus the FillControl is known by SvxFillToolBoxControl
// (and in order to remain compatible) // (and in order to remain compatible)
mpFillControl->SetData(this); mpFillControl->SetData(this);
@@ -528,9 +528,9 @@ vcl::Window* SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent)
mpStyleItem = new XFillStyleItem(drawing::FillStyle_SOLID); mpStyleItem = new XFillStyleItem(drawing::FillStyle_SOLID);
} }
return mpFillControl; return mpFillControl.get();
} }
return NULL; return VclPtr<vcl::Window>();
} }
FillControl::FillControl(vcl::Window* pParent,WinBits nStyle) FillControl::FillControl(vcl::Window* pParent,WinBits nStyle)

View File

@@ -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 ); 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 ) void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )

View File

@@ -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( 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( SvxLineEndWindow::SvxLineEndWindow(

View File

@@ -2374,22 +2374,22 @@ void SvxStyleToolBoxControl::StateChanged(
Update(); Update();
} }
vcl::Window* SvxStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent ) VclPtr<vcl::Window> SvxStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent )
{ {
SvxStyleBox_Impl* pBox = new SvxStyleBox_Impl( pParent, VclPtrInstance<SvxStyleBox_Impl> pBox( pParent,
OUString( ".uno:StyleApply" ), OUString( ".uno:StyleApply" ),
SFX_STYLE_FAMILY_PARA, SFX_STYLE_FAMILY_PARA,
Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
m_xFrame, m_xFrame,
pImpl->aClearForm, pImpl->aClearForm,
pImpl->aMore, pImpl->aMore,
pImpl->bSpecModeWriter || pImpl->bSpecModeCalc ); pImpl->bSpecModeWriter || pImpl->bSpecModeCalc );
if( !pImpl->aDefaultStyles.empty()) if( !pImpl->aDefaultStyles.empty())
pBox->SetDefaultStyle( pImpl->aDefaultStyles[0] ); pBox->SetDefaultStyle( pImpl->aDefaultStyles[0] );
// Set visibility listener to bind/unbind controller // Set visibility listener to bind/unbind controller
pBox->SetVisibilityListener( LINK( this, SvxStyleToolBoxControl, VisibilityNotification )); pBox->SetVisibilityListener( LINK( this, SvxStyleToolBoxControl, VisibilityNotification ));
return pBox; return pBox.get();
} }
SvxFontNameToolBoxControl::SvxFontNameToolBoxControl( SvxFontNameToolBoxControl::SvxFontNameToolBoxControl(
@@ -2434,12 +2434,12 @@ void SvxFontNameToolBoxControl::StateChanged(
rTbx.EnableItem( nId, SfxItemState::DISABLED != eState ); 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, VclPtrInstance<SvxFontNameBox_Impl> pBox( pParent,
Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
m_xFrame,0); m_xFrame,0);
return pBox; return pBox.get();
} }
/* Note: /* Note:

View File

@@ -181,7 +181,7 @@ public:
SfxItemState eState, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE; 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 #endif

View File

@@ -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 )); VclPtrInstance<SwZoomBox_Impl> pRet( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ));
return pRet; return pRet.get();
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */