From 3f72218069f6f78a3ba21c40f00240d78cbe65c7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 3 Jun 2015 12:02:36 +0200 Subject: Apply new VclPtr clang plugin to catch potential problems. Omit the plugin, and sw's FrameControlsManager for now. Change-Id: Ifb98a2e6e03a9d099efc1668305b96bd9142ca5f Reviewed-on: https://gerrit.libreoffice.org/16117 Tested-by: Jenkins Reviewed-by: Michael Meeks Tested-by: Michael Meeks --- basctl/source/basicide/basdoc.cxx | 2 +- basic/source/runtime/inputbox.cxx | 2 +- basic/source/runtime/iosys.cxx | 2 +- cui/source/customize/cfg.cxx | 5 +++-- cui/source/dialogs/hltpbase.cxx | 2 +- cui/source/inc/align.hxx | 1 + cui/source/inc/autocdlg.hxx | 3 +++ cui/source/inc/backgrnd.hxx | 1 + cui/source/inc/border.hxx | 1 + cui/source/inc/chardlg.hxx | 4 ++++ cui/source/inc/grfpage.hxx | 1 + cui/source/inc/numfmt.hxx | 1 + cui/source/inc/optlingu.hxx | 1 + cui/source/inc/page.hxx | 1 + cui/source/inc/paragrph.hxx | 4 ++++ cui/source/inc/tabstpge.hxx | 1 + cui/source/options/dbregister.cxx | 2 +- cui/source/options/optinet2.cxx | 2 +- cui/source/options/optinet2.hxx | 2 +- cui/source/options/optlingu.cxx | 3 +-- cui/source/tabpages/align.cxx | 3 +-- cui/source/tabpages/autocdlg.cxx | 7 +++---- cui/source/tabpages/backgrnd.cxx | 2 +- cui/source/tabpages/border.cxx | 3 +-- cui/source/tabpages/chardlg.cxx | 12 ++++-------- cui/source/tabpages/grfpage.cxx | 3 +-- cui/source/tabpages/macroass.cxx | 2 +- cui/source/tabpages/numfmt.cxx | 2 +- cui/source/tabpages/page.cxx | 4 ++-- cui/source/tabpages/paragrph.cxx | 8 ++++---- cui/source/tabpages/tabstpge.cxx | 2 +- cui/source/tabpages/tpcolor.cxx | 2 +- dbaccess/source/ui/app/AppDetailPageHelper.cxx | 2 +- dbaccess/source/ui/dlg/ConnectionPage.cxx | 2 +- dbaccess/source/ui/dlg/ConnectionPage.hxx | 1 + dbaccess/source/ui/dlg/ConnectionPageSetup.cxx | 10 +++++----- dbaccess/source/ui/dlg/ConnectionPageSetup.hxx | 1 + dbaccess/source/ui/dlg/UserAdmin.cxx | 2 +- dbaccess/source/ui/dlg/UserAdmin.hxx | 1 + dbaccess/source/ui/querydesign/querycontroller.cxx | 2 +- desktop/source/splash/splash.cxx | 2 +- extensions/source/bibliography/bibload.cxx | 4 ++-- framework/source/services/tabwindowservice.cxx | 2 +- include/vcl/layout.hxx | 2 +- sc/source/filter/oox/worksheethelper.cxx | 6 +++--- sc/source/ui/attrdlg/tabpages.cxx | 2 +- sc/source/ui/cctrl/checklistmenu.cxx | 2 +- sc/source/ui/dbgui/tpsubt.cxx | 14 ++++++++++---- sc/source/ui/dbgui/validate.cxx | 2 +- sc/source/ui/docshell/tpstat.cxx | 2 +- sc/source/ui/inc/scuitphfedit.hxx | 4 ++++ sc/source/ui/inc/tabpages.hxx | 1 + sc/source/ui/inc/tpcalc.hxx | 1 + sc/source/ui/inc/tpcompatibility.hxx | 1 + sc/source/ui/inc/tpdefaults.hxx | 1 + sc/source/ui/inc/tpformula.hxx | 1 + sc/source/ui/inc/tphf.hxx | 2 ++ sc/source/ui/inc/tpprint.hxx | 1 + sc/source/ui/inc/tpstat.hxx | 1 + sc/source/ui/inc/tpsubt.hxx | 4 ++++ sc/source/ui/inc/tptable.hxx | 1 + sc/source/ui/inc/tpusrlst.hxx | 1 + sc/source/ui/inc/tpview.hxx | 2 ++ sc/source/ui/miscdlgs/filldlg.cxx | 4 +--- sc/source/ui/miscdlgs/scuiautofmt.cxx | 14 +++++++------- sc/source/ui/optdlg/tpcalc.cxx | 6 +++--- sc/source/ui/optdlg/tpcompatibility.cxx | 2 +- sc/source/ui/optdlg/tpdefaults.cxx | 2 +- sc/source/ui/optdlg/tpformula.cxx | 2 +- sc/source/ui/optdlg/tpprint.cxx | 2 +- sc/source/ui/optdlg/tpusrlst.cxx | 8 ++++---- sc/source/ui/optdlg/tpview.cxx | 4 ++-- sc/source/ui/pagedlg/scuitphfedit.cxx | 16 ++++++++++++---- sc/source/ui/pagedlg/tphf.cxx | 4 ++-- sc/source/ui/pagedlg/tptable.cxx | 2 +- sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx | 4 ++-- sc/source/ui/sidebar/ScPanelFactory.cxx | 4 ++-- sc/source/ui/view/cellsh3.cxx | 4 ++-- sc/source/ui/view/tabvwshf.cxx | 4 ++-- sd/source/ui/dlg/sddlgfact.cxx | 16 ++++++++-------- sd/source/ui/sidebar/AllMasterPagesSelector.cxx | 6 ++---- sd/source/ui/sidebar/AllMasterPagesSelector.hxx | 1 + sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx | 6 ++---- sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx | 1 + sd/source/ui/sidebar/PanelFactory.cxx | 10 +++++----- sd/source/ui/sidebar/RecentMasterPagesSelector.cxx | 6 ++---- sd/source/ui/sidebar/RecentMasterPagesSelector.hxx | 1 + sfx2/source/appl/openuriexternally.cxx | 6 +++--- sfx2/source/dialog/taskpane.cxx | 2 +- sfx2/source/doc/guisaveas.cxx | 4 ++-- sfx2/source/sidebar/ControlFactory.cxx | 4 ++-- starmath/source/dialog.cxx | 8 ++++---- svtools/source/dialogs/prnsetup.cxx | 2 +- svtools/source/uno/unoiface.cxx | 4 ++-- svx/source/dialog/fntctrl.cxx | 2 +- svx/source/dialog/srchdlg.cxx | 2 +- sw/source/ui/chrdlg/drpcps.cxx | 4 ++-- sw/source/ui/chrdlg/numpara.cxx | 3 +-- sw/source/ui/chrdlg/swuiccoll.cxx | 3 +-- sw/source/ui/config/optpage.cxx | 15 ++++++--------- sw/source/ui/envelp/envfmt.cxx | 2 +- sw/source/ui/envelp/envlop1.cxx | 2 +- sw/source/ui/envelp/envprt.cxx | 2 +- sw/source/ui/envelp/label1.cxx | 8 ++++---- sw/source/ui/envelp/labfmt.cxx | 2 +- sw/source/ui/envelp/labprt.cxx | 4 ++-- sw/source/ui/frmdlg/column.cxx | 2 +- sw/source/ui/frmdlg/frmpage.cxx | 8 ++++---- sw/source/ui/frmdlg/wrap.cxx | 2 +- sw/source/ui/index/cnttab.cxx | 2 +- sw/source/ui/misc/docfnote.cxx | 2 +- sw/source/ui/misc/impfnote.hxx | 1 + sw/source/ui/misc/pgfnote.cxx | 2 +- sw/source/ui/misc/pggrid.cxx | 2 +- sw/source/ui/table/tabledlg.cxx | 2 +- sw/source/ui/table/tautofmt.cxx | 8 ++++---- sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 4 ++-- sw/source/uibase/docvw/AnnotationWin.cxx | 2 +- sw/source/uibase/inc/optpage.hxx | 1 + sw/source/uibase/inc/pgfnote.hxx | 1 + sw/source/uibase/sidebar/PageColumnControl.cxx | 2 +- sw/source/uibase/sidebar/PageMarginControl.cxx | 2 +- sw/source/uibase/sidebar/PageOrientationControl.cxx | 2 +- sw/source/uibase/sidebar/PageSizeControl.cxx | 2 +- sw/source/uibase/sidebar/StylePresetsPanel.cxx | 2 +- sw/source/uibase/sidebar/StylePresetsPanel.hxx | 1 + sw/source/uibase/sidebar/SwPanelFactory.cxx | 4 ++-- sw/source/uibase/sidebar/ThemePanel.cxx | 2 +- sw/source/uibase/sidebar/ThemePanel.hxx | 1 + sw/source/uibase/uiview/pview.cxx | 2 +- sw/source/uibase/utlui/navipi.cxx | 3 +-- toolkit/source/awt/vclxtoolkit.cxx | 4 ++-- vcl/source/window/builder.cxx | 2 +- xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 4 ++-- 134 files changed, 247 insertions(+), 204 deletions(-) diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx index 93302febee1d..1c878d826cc4 100644 --- a/basctl/source/basicide/basdoc.cxx +++ b/basctl/source/basicide/basdoc.cxx @@ -58,7 +58,7 @@ DocShell::~DocShell() SfxPrinter* DocShell::GetPrinter( bool bCreate ) { if ( !pPrinter && bCreate ) - pPrinter.reset(new SfxPrinter(new SfxItemSet( + pPrinter.reset(VclPtr::Create(new SfxItemSet( GetPool(), SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN ))); diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx index 0e942fc5555c..e993bed63cb8 100644 --- a/basic/source/runtime/inputbox.cxx +++ b/basic/source/runtime/inputbox.cxx @@ -56,7 +56,7 @@ SvRTLInputBox::SvRTLInputBox( vcl::Window* pParent, const OUString& rPrompt, long nXTwips, long nYTwips ) : ModalDialog( pParent,WB_3DLOOK | WB_MOVEABLE | WB_CLOSEABLE ), aEdit( VclPtr::Create(this, WB_LEFT | WB_BORDER) ), - aOk( new OKButton(this) ), aCancel( new CancelButton(this) ), aPromptText( VclPtr::Create(this, WB_WORDBREAK) ) + aOk( VclPtr::Create(this) ), aCancel( VclPtr::Create(this) ), aPromptText( VclPtr::Create(this, WB_WORDBREAK) ) { SetMapMode( MapMode( MAP_APPFONT ) ); Size aDlgSizeApp( 280, 80 ); diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index cdc4248724e6..09c97638c44d 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -82,7 +82,7 @@ public: SbiInputDialog::SbiInputDialog( vcl::Window* pParent, const OUString& rPrompt ) :ModalDialog( pParent, WB_3DLOOK | WB_MOVEABLE | WB_CLOSEABLE ), aInput( VclPtr::Create(this, WB_3DLOOK | WB_LEFT | WB_BORDER) ), - aOk( new OKButton(this) ), aCancel( VclPtr::Create(this) ) + aOk( VclPtr::Create(this) ), aCancel( VclPtr::Create(this) ) { SetText( rPrompt ); aOk->SetClickHdl( LINK( this, SbiInputDialog, Ok ) ); diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index c5a1e7aa31dc..d472b7f73989 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -2118,8 +2118,9 @@ IMPL_LINK( SvxConfigPage, AsyncInfoMsg, OUString*, pMsg ) (void)pMsg; // Asynchronous msg because of D&D - MessageDialog( this, CUI_RES( - RID_SVXSTR_MNUCFG_ALREADY_INCLUDED ), VCL_MESSAGE_INFO ).Execute(); + ScopedVclPtr::Create( this, + CUI_RES( RID_SVXSTR_MNUCFG_ALREADY_INCLUDED ), + VCL_MESSAGE_INFO )->Execute(); return 0; } diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx index 44724042527d..c9b7af89df3c 100644 --- a/cui/source/dialogs/hltpbase.cxx +++ b/cui/source/dialogs/hltpbase.cxx @@ -100,7 +100,7 @@ SvxHyperlinkTabPageBase::SvxHyperlinkTabPageBase ( vcl::Window *pParent, aEmptyStr() { // create bookmark-window - mpMarkWnd = new SvxHlinkDlgMarkWnd ( this ); + mpMarkWnd = VclPtr::Create( this ); } SvxHyperlinkTabPageBase::~SvxHyperlinkTabPageBase() diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx index 10ab45233440..a667eb9a902b 100644 --- a/cui/source/inc/align.hxx +++ b/cui/source/inc/align.hxx @@ -54,6 +54,7 @@ namespace svx { class AlignmentTabPage : public SfxTabPage { using TabPage::DeactivatePage; + friend class VclPtr; static const sal_uInt16 s_pRanges[]; public: diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx index b0162208880a..c9b9b6ce2fe2 100644 --- a/cui/source/inc/autocdlg.hxx +++ b/cui/source/inc/autocdlg.hxx @@ -125,6 +125,7 @@ public: class OfaSwAutoFmtOptionsPage : public SfxTabPage { + friend class VclPtr; using TabPage::ActivatePage; VclPtr m_pCheckLB; @@ -338,6 +339,7 @@ public: class OfaQuoteTabPage : public SfxTabPage { + friend class VclPtr; using TabPage::ActivatePage; private: @@ -402,6 +404,7 @@ public: class OfaAutoCompleteTabPage : public SfxTabPage { + friend class VclPtr; public: class AutoCompleteMultiListBox : public MultiListBox { diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx index 89af13d6f0a9..633e4e6c1e9e 100644 --- a/cui/source/inc/backgrnd.hxx +++ b/cui/source/inc/backgrnd.hxx @@ -45,6 +45,7 @@ class SvxBrushItem; class SvxBackgroundTabPage : public SvxTabPage { using TabPage::DeactivatePage; + friend class VclPtr; static const sal_uInt16 pPageRanges[]; public: static VclPtr Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx index 75b438b1962a..ff7780403bbb 100644 --- a/cui/source/inc/border.hxx +++ b/cui/source/inc/border.hxx @@ -40,6 +40,7 @@ namespace editeng class SvxBorderTabPage : public SfxTabPage { + friend class VclPtr; using TabPage::DeactivatePage; static const sal_uInt16 pRanges[]; diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx index 604935024c93..4eb009af67d7 100644 --- a/cui/source/inc/chardlg.hxx +++ b/cui/source/inc/chardlg.hxx @@ -77,6 +77,7 @@ struct SvxCharNamePage_Impl; class SvxCharNamePage : public SvxCharBasePage { + friend class VclPtr; private: static const sal_uInt16 pNameRanges[]; @@ -175,6 +176,7 @@ public: class SvxCharEffectsPage : public SvxCharBasePage { + friend class VclPtr; private: static const sal_uInt16 pEffectsRanges[]; @@ -254,6 +256,7 @@ public: class SvxCharPositionPage : public SvxCharBasePage { + friend class VclPtr; static const sal_uInt16 pPositionRanges[]; private: @@ -333,6 +336,7 @@ public: class SvxCharTwoLinesPage : public SvxCharBasePage { + friend class VclPtr; private: static const sal_uInt16 pTwoLinesRanges[]; VclPtr m_pTwoLinesBtn; diff --git a/cui/source/inc/grfpage.hxx b/cui/source/inc/grfpage.hxx index 47fb0e9425a7..47ac00007c03 100644 --- a/cui/source/inc/grfpage.hxx +++ b/cui/source/inc/grfpage.hxx @@ -52,6 +52,7 @@ public: class SvxGrfCropPage : public SfxTabPage { + friend class VclPtr; using Window::CalcZoom; using TabPage::ActivatePage; using TabPage::DeactivatePage; diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx index c4413ab894fd..0c3e21295c41 100644 --- a/cui/source/inc/numfmt.hxx +++ b/cui/source/inc/numfmt.hxx @@ -65,6 +65,7 @@ public: class SvxNumberFormatTabPage : public SfxTabPage { + friend class VclPtr; using SfxTabPage::DeactivatePage; static const sal_uInt16 pRanges[]; diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx index 73d9aceac4f4..96a02388f8f4 100644 --- a/cui/source/inc/optlingu.hxx +++ b/cui/source/inc/optlingu.hxx @@ -93,6 +93,7 @@ public: class SvxLinguTabPage : public SfxTabPage { + friend class VclPtr; private: VclPtr m_pLinguModulesFT; VclPtr m_pLinguModulesCLB; diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx index f68bf339bab7..c7b6436e551d 100644 --- a/cui/source/inc/page.hxx +++ b/cui/source/inc/page.hxx @@ -69,6 +69,7 @@ typedef sal_uInt16 MarginPosition; class SvxPageDescPage : public SfxTabPage { + friend class VclPtr; using TabPage::ActivatePage; using TabPage::DeactivatePage; diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx index 0c55af1988e2..db939787629c 100644 --- a/cui/source/inc/paragrph.hxx +++ b/cui/source/inc/paragrph.hxx @@ -45,6 +45,7 @@ class SvxLineSpacingItem; class SvxStdParagraphTabPage: public SfxTabPage { + friend class VclPtr; using TabPage::DeactivatePage; static const sal_uInt16 pStdRanges[]; @@ -124,6 +125,7 @@ public: class SvxParaAlignTabPage : public SfxTabPage { + friend class VclPtr; using TabPage::DeactivatePage; static const sal_uInt16 pAlignRanges[]; @@ -191,6 +193,7 @@ public: class SvxExtParagraphTabPage: public SfxTabPage { + friend class VclPtr; using TabPage::DeactivatePage; static const sal_uInt16 pExtRanges[]; @@ -265,6 +268,7 @@ private: class SvxAsianTabPage : public SfxTabPage { + friend class VclPtr; VclPtr m_pForbiddenRulesCB; VclPtr m_pHangingPunctCB; diff --git a/cui/source/inc/tabstpge.hxx b/cui/source/inc/tabstpge.hxx index 05903afd03a4..d73e9635a813 100644 --- a/cui/source/inc/tabstpge.hxx +++ b/cui/source/inc/tabstpge.hxx @@ -45,6 +45,7 @@ class TabWin_Impl; class SvxTabulatorTabPage : public SfxTabPage { + friend class VclPtr; using TabPage::DeactivatePage; static const sal_uInt16 pRanges[]; diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx index 3bf5f84bd16d..b482e8bed3fb 100644 --- a/cui/source/options/dbregister.cxx +++ b/cui/source/options/dbregister.cxx @@ -125,7 +125,7 @@ DbRegistrationOptionsPage::DbRegistrationOptionsPage( vcl::Window* pParent, cons Size aBoxSize = m_pPathCtrl->GetOutputSizePixel(); WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP; - pPathBox = new svx::OptHeaderTabListBox( *m_pPathCtrl, nBits ); + pPathBox = VclPtr::Create( *m_pPathCtrl, nBits ); HeaderBar &rBar = pPathBox->GetTheHeaderBar(); diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 62989f32822c..a3c72ff37eef 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -912,7 +912,7 @@ void SvxSecurityTabPage::InitControls() VclPtr SvxSecurityTabPage::Create(vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr(new SvxSecurityTabPage(pParent, *rAttrSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rAttrSet); } void SvxSecurityTabPage::ActivatePage( const SfxItemSet& ) diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx index 15403a16082a..c23dc7be8c87 100644 --- a/cui/source/options/optinet2.hxx +++ b/cui/source/options/optinet2.hxx @@ -128,7 +128,7 @@ class SvxSecurityTabPage : public SfxTabPage { using TabPage::ActivatePage; using TabPage::DeactivatePage; - + friend class VclPtr; private: VclPtr m_pSecurityOptionsPB; diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 3c535f85e544..cafbe1180deb 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -1153,8 +1153,7 @@ void SvxLinguTabPage::dispose() VclPtr SvxLinguTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr( new SvxLinguTabPage( pParent, *rAttrSet ), - SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rAttrSet ); } diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index 94012e5dc25e..cad777dfcc7a 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -286,8 +286,7 @@ void AlignmentTabPage::dispose() VclPtr AlignmentTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr( new AlignmentTabPage( pParent, *rAttrSet ), - SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rAttrSet ); } bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet ) diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index ce474e3dd7bb..37cc472dce22 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -514,7 +514,7 @@ void OfaSwAutoFmtOptionsPage::dispose() VclPtr OfaSwAutoFmtOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { - return VclPtr( new OfaSwAutoFmtOptionsPage(pParent, *rAttrSet), SAL_NO_ACQUIRE ); + return VclPtr::Create(pParent, *rAttrSet); } bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet* ) @@ -1906,8 +1906,7 @@ void OfaQuoteTabPage::dispose() VclPtr OfaQuoteTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { - return VclPtr( new OfaQuoteTabPage(pParent, *rAttrSet), - SAL_NO_ACQUIRE ); + return VclPtr::Create(pParent, *rAttrSet); } bool OfaQuoteTabPage::FillItemSet( SfxItemSet* ) @@ -2247,7 +2246,7 @@ void OfaAutoCompleteTabPage::dispose() VclPtr OfaAutoCompleteTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr( new OfaAutoCompleteTabPage( pParent, *rSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rSet ); } bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet* ) diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 8c5703cd6241..9ba70fa9758f 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -482,7 +482,7 @@ void SvxBackgroundTabPage::dispose() VclPtr SvxBackgroundTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr( new SvxBackgroundTabPage( pParent, *rAttrSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rAttrSet ); } void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 01881fe816d4..3daf13fb0317 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -372,8 +372,7 @@ void SvxBorderTabPage::dispose() VclPtr SvxBorderTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr(new SvxBorderTabPage( pParent, *rAttrSet ), - SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *rAttrSet ); } void SvxBorderTabPage::ResetFrameLine_Impl( svx::FrameBorderType eBorder, const SvxBorderLine* pCoreLine, bool bValid ) diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index ac6b7c56a8c0..8cb2b46a7511 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -1220,8 +1220,7 @@ SfxTabPage::sfxpg SvxCharNamePage::DeactivatePage( SfxItemSet* _pSet ) VclPtr SvxCharNamePage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) { - return VclPtr( new SvxCharNamePage( pParent, *rSet ), - SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rSet ); } @@ -1786,8 +1785,7 @@ SfxTabPage::sfxpg SvxCharEffectsPage::DeactivatePage( SfxItemSet* _pSet ) VclPtr SvxCharEffectsPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) { - return VclPtr( new SvxCharEffectsPage( pParent, *rSet ), - SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rSet ); } @@ -2969,8 +2967,7 @@ SfxTabPage::sfxpg SvxCharPositionPage::DeactivatePage( SfxItemSet* _pSet ) VclPtr SvxCharPositionPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) { - return VclPtr( new SvxCharPositionPage( pParent, *rSet ), - SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rSet ); } @@ -3542,8 +3539,7 @@ SfxTabPage::sfxpg SvxCharTwoLinesPage::DeactivatePage( SfxItemSet* _pSet ) VclPtr SvxCharTwoLinesPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) { - return VclPtr( new SvxCharTwoLinesPage( pParent, *rSet ), - SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rSet ); } void SvxCharTwoLinesPage::Reset( const SfxItemSet* rSet ) diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx index 4e4095a60e93..7d24012235e3 100644 --- a/cui/source/tabpages/grfpage.cxx +++ b/cui/source/tabpages/grfpage.cxx @@ -156,8 +156,7 @@ void SvxGrfCropPage::dispose() VclPtr SvxGrfCropPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return VclPtr( new SvxGrfCropPage( pParent, *rSet ), - SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rSet ); } void SvxGrfCropPage::Reset( const SfxItemSet *rSet ) diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx index 2e90ed844306..cb096cab7018 100644 --- a/cui/source/tabpages/macroass.cxx +++ b/cui/source/tabpages/macroass.cxx @@ -458,7 +458,7 @@ namespace { VclPtr CreateSfxMacroTabPage( vcl::Window* pParent, const SfxItemSet& rAttrSet ) { - return VclPtr( new SfxMacroTabPage( pParent, NULL, rAttrSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, nullptr, rAttrSet ); } } diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index a8974af76baf..54bcb270b116 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -383,7 +383,7 @@ void SvxNumberFormatTabPage::Init_Impl() VclPtr SvxNumberFormatTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr( new SvxNumberFormatTabPage( pParent, *rAttrSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rAttrSet ); } diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index 65c28c798561..7a60414d310f 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -166,7 +166,7 @@ bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize ) VclPtr SvxPageDescPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) { - return VclPtr(new SvxPageDescPage( pParent, *rSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rSet ); } SvxPageDescPage::SvxPageDescPage( vcl::Window* pParent, const SfxItemSet& rAttr ) : @@ -292,7 +292,7 @@ SvxPageDescPage::SvxPageDescPage( vcl::Window* pParent, const SfxItemSet& rAttr } else { - mpDefPrinter = new Printer; + mpDefPrinter = VclPtr::Create(); mbDelPrinter = true; } diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index d128a30060b4..111dac960a4b 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -196,7 +196,7 @@ IMPL_LINK_NOARG(SvxStdParagraphTabPage, ELRLoseFocusHdl) VclPtr SvxStdParagraphTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr( new SvxStdParagraphTabPage( pParent, *rSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rSet ); } bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) @@ -1072,7 +1072,7 @@ SfxTabPage::sfxpg SvxParaAlignTabPage::DeactivatePage( SfxItemSet* _pSet ) VclPtr SvxParaAlignTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) { - return VclPtr( new SvxParaAlignTabPage(pParent, *rSet), SAL_NO_ACQUIRE ); + return VclPtr::Create(pParent, *rSet); } bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet ) @@ -1346,7 +1346,7 @@ void SvxParaAlignTabPage::PageCreated (const SfxAllItemSet& aSet) VclPtr SvxExtParagraphTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) { - return VclPtr( new SvxExtParagraphTabPage( pParent, *rSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rSet ); } bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) @@ -2193,7 +2193,7 @@ void SvxAsianTabPage::dispose() VclPtr SvxAsianTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) { - return VclPtr(new SvxAsianTabPage(pParent, *rSet), SAL_NO_ACQUIRE ); + return VclPtr::Create(pParent, *rSet); } const sal_uInt16* SvxAsianTabPage::GetRanges() diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx index 6bef88304734..87c493b43901 100644 --- a/cui/source/tabpages/tabstpge.cxx +++ b/cui/source/tabpages/tabstpge.cxx @@ -265,7 +265,7 @@ bool SvxTabulatorTabPage::FillItemSet(SfxItemSet* rSet) VclPtr SvxTabulatorTabPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr(new SvxTabulatorTabPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } void SvxTabulatorTabPage::Reset(const SfxItemSet* rSet) diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 6319c4d47752..94231c5f0f32 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -723,7 +723,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl) if( !pWarnBox ) { - pWarnBox.reset(new MessageDialog( GetParentDialog() + pWarnBox.reset(VclPtr::Create( GetParentDialog() ,"DuplicateNameDialog" ,"cui/ui/queryduplicatedialog.ui")); } diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 557e89e82ec9..0282321f22cc 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -193,7 +193,7 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo ,m_aTBPreview(VclPtr::Create(this,WB_TABSTOP) ) ,m_aBorder(VclPtr::Create(this,WB_BORDER | WB_READONLY)) ,m_aPreview(VclPtr::Create(m_aBorder.get())) - ,m_aDocumentInfo(new ::svtools::ODocumentInfoPreview(m_aBorder.get(), WB_LEFT | WB_VSCROLL | WB_READONLY) ) + ,m_aDocumentInfo(VclPtr<::svtools::ODocumentInfoPreview>::Create(m_aBorder.get(), WB_LEFT | WB_VSCROLL | WB_READONLY) ) ,m_ePreviewMode(_ePreviewMode) { diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx index ed99f813357d..b9c8fba68944 100644 --- a/dbaccess/source/ui/dlg/ConnectionPage.cxx +++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx @@ -83,7 +83,7 @@ namespace dbaui VclPtr OConnectionTabPage::Create( vcl::Window* pParent, const SfxItemSet* _rAttrSet ) { - return VclPtr(new OConnectionTabPage( pParent, *_rAttrSet ), SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *_rAttrSet ); } // OConnectionTabPage diff --git a/dbaccess/source/ui/dlg/ConnectionPage.hxx b/dbaccess/source/ui/dlg/ConnectionPage.hxx index 2b4626d8fa08..6f373cc24426 100644 --- a/dbaccess/source/ui/dlg/ConnectionPage.hxx +++ b/dbaccess/source/ui/dlg/ConnectionPage.hxx @@ -34,6 +34,7 @@ namespace dbaui */ class OConnectionTabPage : public OConnectionHelper { + friend class VclPtr; protected: // user authentification VclPtr m_pFL2; diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx index b081ad82c565..fd82603a2c3d 100644 --- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx +++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx @@ -65,27 +65,27 @@ namespace dbaui VclPtr OConnectionTabPageSetup::CreateDbaseTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet ) { - return VclPtr( new OConnectionTabPageSetup ( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_DBASE_HELPTEXT, STR_DBASE_HEADERTEXT, STR_DBASE_PATH_OR_FILE), SAL_NO_ACQUIRE ); + return VclPtr::Create ( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_DBASE_HELPTEXT, STR_DBASE_HEADERTEXT, STR_DBASE_PATH_OR_FILE ); } VclPtr OConnectionTabPageSetup::CreateMSAccessTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet ) { - return VclPtr( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_MSACCESS_HELPTEXT, STR_MSACCESS_HEADERTEXT, STR_MSACCESS_MDB_FILE), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_MSACCESS_HELPTEXT, STR_MSACCESS_HEADERTEXT, STR_MSACCESS_MDB_FILE ); } VclPtr OConnectionTabPageSetup::CreateADOTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet ) { - return VclPtr( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ADO_HELPTEXT, STR_ADO_HEADERTEXT, STR_COMMONURL), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ADO_HELPTEXT, STR_ADO_HEADERTEXT, STR_COMMONURL ); } VclPtr OConnectionTabPageSetup::CreateODBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet ) { - return VclPtr( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ODBC_HELPTEXT, STR_ODBC_HEADERTEXT, STR_NAME_OF_ODBC_DATASOURCE), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ODBC_HELPTEXT, STR_ODBC_HEADERTEXT, STR_NAME_OF_ODBC_DATASOURCE ); } VclPtr OConnectionTabPageSetup::CreateUserDefinedTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet ) { - return VclPtr( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, USHRT_MAX, USHRT_MAX, STR_COMMONURL), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, USHRT_MAX, USHRT_MAX, STR_COMMONURL ); } OConnectionTabPageSetup::OConnectionTabPageSetup(vcl::Window* pParent, const OString& _rId, const OUString& _rUIXMLDescription, const SfxItemSet& _rCoreAttrs, sal_uInt16 _nHelpTextResId, sal_uInt16 _nHeaderResId, sal_uInt16 _nUrlResId) diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx index 1f0a22c69cf4..cad08bcff1e2 100644 --- a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx +++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx @@ -36,6 +36,7 @@ namespace dbaui */ class OConnectionTabPageSetup : public OConnectionHelper { + friend class VclPtr; bool m_bUserGrabFocus : 1; protected: diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx index ee25dd304bb1..5e9afea0f7ea 100644 --- a/dbaccess/source/ui/dlg/UserAdmin.cxx +++ b/dbaccess/source/ui/dlg/UserAdmin.cxx @@ -204,7 +204,7 @@ void OUserAdmin::FillUserNames() VclPtr OUserAdmin::Create( vcl::Window* pParent, const SfxItemSet* _rAttrSet ) { - return VclPtr(new OUserAdmin( pParent, *_rAttrSet ), SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *_rAttrSet ); } IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton ) diff --git a/dbaccess/source/ui/dlg/UserAdmin.hxx b/dbaccess/source/ui/dlg/UserAdmin.hxx index eeea260a60ee..f08b43f4dfa2 100644 --- a/dbaccess/source/ui/dlg/UserAdmin.hxx +++ b/dbaccess/source/ui/dlg/UserAdmin.hxx @@ -40,6 +40,7 @@ namespace dbaui class OUserAdmin : public OGenericAdministrationPage { + friend class VclPtr; protected: VclPtr m_pUSER; VclPtr m_pNEWUSER; diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 3b85887911a2..e7b2088f66c2 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -1058,7 +1058,7 @@ void OQueryController::impl_initialize() m_bGraphicalDesign = false; getContainer()->initialize(); ODataView* pWindow = getView(); - OSQLMessageBox(pWindow,e).Execute(); + ScopedVclPtr::Create(pWindow,e)->Execute(); } throw; } diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 63c8232a321e..d0378ad58454 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -155,7 +155,7 @@ void SplashScreenWindow::Redraw() } SplashScreen::SplashScreen() - : pWindow( new SplashScreenWindow (this) ) + : pWindow( VclPtr::Create(this) ) , _cProgressFrameColor(sal::static_int_cast< ColorData >(NOT_LOADED)) , _cProgressBarColor(sal::static_int_cast< ColorData >(NOT_LOADED)) , _cProgressTextColor(sal::static_int_cast< ColorData >(NOT_LOADED)) diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index bee83d8f3869..db810db9b134 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -276,11 +276,11 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const OUSt VclPtrInstance pMyWindow( pParent ); pMyWindow->Show(); - ::bib::BibView* pView = new ::bib::BibView( pMyWindow, m_pDatMan, WB_VSCROLL | WB_HSCROLL | WB_3DLOOK ); + VclPtrInstance<::bib::BibView> pView( pMyWindow, m_pDatMan, WB_VSCROLL | WB_HSCROLL | WB_3DLOOK ); pView->Show(); m_pDatMan->SetView( pView ); - ::bib::BibBeamer* pBeamer = new ::bib::BibBeamer( pMyWindow, m_pDatMan ); + VclPtrInstance<::bib::BibBeamer> pBeamer( pMyWindow, m_pDatMan ); pBeamer->Show(); pMyWindow->createTopFrame(pBeamer); diff --git a/framework/source/services/tabwindowservice.cxx b/framework/source/services/tabwindowservice.cxx index f93aee07ed9a..2f8bd08b631f 100644 --- a/framework/source/services/tabwindowservice.cxx +++ b/framework/source/services/tabwindowservice.cxx @@ -521,7 +521,7 @@ FwkTabWindow* TabWindowService::mem_TabWin () { vcl::Window* pFakeParent = dynamic_cast< vcl::Window* >(Application::GetDefaultDevice ()); - m_pTabWin = new FwkTabWindow (pFakeParent); + m_pTabWin = VclPtr::Create(pFakeParent); m_xTabWin = VCLUnoHelper::GetInterface (m_pTabWin); m_pTabWin->AddEventListener( LINK( this, TabWindowService, EventListener ) ); diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index 813999a794b0..fc9eb56faa6a 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -731,7 +731,7 @@ private: short get_response(const vcl::Window *pWindow) const; void create_owned_areas(); - friend class VclBuilder; + friend class VclPtr; MessageDialog(vcl::Window* pParent, WinBits nStyle = WB_MOVEABLE | WB_3DLOOK | WB_CLOSEABLE); public: diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 3dfbf8a3b663..d74f344b1f02 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -1172,9 +1172,9 @@ namespace { sal_Int32 getColumnWidth(UnitConverter& rConverter, double nWidth) { double nCoeff = rConverter.getCoefficient(UNIT_DIGIT); - VirtualDevice aDev; + ScopedVclPtrInstance aDev; - long nPixel = aDev.LogicToPixel(Point(nCoeff, 0), MapMode(MAP_100TH_MM)).getX(); + long nPixel = aDev->LogicToPixel(Point(nCoeff, 0), MapMode(MAP_100TH_MM)).getX(); // the 1.047 has been experimentally chosen based on measurements witha screen ruler @@ -1182,7 +1182,7 @@ sal_Int32 getColumnWidth(UnitConverter& rConverter, double nWidth) // algorithm from OOXML spec part1: 18.3.1.13 sal_Int32 nColWidthPixel= std::floor(((256*nWidth + std::floor(128.0/nPixel))/256.0)*nPixel) * 1.047; - return aDev.PixelToLogic(Point(nColWidthPixel, 0), MapMode(MAP_100TH_MM)).getX(); + return aDev->PixelToLogic(Point(nColWidthPixel, 0), MapMode(MAP_100TH_MM)).getX(); } } diff --git a/sc/source/ui/attrdlg/tabpages.cxx b/sc/source/ui/attrdlg/tabpages.cxx index 163b8742fc4c..d75a976303a9 100644 --- a/sc/source/ui/attrdlg/tabpages.cxx +++ b/sc/source/ui/attrdlg/tabpages.cxx @@ -75,7 +75,7 @@ void ScTabPageProtection::dispose() VclPtr ScTabPageProtection::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr( new ScTabPageProtection( pParent, *rAttrSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rAttrSet ); } void ScTabPageProtection::Reset( const SfxItemSet* rCoreAttrs ) diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 470a0b8f5782..98ba5335957c 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -873,7 +873,7 @@ void ScCheckListMenuWindow::CancelButton::Click() ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* pDoc) : ScMenuFloatingWindow(pParent, pDoc), - maEdSearch(new Edit (this)), + maEdSearch(VclPtr::Create(this)), maChecks(VclPtr::Create(this, WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT) ), maChkToggleAll(VclPtr::Create(this, 0)), maBtnSelectSingle(VclPtr::Create(this, 0)), diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index c41bbc1a07ca..e36c39f1e963 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -387,15 +387,21 @@ IMPL_LINK( ScTpSubTotalGroup, CheckHdl, void *, pLb ) VclPtr ScTpSubTotalGroup1::Create( vcl::Window* pParent, const SfxItemSet* rArgSet ) - { return VclPtr( new ScTpSubTotalGroup1( pParent, *rArgSet ), SAL_NO_ACQUIRE ); } +{ + return VclPtr::Create( pParent, *rArgSet ); +} VclPtr ScTpSubTotalGroup2::Create( vcl::Window* pParent, const SfxItemSet* rArgSet ) - { return VclPtr( new ScTpSubTotalGroup2( pParent, *rArgSet ), SAL_NO_ACQUIRE ); } +{ + return VclPtr::Create( pParent, *rArgSet ); +} VclPtr ScTpSubTotalGroup3::Create( vcl::Window* pParent, const SfxItemSet* rArgSet ) - { return VclPtr( new ScTpSubTotalGroup3( pParent, *rArgSet ), SAL_NO_ACQUIRE ); } +{ + return VclPtr::Create( pParent, *rArgSet ); +} ScTpSubTotalGroup1::ScTpSubTotalGroup1( vcl::Window* pParent, const SfxItemSet& rArgSet ) : ScTpSubTotalGroup( pParent, rArgSet ) @@ -487,7 +493,7 @@ void ScTpSubTotalOptions::Init() VclPtr ScTpSubTotalOptions::Create( vcl::Window* pParent, const SfxItemSet* rArgSet ) { - return VclPtr( new ScTpSubTotalOptions( pParent, *rArgSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rArgSet ); } void ScTpSubTotalOptions::Reset( const SfxItemSet* /* rArgSet */ ) diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 54edca1eed8a..23fb0f8df0ee 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -407,7 +407,7 @@ void ScTPValidationValue::Init() VclPtr ScTPValidationValue::Create( vcl::Window* pParent, const SfxItemSet* rArgSet ) { - return VclPtr(new ScTPValidationValue( pParent, *rArgSet ), SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *rArgSet ); } void ScTPValidationValue::Reset( const SfxItemSet* rArgSet ) diff --git a/sc/source/ui/docshell/tpstat.cxx b/sc/source/ui/docshell/tpstat.cxx index c18f331790e1..0be22a9b0428 100644 --- a/sc/source/ui/docshell/tpstat.cxx +++ b/sc/source/ui/docshell/tpstat.cxx @@ -29,7 +29,7 @@ VclPtr ScDocStatPage::Create( vcl::Window *pParent, const SfxItemSet* rSet ) { - return VclPtr( new ScDocStatPage ( pParent, *rSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rSet ); } ScDocStatPage::ScDocStatPage( vcl::Window *pParent, const SfxItemSet& rSet ) diff --git a/sc/source/ui/inc/scuitphfedit.hxx b/sc/source/ui/inc/scuitphfedit.hxx index c22ec2510525..3fddc293ddad 100644 --- a/sc/source/ui/inc/scuitphfedit.hxx +++ b/sc/source/ui/inc/scuitphfedit.hxx @@ -104,6 +104,7 @@ private: class ScRightHeaderEditPage : public ScHFEditPage { + friend class VclPtr; public: static VclPtr Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); @@ -113,6 +114,7 @@ private: class ScLeftHeaderEditPage : public ScHFEditPage { + friend class VclPtr; public: static VclPtr Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); @@ -122,6 +124,7 @@ private: class ScRightFooterEditPage : public ScHFEditPage { + friend class VclPtr; public: static VclPtr Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); @@ -131,6 +134,7 @@ private: class ScLeftFooterEditPage : public ScHFEditPage { + friend class VclPtr; public: static VclPtr Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ); diff --git a/sc/source/ui/inc/tabpages.hxx b/sc/source/ui/inc/tabpages.hxx index c2f9c38d1e66..b2c20142ac37 100644 --- a/sc/source/ui/inc/tabpages.hxx +++ b/sc/source/ui/inc/tabpages.hxx @@ -26,6 +26,7 @@ class ScTabPageProtection : public SfxTabPage { + friend class VclPtr; static const sal_uInt16 pProtectionRanges[]; public: static VclPtr Create ( vcl::Window* pParent, diff --git a/sc/source/ui/inc/tpcalc.hxx b/sc/source/ui/inc/tpcalc.hxx index 25bd390fed20..0b27e75b27b6 100644 --- a/sc/source/ui/inc/tpcalc.hxx +++ b/sc/source/ui/inc/tpcalc.hxx @@ -31,6 +31,7 @@ class ScDocOptions; class ScTpCalcOptions : public SfxTabPage { + friend class VclPtr; public: static VclPtr Create ( vcl::Window* pParent, const SfxItemSet* rCoreSet ); diff --git a/sc/source/ui/inc/tpcompatibility.hxx b/sc/source/ui/inc/tpcompatibility.hxx index 550bd9b0836c..322e50d003bb 100644 --- a/sc/source/ui/inc/tpcompatibility.hxx +++ b/sc/source/ui/inc/tpcompatibility.hxx @@ -16,6 +16,7 @@ class ScTpCompatOptions : public SfxTabPage { + friend class VclPtr; public: using SfxTabPage::DeactivatePage; diff --git a/sc/source/ui/inc/tpdefaults.hxx b/sc/source/ui/inc/tpdefaults.hxx index 429cbabde87f..deb267368baa 100644 --- a/sc/source/ui/inc/tpdefaults.hxx +++ b/sc/source/ui/inc/tpdefaults.hxx @@ -16,6 +16,7 @@ class ScTpDefaultsOptions : public SfxTabPage { + friend class VclPtr; public: using SfxTabPage::DeactivatePage; diff --git a/sc/source/ui/inc/tpformula.hxx b/sc/source/ui/inc/tpformula.hxx index 7397d062d31d..a3175b8ee1fd 100644 --- a/sc/source/ui/inc/tpformula.hxx +++ b/sc/source/ui/inc/tpformula.hxx @@ -30,6 +30,7 @@ class ScTpFormulaOptions : public SfxTabPage { + friend class VclPtr; public: using SfxTabPage::DeactivatePage; diff --git a/sc/source/ui/inc/tphf.hxx b/sc/source/ui/inc/tphf.hxx index da972cbd44a9..9f5c8a599a23 100644 --- a/sc/source/ui/inc/tphf.hxx +++ b/sc/source/ui/inc/tphf.hxx @@ -60,6 +60,7 @@ private: class ScHeaderPage : public ScHFPage { + friend class VclPtr; public: static VclPtr Create( vcl::Window* pParent, const SfxItemSet* rSet ); static const sal_uInt16* GetRanges(); @@ -70,6 +71,7 @@ private: class ScFooterPage : public ScHFPage { + friend class VclPtr; public: static VclPtr Create( vcl::Window* pParent, const SfxItemSet* rSet ); static const sal_uInt16* GetRanges(); diff --git a/sc/source/ui/inc/tpprint.hxx b/sc/source/ui/inc/tpprint.hxx index 5b8370f13267..bf38a927c3b6 100644 --- a/sc/source/ui/inc/tpprint.hxx +++ b/sc/source/ui/inc/tpprint.hxx @@ -25,6 +25,7 @@ class ScTpPrintOptions : public SfxTabPage { + friend class VclPtr; VclPtr m_pSkipEmptyPagesCB; VclPtr m_pSelectedSheetsCB; VclPtr m_pForceBreaksCB; diff --git a/sc/source/ui/inc/tpstat.hxx b/sc/source/ui/inc/tpstat.hxx index d143610c37b9..14478dc7043e 100644 --- a/sc/source/ui/inc/tpstat.hxx +++ b/sc/source/ui/inc/tpstat.hxx @@ -26,6 +26,7 @@ class ScDocStatPage: public SfxTabPage { + friend class VclPtr; public: static VclPtr Create( vcl::Window* pParent, const SfxItemSet* rSet ); virtual ~ScDocStatPage(); diff --git a/sc/source/ui/inc/tpsubt.hxx b/sc/source/ui/inc/tpsubt.hxx index a54536c11f79..3295262e33b2 100644 --- a/sc/source/ui/inc/tpsubt.hxx +++ b/sc/source/ui/inc/tpsubt.hxx @@ -76,6 +76,7 @@ private: class ScTpSubTotalGroup1 : public ScTpSubTotalGroup { + friend class VclPtr; protected: ScTpSubTotalGroup1( vcl::Window* pParent, const SfxItemSet& rArgSet ); @@ -91,6 +92,7 @@ public: class ScTpSubTotalGroup2 : public ScTpSubTotalGroup { + friend class VclPtr; protected: ScTpSubTotalGroup2( vcl::Window* pParent, const SfxItemSet& rArgSet ); @@ -106,6 +108,7 @@ public: class ScTpSubTotalGroup3 : public ScTpSubTotalGroup { + friend class VclPtr; protected: ScTpSubTotalGroup3( vcl::Window* pParent, const SfxItemSet& rArgSet ); @@ -121,6 +124,7 @@ public: class ScTpSubTotalOptions : public SfxTabPage { + friend class VclPtr; protected: ScTpSubTotalOptions( vcl::Window* pParent, const SfxItemSet& rArgSet ); diff --git a/sc/source/ui/inc/tptable.hxx b/sc/source/ui/inc/tptable.hxx index e135c91ea4ef..46042b854896 100644 --- a/sc/source/ui/inc/tptable.hxx +++ b/sc/source/ui/inc/tptable.hxx @@ -27,6 +27,7 @@ class ScTablePage : public SfxTabPage { + friend class VclPtr; static const sal_uInt16 pPageTableRanges[]; public: static VclPtr Create ( vcl::Window* pParent, diff --git a/sc/source/ui/inc/tpusrlst.hxx b/sc/source/ui/inc/tpusrlst.hxx index a0c8663df0d9..2a4c28ffc77f 100644 --- a/sc/source/ui/inc/tpusrlst.hxx +++ b/sc/source/ui/inc/tpusrlst.hxx @@ -32,6 +32,7 @@ class ScRangeUtil; class ScTpUserLists : public SfxTabPage { + friend class VclPtr; public: static VclPtr Create ( vcl::Window* pParent, const SfxItemSet* rAttrSet ); diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx index f31c850a5eb7..baece6cffd4a 100644 --- a/sc/source/ui/inc/tpview.hxx +++ b/sc/source/ui/inc/tpview.hxx @@ -31,6 +31,7 @@ class ScViewOptions; class ScTpContentOptions : public SfxTabPage { + friend class VclPtr; VclPtr pGridLB; VclPtr pColorFT; VclPtr pColorLB; @@ -84,6 +85,7 @@ public: class ScDocument; class ScTpLayoutOptions : public SfxTabPage { + friend class VclPtrInstance; VclPtr m_pUnitLB; VclPtr m_pTabMF; diff --git a/sc/source/ui/miscdlgs/filldlg.cxx b/sc/source/ui/miscdlgs/filldlg.cxx index 4a0113d85e7d..73244b6304e8 100644 --- a/sc/source/ui/miscdlgs/filldlg.cxx +++ b/sc/source/ui/miscdlgs/filldlg.cxx @@ -325,9 +325,7 @@ IMPL_LINK_NOARG(ScFillSeriesDlg, OKHdl) EndDialog( RET_OK ); else { - MessageDialog(this, - aErrMsgInvalidVal - ).Execute(); + ScopedVclPtr::Create(this, aErrMsgInvalidVal)->Execute(); pEdWrong->GrabFocus(); } diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx index fb9a60190da2..fb7f9ffafe4d 100644 --- a/sc/source/ui/miscdlgs/scuiautofmt.cxx +++ b/sc/source/ui/miscdlgs/scuiautofmt.cxx @@ -266,11 +266,11 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, AddHdl) if ( !bFmtInserted ) { - sal_uInt16 nRet = MessageDialog(this, + sal_uInt16 nRet = ScopedVclPtr::Create(this, ScGlobal::GetRscString(STR_INVALID_AFNAME), VCL_MESSAGE_ERROR, VCL_BUTTONS_OK_CANCEL - ).Execute(); + )->Execute(); bOk = ( nRet == RET_CANCEL ); } @@ -390,11 +390,11 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, RenameHdl) } if( !bFmtRenamed ) { - bOk = RET_CANCEL == MessageDialog( this, - ScGlobal::GetRscString(STR_INVALID_AFNAME), - VCL_MESSAGE_ERROR, - VCL_BUTTONS_OK_CANCEL - ).Execute(); + bOk = RET_CANCEL == ScopedVclPtr::Create( this, + ScGlobal::GetRscString(STR_INVALID_AFNAME), + VCL_MESSAGE_ERROR, + VCL_BUTTONS_OK_CANCEL + )->Execute(); } } else diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx index 74cbf8878709..a3fad625889e 100644 --- a/sc/source/ui/optdlg/tpcalc.cxx +++ b/sc/source/ui/optdlg/tpcalc.cxx @@ -103,7 +103,7 @@ void ScTpCalcOptions::Init() VclPtr ScTpCalcOptions::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr( new ScTpCalcOptions ( pParent, *rAttrSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rAttrSet ); } void ScTpCalcOptions::Reset( const SfxItemSet* /* rCoreAttrs */ ) @@ -192,9 +192,9 @@ SfxTabPage::sfxpg ScTpCalcOptions::DeactivatePage( SfxItemSet* pSetP ) if ( nReturn == KEEP_PAGE ) { - MessageDialog( this, + ScopedVclPtr::Create( this, ScGlobal::GetRscString( STR_INVALID_EPS ) - ).Execute(); + )->Execute(); m_pEdEps->GrabFocus(); } diff --git a/sc/source/ui/optdlg/tpcompatibility.cxx b/sc/source/ui/optdlg/tpcompatibility.cxx index ca828292c7db..3c83b980b7aa 100644 --- a/sc/source/ui/optdlg/tpcompatibility.cxx +++ b/sc/source/ui/optdlg/tpcompatibility.cxx @@ -34,7 +34,7 @@ void ScTpCompatOptions::dispose() VclPtr ScTpCompatOptions::Create(vcl::Window *pParent, const SfxItemSet *rCoreAttrs) { - return VclPtr(new ScTpCompatOptions(pParent, *rCoreAttrs), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rCoreAttrs); } bool ScTpCompatOptions::FillItemSet(SfxItemSet *rCoreAttrs) diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx index 79b8475a5145..a2929f77eb3a 100644 --- a/sc/source/ui/optdlg/tpdefaults.cxx +++ b/sc/source/ui/optdlg/tpdefaults.cxx @@ -42,7 +42,7 @@ void ScTpDefaultsOptions::dispose() VclPtr ScTpDefaultsOptions::Create(vcl::Window *pParent, const SfxItemSet *rCoreAttrs) { - return VclPtr(new ScTpDefaultsOptions(pParent, *rCoreAttrs), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rCoreAttrs); } bool ScTpDefaultsOptions::FillItemSet(SfxItemSet *rCoreSet) diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx index 3e7feb1ff2f8..2e4643e5d055 100644 --- a/sc/source/ui/optdlg/tpformula.cxx +++ b/sc/source/ui/optdlg/tpformula.cxx @@ -239,7 +239,7 @@ IMPL_LINK( ScTpFormulaOptions, SepEditOnFocusHdl, Edit*, pEdit ) VclPtr ScTpFormulaOptions::Create(vcl::Window* pParent, const SfxItemSet* rCoreSet) { - return VclPtr(new ScTpFormulaOptions(pParent, *rCoreSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rCoreSet); } bool ScTpFormulaOptions::FillItemSet(SfxItemSet* rCoreSet) diff --git a/sc/source/ui/optdlg/tpprint.cxx b/sc/source/ui/optdlg/tpprint.cxx index e38c830431d0..6ee0b8945925 100644 --- a/sc/source/ui/optdlg/tpprint.cxx +++ b/sc/source/ui/optdlg/tpprint.cxx @@ -54,7 +54,7 @@ void ScTpPrintOptions::dispose() VclPtr ScTpPrintOptions::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr(new ScTpPrintOptions( pParent, *rAttrSet ), SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *rAttrSet ); } SfxTabPage::sfxpg ScTpPrintOptions::DeactivatePage( SfxItemSet* pSetP ) diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index d1fab49c63cb..3f0e9e8daf68 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -155,7 +155,7 @@ void ScTpUserLists::Init() VclPtr ScTpUserLists::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr( new ScTpUserLists( pParent, *rAttrSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rAttrSet ); } void ScTpUserLists::Reset( const SfxItemSet* rCoreAttrs ) @@ -361,7 +361,7 @@ void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos, if ( (nStartCol != nEndCol) && (nStartRow != nEndRow) ) { - nCellDir = ScColOrRowDlg( this, aStrCopyList, aStrCopyFrom ).Execute(); + nCellDir = ScopedVclPtr::Create( this, aStrCopyList, aStrCopyFrom )->Execute(); } else if ( nStartCol != nEndCol ) nCellDir = SCRET_ROWS; @@ -701,9 +701,9 @@ IMPL_LINK( ScTpUserLists, BtnClickHdl, PushButton*, pBtn ) } else { - MessageDialog(this, + ScopedVclPtr::Create(this, ScGlobal::GetRscString( STR_INVALID_TABREF ) - ).Execute(); + )->Execute(); mpEdCopyFrom->GrabFocus(); mpEdCopyFrom->SetSelection( Selection( 0, SELECTION_MAX ) ); } diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index f1a475fcb60c..c1ba49adc89d 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -128,7 +128,7 @@ void ScTpContentOptions::dispose() VclPtr ScTpContentOptions::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) { - return VclPtr( new ScTpContentOptions (pParent, *rCoreSet), SAL_NO_ACQUIRE ); + return VclPtr::Create(pParent, *rCoreSet); } bool ScTpContentOptions::FillItemSet( SfxItemSet* rCoreSet ) @@ -460,7 +460,7 @@ void ScTpLayoutOptions::dispose() VclPtr ScTpLayoutOptions::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) { - VclPtr pNew( new ScTpLayoutOptions( pParent, *rCoreSet), SAL_NO_ACQUIRE ); + VclPtrInstance pNew( pParent, *rCoreSet ); ScDocShell* pDocSh = PTR_CAST(ScDocShell,SfxObjectShell::Current()); if(pDocSh!=NULL) diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx index 59b24a048f82..1a14789a8b4c 100644 --- a/sc/source/ui/pagedlg/scuitphfedit.cxx +++ b/sc/source/ui/pagedlg/scuitphfedit.cxx @@ -867,7 +867,9 @@ ScRightHeaderEditPage::ScRightHeaderEditPage( vcl::Window* pParent, const SfxIte {} VclPtr ScRightHeaderEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) - { return VclPtr( new ScRightHeaderEditPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); } +{ + return VclPtr::Create( pParent, *rCoreSet ); +} // class ScLeftHeaderEditPage @@ -879,7 +881,9 @@ ScLeftHeaderEditPage::ScLeftHeaderEditPage( vcl::Window* pParent, const SfxItemS {} VclPtr ScLeftHeaderEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) - { return VclPtr( new ScLeftHeaderEditPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); }; +{ + return VclPtr::Create( pParent, *rCoreSet ); +} // class ScRightFooterEditPage @@ -891,7 +895,9 @@ ScRightFooterEditPage::ScRightFooterEditPage( vcl::Window* pParent, const SfxIte {} VclPtr ScRightFooterEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) - { return VclPtr( new ScRightFooterEditPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); }; +{ + return VclPtr::Create( pParent, *rCoreSet ); +} // class ScLeftFooterEditPage @@ -903,6 +909,8 @@ ScLeftFooterEditPage::ScLeftFooterEditPage( vcl::Window* pParent, const SfxItemS {} VclPtr ScLeftFooterEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) - { return VclPtr( new ScLeftFooterEditPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); }; +{ + return VclPtr::Create( pParent, *rCoreSet ); +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx index cf1918e2403e..8575607d6e48 100644 --- a/sc/source/ui/pagedlg/tphf.cxx +++ b/sc/source/ui/pagedlg/tphf.cxx @@ -249,7 +249,7 @@ ScHeaderPage::ScHeaderPage( vcl::Window* pParent, const SfxItemSet& rSet ) VclPtr ScHeaderPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) { - return VclPtr( new ScHeaderPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rCoreSet ); } const sal_uInt16* ScHeaderPage::GetRanges() @@ -266,7 +266,7 @@ ScFooterPage::ScFooterPage( vcl::Window* pParent, const SfxItemSet& rSet ) VclPtr ScFooterPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) { - return VclPtr( new ScFooterPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rCoreSet ); } const sal_uInt16* ScFooterPage::GetRanges() diff --git a/sc/source/ui/pagedlg/tptable.cxx b/sc/source/ui/pagedlg/tptable.cxx index 910bc3f4423b..685e288796ed 100644 --- a/sc/source/ui/pagedlg/tptable.cxx +++ b/sc/source/ui/pagedlg/tptable.cxx @@ -156,7 +156,7 @@ void ScTablePage::dispose() VclPtr ScTablePage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet ) { - return VclPtr( new ScTablePage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rCoreSet ); } void ScTablePage::Reset( const SfxItemSet* rCoreSet ) diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx index d557584ab7fd..e3b77fdb8fc4 100644 --- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx @@ -53,7 +53,7 @@ namespace sc { namespace sidebar { svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent) { - return new CellLineStyleControl(pParent, *this); + return VclPtr::Create(pParent, *this); } void CellAppearancePropertyPanel::EndCellLineStylePopupMode() @@ -66,7 +66,7 @@ void CellAppearancePropertyPanel::EndCellLineStylePopupMode() svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent) { - return new CellBorderStyleControl(pParent, *this); + return VclPtr::Create(pParent, *this); } void CellAppearancePropertyPanel::EndCellBorderStylePopupMode() diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx index 00e8eb14d454..7857685aa1c2 100644 --- a/sc/source/ui/sidebar/ScPanelFactory.cxx +++ b/sc/source/ui/sidebar/ScPanelFactory.cxx @@ -94,12 +94,12 @@ Reference SAL_CALL ScPanelFactory::createUIElement ( pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings ); else if (rsResourceURL.endsWith("/NavigatorPanel")) { - pPanel = VclPtr(new ScNavigatorDlg(pBindings, NULL, pParentWindow, false), SAL_NO_ACQUIRE); + pPanel = VclPtr::Create(pBindings, nullptr, pParentWindow, false); nMinimumSize = 0; } else if (rsResourceURL.endsWith("/FunctionsPanel")) { - pPanel = VclPtr(new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX)), SAL_NO_ACQUIRE);; + pPanel = VclPtr::Create(pBindings, nullptr, pParentWindow, ScResId(FID_FUNCTION_BOX)); nMinimumSize = 0; } diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 6c12d034440a..b1b5d7f6a8ed 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -835,8 +835,8 @@ void ScCellShell::Execute( SfxRequest& rReq ) } } else - MessageDialog (pDlgParent, - ScGlobal::GetRscString(STR_INVALID_AFAREA) ).Execute(); + ScopedVclPtrInstance(pDlgParent, + ScGlobal::GetRscString(STR_INVALID_AFAREA) )->Execute(); } break; diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 29cfc5fe6990..c3ae18dfa9d8 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -412,9 +412,9 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) } else { - nRet = MessageDialog(GetDialogParent(), + nRet = ScopedVclPtr::Create(GetDialogParent(), aErrMsg - ).Execute(); + )->Execute(); } } } diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index ead579c831b8..2da799145ff3 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -378,7 +378,7 @@ VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateBreakDlg( sal_uLong nSumActionCount, sal_uLong nObjCount ) { - return new SdVclAbstractDialog_Impl( new ::sd::BreakDlg( pWindow, pDrView, pShell, nSumActionCount, nObjCount ) ); + return new SdVclAbstractDialog_Impl( VclPtr<::sd::BreakDlg>::Create( pWindow, pDrView, pShell, nSumActionCount, nObjCount ) ); } AbstractCopyDlg * SdAbstractDialogFactory_Impl::CreateCopyDlg( @@ -386,7 +386,7 @@ AbstractCopyDlg * SdAbstractDialogFactory_Impl::CreateCopyDlg( const rtl::Reference &pColTab, ::sd::View* pView ) { - return new AbstractCopyDlg_Impl( new ::sd::CopyDlg( pWindow, rInAttrs, pColTab, pView ) ); + return new AbstractCopyDlg_Impl( VclPtr<::sd::CopyDlg>::Create( pWindow, rInAttrs, pColTab, pView ) ); } AbstractSdCustomShowDlg * SdAbstractDialogFactory_Impl::CreateSdCustomShowDlg( vcl::Window* pWindow, SdDrawDocument& rDrawDoc ) @@ -436,12 +436,12 @@ AbstractSdInsertPagesObjsDlg * SdAbstractDialogFactory_Impl::CreateSdInsertPages AbstractMorphDlg * SdAbstractDialogFactory_Impl::CreateMorphDlg( vcl::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) { - return new AbstractMorphDlg_Impl( new ::sd::MorphDlg( pParent, pObj1, pObj2 ) ); + return new AbstractMorphDlg_Impl( VclPtr<::sd::MorphDlg>::Create( pParent, pObj1, pObj2 ) ); } SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdOutlineBulletTabDlg( vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView ) { - return new AbstractBulletDialog_Impl( new ::sd::OutlineBulletDlg( pParent, pAttr, pView ) ); + return new AbstractBulletDialog_Impl( VclPtr<::sd::OutlineBulletDlg>::Create( pParent, pAttr, pView ) ); } SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdParagraphTabDlg( vcl::Window* pParent, const SfxItemSet* pAttr ) @@ -457,7 +457,7 @@ AbstractSdStartPresDlg * SdAbstractDialogFactory_Impl::CreateSdStartPresentatio VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateRemoteDialog( vcl::Window* pWindow ) { - return new SdVclAbstractDialog_Impl( new ::sd::RemoteDialog( pWindow ) ); + return new SdVclAbstractDialog_Impl( VclPtr<::sd::RemoteDialog>::Create( pWindow ) ); } SfxAbstractTabDialog * SdAbstractDialogFactory_Impl::CreateSdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, vcl::Window* pParent, const SdResId& DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool ) @@ -514,18 +514,18 @@ CreateTabPage SdAbstractDialogFactory_Impl::GetSdOptionsSnapTabPageCreatorFunc() VclAbstractDialog* SdAbstractDialogFactory_Impl::CreateMasterLayoutDialog( vcl::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage ) { - return new SdVclAbstractDialog_Impl( new ::sd::MasterLayoutDialog( pParent, pDoc, pCurrentPage )); + return new SdVclAbstractDialog_Impl( VclPtr<::sd::MasterLayoutDialog>::Create( pParent, pDoc, pCurrentPage )); } AbstractHeaderFooterDialog* SdAbstractDialogFactory_Impl::CreateHeaderFooterDialog( sd::ViewShell* pViewShell, vcl::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage ) { - return new AbstractHeaderFooterDialog_Impl( new ::sd::HeaderFooterDialog( pViewShell, pParent, pDoc, pCurrentPage )); + return new AbstractHeaderFooterDialog_Impl( VclPtr<::sd::HeaderFooterDialog>::Create( pViewShell, pParent, pDoc, pCurrentPage )); } VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateSdPhotoAlbumDialog( vcl::Window* pWindow, SdDrawDocument* pDoc ) { - return new SdVclAbstractDialog_Impl( new ::sd::SdPhotoAlbumDialog( pWindow, pDoc ) ); + return new SdVclAbstractDialog_Impl( VclPtr<::sd::SdPhotoAlbumDialog>::Create( pWindow, pDoc ) ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx index 1ab67e2a63ef..e700df1443ed 100644 --- a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx @@ -88,14 +88,12 @@ VclPtr AllMasterPagesSelector::Create ( ::boost::shared_ptr pContainer (new MasterPageContainer()); - VclPtr pSelector( - new AllMasterPagesSelector ( + VclPtrInstance pSelector( pParent, *pDocument, rViewShellBase, pContainer, - rxSidebar), - SAL_NO_ACQUIRE); + rxSidebar); pSelector->LateInit(); pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_ALL); diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.hxx b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx index 58c958517bd6..e63e00c5b76c 100644 --- a/sd/source/ui/sidebar/AllMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx @@ -36,6 +36,7 @@ namespace sd { namespace sidebar { class AllMasterPagesSelector : public MasterPagesSelector { + friend class VclPtrInstance; public: static VclPtr Create ( vcl::Window* pParent, diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx index c9009629c24d..c7729447d130 100644 --- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx @@ -53,14 +53,12 @@ VclPtr CurrentMasterPagesSelector::Create ( ::boost::shared_ptr pContainer (new MasterPageContainer()); - VclPtr pSelector( - new CurrentMasterPagesSelector ( + VclPtrInstance pSelector( pParent, *pDocument, rViewShellBase, pContainer, - rxSidebar), - SAL_NO_ACQUIRE); + rxSidebar); pSelector->LateInit(); pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT ); diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx index 9443b991654c..b587a3f52aec 100644 --- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx @@ -34,6 +34,7 @@ class CurrentMasterPagesSelector : public MasterPagesSelector, public SfxListener { + friend class VclPtrInstance; public: static VclPtr Create ( vcl::Window* pParent, diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx index 73013aa037a5..3adab6c29a0c 100644 --- a/sd/source/ui/sidebar/PanelFactory.cxx +++ b/sd/source/ui/sidebar/PanelFactory.cxx @@ -125,9 +125,9 @@ Reference SAL_CALL PanelFactory::createUIElement ( #define EndsWith(s,t) s.endsWithAsciiL(t,strlen(t)) if (EndsWith(rsUIElementResourceURL, gsResourceNameCustomAnimations)) - pControl = VclPtr(new CustomAnimationPanel(pParentWindow, *pBase, xFrame), SAL_NO_ACQUIRE); + pControl = VclPtr::Create(pParentWindow, *pBase, xFrame); else if (EndsWith(rsUIElementResourceURL, gsResourceNameLayouts)) - pControl = VclPtr(new LayoutMenu(pParentWindow, *pBase, xSidebar), SAL_NO_ACQUIRE); + pControl = VclPtr::Create(pParentWindow, *pBase, xSidebar); else if (EndsWith(rsUIElementResourceURL, gsResourceNameAllMasterPages)) pControl = AllMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); else if (EndsWith(rsUIElementResourceURL, gsResourceNameRecentMasterPages)) @@ -135,11 +135,11 @@ Reference SAL_CALL PanelFactory::createUIElement ( else if (EndsWith(rsUIElementResourceURL, gsResourceNameUsedMasterPages)) pControl = CurrentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions)) - pControl = VclPtr(new SlideTransitionPanel(pParentWindow, *pBase, xFrame), SAL_NO_ACQUIRE); + pControl = VclPtr::Create(pParentWindow, *pBase, xFrame); else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign)) - pControl = VclPtr(new TableDesignPanel(pParentWindow, *pBase), SAL_NO_ACQUIRE); + pControl = VclPtr::Create(pParentWindow, *pBase); else if (EndsWith(rsUIElementResourceURL, gsResourceNameNavigator)) - pControl = VclPtr(new NavigatorWrapper(pParentWindow, *pBase, pBindings), SAL_NO_ACQUIRE); + pControl = VclPtr::Create(pParentWindow, *pBase, pBindings); #undef EndsWith if (!pControl) diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx index b31e139e22d6..00c7db8ee27f 100644 --- a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx @@ -43,14 +43,12 @@ VclPtr RecentMasterPagesSelector::Create ( ::boost::shared_ptr pContainer (new MasterPageContainer()); - VclPtr pSelector( - new RecentMasterPagesSelector ( + VclPtrInstance pSelector( pParent, *pDocument, rViewShellBase, pContainer, - rxSidebar), - SAL_NO_ACQUIRE); + rxSidebar); pSelector->LateInit(); pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_RECENT); diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx index a7f470317989..2a74f1447ada 100644 --- a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx @@ -29,6 +29,7 @@ namespace sd { namespace sidebar { class RecentMasterPagesSelector : public MasterPagesSelector { + friend class VclPtrInstance; public: static VclPtr Create ( vcl::Window* pParent, diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx index beb4deed9ec3..77c412bff0e9 100644 --- a/sfx2/source/appl/openuriexternally.cxx +++ b/sfx2/source/appl/openuriexternally.cxx @@ -53,10 +53,10 @@ bool sfx2::openUriExternally( throw; } SolarMutexGuard g; - MessageDialog( + ScopedVclPtrInstance eb( SfxGetpApp()->GetTopWindow(), - SfxResId(STR_NO_WEBBROWSER_FOUND)). - Execute(); + SfxResId(STR_NO_WEBBROWSER_FOUND)); + eb->Execute(); } return false; } diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index d7f822d028a7..2039b5d6104f 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -518,7 +518,7 @@ namespace sfx2 :m_rAntiImpl( i_rAntiImpl ) ,m_sModuleIdentifier( lcl_identifyModule( i_rDocumentFrame ) ) ,m_xFrame( i_rDocumentFrame ) - ,m_aPanelDeck( new ::svt::ToolPanelDeck(i_rAntiImpl) ) + ,m_aPanelDeck( VclPtr<::svt::ToolPanelDeck>::Create(i_rAntiImpl) ) { m_aPanelDeck->Show(); OnResize(); diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index a3aef2d2a21a..33579954fe9f 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1463,8 +1463,8 @@ bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel, || SignatureState::NOTVALIDATED == nDocumentSignatureState || SignatureState::PARTIAL_OK == nDocumentSignatureState) { - if (MessageDialog(NULL, SfxResId(RID_SVXSTR_XMLSEC_QUERY_LOSINGSIGNATURE), - VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute() != RET_YES) + if (ScopedVclPtrInstance(nullptr, SfxResId(RID_SVXSTR_XMLSEC_QUERY_LOSINGSIGNATURE), + VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)->Execute() != RET_YES) { // the user has decided not to store the document throw task::ErrorCodeIOException( diff --git a/sfx2/source/sidebar/ControlFactory.cxx b/sfx2/source/sidebar/ControlFactory.cxx index d8a49b3dd148..1376f9ee9961 100644 --- a/sfx2/source/sidebar/ControlFactory.cxx +++ b/sfx2/source/sidebar/ControlFactory.cxx @@ -27,12 +27,12 @@ namespace sfx2 { namespace sidebar { VclPtr ControlFactory::CreateMenuButton (vcl::Window* pParentWindow) { - return VclPtr(new MenuButton(pParentWindow), SAL_NO_ACQUIRE); + return VclPtr::Create(pParentWindow); } VclPtr ControlFactory::CreateTabItem (vcl::Window* pParentWindow) { - return VclPtr(new TabItem(pParentWindow), SAL_NO_ACQUIRE); + return VclPtr::Create(pParentWindow); } } } // end of namespace sfx2::sidebar diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index dad3302b7a34..2d90b6a6e3b6 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -422,7 +422,7 @@ public: IMPL_LINK( SmFontSizeDialog, DefaultButtonClickHdl, Button *, /*pButton*/ ) { - if (SaveDefaultsQuery(this).Execute() == RET_YES) + if (ScopedVclPtr::Create(this)->Execute() == RET_YES) { SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); @@ -526,7 +526,7 @@ IMPL_LINK( SmFontTypeDialog, MenuSelectHdl, Menu *, pMenu ) IMPL_LINK( SmFontTypeDialog, DefaultButtonClickHdl, Button *, /*pButton*/ ) { - if (SaveDefaultsQuery(this).Execute() == RET_YES) + if (ScopedVclPtr::Create(this)->Execute() == RET_YES) { SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); @@ -723,7 +723,7 @@ IMPL_LINK( SmDistanceDialog, MenuSelectHdl, Menu *, pMenu ) IMPL_LINK( SmDistanceDialog, DefaultButtonClickHdl, Button *, /*pButton*/ ) { - if (SaveDefaultsQuery(this).Execute() == RET_YES) + if (ScopedVclPtr::Create(this)->Execute() == RET_YES) { SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); @@ -1029,7 +1029,7 @@ void SmDistanceDialog::WriteTo(SmFormat &rFormat) /*const*/ IMPL_LINK( SmAlignDialog, DefaultButtonClickHdl, Button *, /*pButton*/ ) { - if (SaveDefaultsQuery(this).Execute() == RET_YES) + if (ScopedVclPtr::Create(this)->Execute() == RET_YES) { SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx index a4c4431d8da9..05a7e6d9c59b 100644 --- a/svtools/source/dialogs/prnsetup.cxx +++ b/svtools/source/dialogs/prnsetup.cxx @@ -104,7 +104,7 @@ Printer* ImplPrnDlgUpdatePrinter( Printer* pPrinter, Printer* pTempPrinterIn ) if ( ! Printer::GetQueueInfo( aPrnName, false ) ) { pTempPrinter.disposeAndClear(); - pTempPrinter = new Printer; + pTempPrinter = VclPtr::Create(); } return pTempPrinter; diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 8b9dd52f5446..55d0a483ca0d 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -118,7 +118,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const :: } else if (aServiceName.equalsIgnoreAsciiCase("roadmap") ) { - pWindow = new ::svt::ORoadmap( pParent, WB_TABSTOP ); + pWindow = VclPtr<::svt::ORoadmap>::Create( pParent, WB_TABSTOP ); *ppNewComp = new SVTXRoadmap; } else if ( aServiceName.equalsIgnoreAsciiCase( "ProgressBar" ) ) @@ -157,7 +157,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const :: { if ( pParent ) { - pWindow = new ::svt::table::TableControl(pParent, nWinBits); + pWindow = VclPtr<::svt::table::TableControl>::Create(pParent, nWinBits); *ppNewComp = new SVTXGridControl; } else diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index 34768b21677f..2767bb79b02f 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -493,7 +493,7 @@ void SvxFontPrevWindow::Init() if (!pImpl->mpPrinter) { - pImpl->mpPrinter = new Printer; + pImpl->mpPrinter = VclPtr::Create(); pImpl->mbDelPrinter = true; } SetMapMode(MapMode(MAP_TWIP)); diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 009622d10c31..fc5d15c51a50 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -2267,7 +2267,7 @@ SvxSearchDialogWrapper::SvxSearchDialogWrapper( vcl::Window* _pParent, sal_uInt1 SfxBindings* pBindings, SfxChildWinInfo* pInfo ) : SfxChildWindow( _pParent, nId ) - , dialog (new SvxSearchDialog (_pParent, this, *pBindings)) + , dialog (VclPtr::Create(_pParent, this, *pBindings)) { pWindow = dialog.get(); dialog->Initialize( pInfo ); diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index a18073102e68..2401be789b43 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -525,7 +525,7 @@ void SwDropCapsPict::_InitPrinter() if (!mpPrinter) { - mpPrinter = new Printer; + mpPrinter = VclPtr::Create(); mbDelPrinter = true; } } @@ -621,7 +621,7 @@ SfxTabPage::sfxpg SwDropCapsPage::DeactivatePage(SfxItemSet * _pSet) VclPtr SwDropCapsPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return VclPtr(new SwDropCapsPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } bool SwDropCapsPage::FillItemSet(SfxItemSet *rSet) diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx index 26b8a210b31f..ff8f908b5f23 100644 --- a/sw/source/ui/chrdlg/numpara.cxx +++ b/sw/source/ui/chrdlg/numpara.cxx @@ -126,8 +126,7 @@ void SwParagraphNumTabPage::dispose() VclPtr SwParagraphNumTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) { - return VclPtr( new SwParagraphNumTabPage(pParent, *rSet), - SAL_NO_ACQUIRE ); + return VclPtr::Create(pParent, *rSet); } bool SwParagraphNumTabPage::FillItemSet( SfxItemSet* rSet ) diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index 7b813250e690..62be945beb74 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -155,8 +155,7 @@ SfxTabPage::sfxpg SwCondCollPage::DeactivatePage(SfxItemSet * _pSet) VclPtr SwCondCollPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return VclPtr(new SwCondCollPage(pParent, *rSet), - SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } bool SwCondCollPage::FillItemSet(SfxItemSet *rSet) diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 758e53bd7301..81a7d49a5643 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -430,8 +430,7 @@ void SwAddPrinterTabPage::SetPreview(bool bPrev) VclPtr SwAddPrinterTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr(new SwAddPrinterTabPage( pParent, *rAttrSet ), - SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *rAttrSet ); } bool SwAddPrinterTabPage::FillItemSet( SfxItemSet* rCoreSet ) @@ -667,8 +666,7 @@ void SwStdFontTabPage::dispose() VclPtr SwStdFontTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr(new SwStdFontTabPage(pParent, *rAttrSet), - SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rAttrSet); } static void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType, @@ -1192,8 +1190,7 @@ void SwTableOptionsTabPage::dispose() VclPtr SwTableOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr( new SwTableOptionsTabPage(pParent, *rAttrSet ), - SAL_NO_ACQUIRE ); + return VclPtr::Create(pParent, *rAttrSet); } bool SwTableOptionsTabPage::FillItemSet( SfxItemSet* ) @@ -1453,7 +1450,7 @@ void SwShdwCrsrOptionsTabPage::dispose() VclPtr SwShdwCrsrOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet ) { - return VclPtr(new SwShdwCrsrOptionsTabPage( pParent, *rSet ), SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *rSet ); } void SwShdwCrsrOptionsTabPage::PageCreated( const SfxAllItemSet& aSet ) @@ -1874,7 +1871,7 @@ void SwRedlineOptionsTabPage::dispose() VclPtr SwRedlineOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr( new SwRedlineOptionsTabPage( pParent, *rSet ), SAL_NO_ACQUIRE ); + return VclPtr::Create( pParent, *rSet ); } bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) @@ -2388,7 +2385,7 @@ void SwCompareOptionsTabPage::dispose() VclPtr SwCompareOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ) { - return VclPtr(new SwCompareOptionsTabPage( pParent, *rAttrSet ), SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *rAttrSet ); } bool SwCompareOptionsTabPage::FillItemSet( SfxItemSet* ) diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index 3a9f6b4c76ce..906825a5a755 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -461,7 +461,7 @@ void SwEnvFormatPage::SetMinMax() VclPtr SwEnvFormatPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr(new SwEnvFormatPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } void SwEnvFormatPage::ActivatePage(const SfxItemSet& rSet) diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx index be34f66b3bdf..8e20c6adbd1f 100644 --- a/sw/source/ui/envelp/envlop1.cxx +++ b/sw/source/ui/envelp/envlop1.cxx @@ -321,7 +321,7 @@ void SwEnvPage::InitDatabaseBox() VclPtr SwEnvPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr(new SwEnvPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } void SwEnvPage::ActivatePage(const SfxItemSet& rSet) diff --git a/sw/source/ui/envelp/envprt.cxx b/sw/source/ui/envelp/envprt.cxx index b256af9cdb2d..8fb8a3917c8c 100644 --- a/sw/source/ui/envelp/envprt.cxx +++ b/sw/source/ui/envelp/envprt.cxx @@ -145,7 +145,7 @@ IMPL_LINK_NOARG_TYPED(SwEnvPrtPage, AlignHdl, ToolBox *, void) VclPtr SwEnvPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr(new SwEnvPrtPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } void SwEnvPrtPage::ActivatePage(const SfxItemSet&) diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index dfffd5dbe369..96c02c28caa3 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -488,7 +488,7 @@ void SwLabPage::InitDatabaseBox() VclPtr SwLabPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr(new SwLabPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } void SwLabPage::ActivatePage(const SfxItemSet& rSet) @@ -633,7 +633,7 @@ void SwVisitingCardPage::dispose() VclPtr SwVisitingCardPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr(new SwVisitingCardPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } void SwVisitingCardPage::ActivatePage(const SfxItemSet& rSet) @@ -794,7 +794,7 @@ void SwPrivateDataPage::dispose() VclPtr SwPrivateDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr(new SwPrivateDataPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } void SwPrivateDataPage::ActivatePage(const SfxItemSet& rSet) @@ -907,7 +907,7 @@ void SwBusinessDataPage::dispose() VclPtr SwBusinessDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr(new SwBusinessDataPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } void SwBusinessDataPage::ActivatePage(const SfxItemSet& rSet) diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index e8b3d53c1369..6ed49bc016af 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -488,7 +488,7 @@ void SwLabFormatPage::ChangeMinMax() VclPtr SwLabFormatPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr(new SwLabFormatPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } void SwLabFormatPage::ActivatePage(const SfxItemSet& rSet) diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx index ae5970d4f4f6..ae81bbeac08d 100644 --- a/sw/source/ui/envelp/labprt.cxx +++ b/sw/source/ui/envelp/labprt.cxx @@ -86,7 +86,7 @@ IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton ) { // Call printer setup if (!pPrinter) - pPrinter = new Printer; + pPrinter = VclPtr::Create(); VclPtrInstance< PrinterSetupDialog > pDlg(this); pDlg->SetPrinter(pPrinter); @@ -110,7 +110,7 @@ IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton ) VclPtr SwLabPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet) { - return VclPtr(new SwLabPrtPage( pParent, *rSet ), SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *rSet ); } void SwLabPrtPage::ActivatePage( const SfxItemSet& rSet ) diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index 43766da0bcb6..903926976f31 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -662,7 +662,7 @@ void SwColumnPage::Reset(const SfxItemSet *rSet) // create TabPage VclPtr SwColumnPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return VclPtr(new SwColumnPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } // stuff attributes into the Set when OK diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index ae47f510baf8..3c06257c5d51 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -861,7 +861,7 @@ void SwFrmPage::setOptimalRelWidth() VclPtr SwFrmPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return VclPtr(new SwFrmPage( pParent, *rSet ), SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *rSet ); } void SwFrmPage::EnableGraficMode() @@ -2423,7 +2423,7 @@ void SwGrfExtPage::dispose() VclPtr SwGrfExtPage::Create( vcl::Window *pParent, const SfxItemSet *rSet ) { - return VclPtr(new SwGrfExtPage( pParent, *rSet ), SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *rSet ); } void SwGrfExtPage::Reset(const SfxItemSet *rSet) @@ -2850,7 +2850,7 @@ bool SwFrmURLPage::FillItemSet(SfxItemSet *rSet) VclPtr SwFrmURLPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return VclPtr(new SwFrmURLPage( pParent, *rSet ), SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *rSet ); } IMPL_LINK_NOARG(SwFrmURLPage, InsertFileHdl) @@ -2942,7 +2942,7 @@ void SwFrmAddPage::dispose() VclPtr SwFrmAddPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return VclPtr(new SwFrmAddPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } void SwFrmAddPage::Reset(const SfxItemSet *rSet ) diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx index d9a0cbd01ffa..c3b1373bd340 100644 --- a/sw/source/ui/frmdlg/wrap.cxx +++ b/sw/source/ui/frmdlg/wrap.cxx @@ -157,7 +157,7 @@ void SwWrapTabPage::dispose() VclPtr SwWrapTabPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return VclPtr(new SwWrapTabPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } void SwWrapTabPage::Reset(const SfxItemSet *rSet) diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 0324d6fe2f7e..9648c96cf45d 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -3864,7 +3864,7 @@ SwEntryBrowseBox::SwEntryBrowseBox(vcl::Window* pParent, VclBuilderContainer* pB BrowserMode::AUTO_VSCROLL| BrowserMode::HIDECURSOR ) , aCellEdit(VclPtr::Create(&GetDataWindow(), 0)) - , aCellCheckBox(new ::svt::CheckBoxControl(&GetDataWindow())) + , aCellCheckBox(VclPtr<::svt::CheckBoxControl>::Create(&GetDataWindow())) , nCurrentRow(0) , bModified(false) { diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx index 5703e6d7b354..797ba4e6d35b 100644 --- a/sw/source/ui/misc/docfnote.cxx +++ b/sw/source/ui/misc/docfnote.cxx @@ -423,7 +423,7 @@ SwFootNoteOptionPage::~SwFootNoteOptionPage() VclPtr SwFootNoteOptionPage::Create(vcl::Window *pParent, const SfxItemSet *rSet ) { - return VclPtr(new SwFootNoteOptionPage( pParent, *rSet ), SAL_NO_ACQUIRE); + return VclPtr::Create( pParent, *rSet ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/impfnote.hxx b/sw/source/ui/misc/impfnote.hxx index 8d291d0c6794..c7390af9449d 100644 --- a/sw/source/ui/misc/impfnote.hxx +++ b/sw/source/ui/misc/impfnote.hxx @@ -81,6 +81,7 @@ public: class SwFootNoteOptionPage : public SwEndNoteOptionPage { + friend class VclPtr; SwFootNoteOptionPage( vcl::Window *pParent, const SfxItemSet &rSet ); virtual ~SwFootNoteOptionPage(); diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx index 49ac9ab8964a..11698c348e1c 100644 --- a/sw/source/ui/misc/pgfnote.cxx +++ b/sw/source/ui/misc/pgfnote.cxx @@ -153,7 +153,7 @@ void SwFootNotePage::dispose() VclPtr SwFootNotePage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return VclPtr(new SwFootNotePage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } void SwFootNotePage::Reset(const SfxItemSet *rSet) diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index f725eba0734d..ef7823c3b61d 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -182,7 +182,7 @@ void SwTextGridPage::dispose() VclPtr SwTextGridPage::Create(vcl::Window *pParent, const SfxItemSet *rSet) { - return VclPtr(new SwTextGridPage(pParent, *rSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rSet); } bool SwTextGridPage::FillItemSet(SfxItemSet *rSet) diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index d27f981bf812..6283bbdccead 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1372,7 +1372,7 @@ void SwTextFlowPage::dispose() VclPtr SwTextFlowPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { - return VclPtr(new SwTextFlowPage(pParent, *rAttrSet), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, *rAttrSet); } bool SwTextFlowPage::FillItemSet( SfxItemSet* rSet ) diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx index 1d7cf89f7d28..87123fde207a 100644 --- a/sw/source/ui/table/tautofmt.cxx +++ b/sw/source/ui/table/tautofmt.cxx @@ -356,8 +356,8 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl) if( !bFormatInserted ) { - bOk = RET_CANCEL == MessageDialog(this, aStrInvalidFormat, VCL_MESSAGE_ERROR, VCL_BUTTONS_OK_CANCEL) - .Execute(); + bOk = RET_CANCEL == ScopedVclPtr::Create(this, aStrInvalidFormat, VCL_MESSAGE_ERROR, VCL_BUTTONS_OK_CANCEL) + ->Execute(); } } else @@ -456,8 +456,8 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl) if( !bFormatRenamed ) { - bOk = RET_CANCEL == MessageDialog(this, aStrInvalidFormat, VCL_MESSAGE_ERROR, VCL_BUTTONS_OK_CANCEL) - .Execute(); + bOk = RET_CANCEL == ScopedVclPtr::Create(this, aStrInvalidFormat, VCL_MESSAGE_ERROR, VCL_BUTTONS_OK_CANCEL) + ->Execute(); } } else diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 08050057add8..01dbd79bcc86 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -391,8 +391,8 @@ The code below would only be part of the solution. if(m_pSpellState->m_xStartRange.is()) { LockFocusNotification( true ); - sal_uInt16 nRet = MessageDialog(GetWindow(), SW_RES(STR_QUERY_SPELL_CONTINUE), - VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute(); + sal_uInt16 nRet = ScopedVclPtr::Create(GetWindow(), SW_RES(STR_QUERY_SPELL_CONTINUE), + VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)->Execute(); if(RET_YES == nRet) { SwUnoInternalPaM aPam(*pWrtShell->GetDoc()); diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index 6c5a5cdea0b9..9ce682af86dd 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -221,7 +221,7 @@ VclPtr SwAnnotationWin::CreateMenuButton() aRewriter.AddRule(UndoArg1,GetAuthor()); aText = aRewriter.Apply(aText); mpButtonPopup->SetItemText(FN_DELETE_NOTE_AUTHOR,aText); - VclPtr pMenuButton( new AnnotationMenuButton( *this ), SAL_NO_ACQUIRE ); + VclPtrInstance pMenuButton( *this ); pMenuButton->SetPopupMenu( mpButtonPopup ); pMenuButton->Show(); return pMenuButton; diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx index eb8278469e8d..bcc3650c11bf 100644 --- a/sw/source/uibase/inc/optpage.hxx +++ b/sw/source/uibase/inc/optpage.hxx @@ -130,6 +130,7 @@ public: class SwStdFontTabPage : public SfxTabPage { + friend class VclPtr; VclPtr pLabelFT; VclPtr pStandardBox; diff --git a/sw/source/uibase/inc/pgfnote.hxx b/sw/source/uibase/inc/pgfnote.hxx index 49f1974b8c3e..223fe3851f7a 100644 --- a/sw/source/uibase/inc/pgfnote.hxx +++ b/sw/source/uibase/inc/pgfnote.hxx @@ -31,6 +31,7 @@ // footnote settings TabPage class SwFootNotePage: public SfxTabPage { + friend class VclPtr; static const sal_uInt16 aPageRg[]; SwFootNotePage(vcl::Window *pParent, const SfxItemSet &rSet); public: diff --git a/sw/source/uibase/sidebar/PageColumnControl.cxx b/sw/source/uibase/sidebar/PageColumnControl.cxx index 2c37741b69f0..d1a675e29900 100644 --- a/sw/source/uibase/sidebar/PageColumnControl.cxx +++ b/sw/source/uibase/sidebar/PageColumnControl.cxx @@ -37,7 +37,7 @@ PageColumnControl::PageColumnControl( const sal_uInt16 nColumnType, const bool bLandscape ) : svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_COLUMN) ) - , mpColumnValueSet( new svx::sidebar::ValueSetWithTextControl( svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) ) + , mpColumnValueSet( VclPtr::Create( svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) ) , maMoreButton( VclPtr::Create( this, SW_RES(CB_COLUMN_MORE) ) ) , mnColumnType( nColumnType ) , mrPagePropPanel(rPanel) diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx b/sw/source/uibase/sidebar/PageMarginControl.cxx index 5a806688e75a..7d5fe569f41d 100644 --- a/sw/source/uibase/sidebar/PageMarginControl.cxx +++ b/sw/source/uibase/sidebar/PageMarginControl.cxx @@ -49,7 +49,7 @@ PageMarginControl::PageMarginControl( const FieldUnit eFUnit, const SfxMapUnit eUnit ) : svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_MARGIN) ) - , mpMarginValueSet( new svx::sidebar::ValueSetWithTextControl( svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_MARGIN) ) ) + , mpMarginValueSet( VclPtr::Create( svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_MARGIN) ) ) , maCustom(VclPtr::Create(this, SW_RES(FT_CUSTOM))) , maLeft(VclPtr::Create(this, SW_RES(FT_LEFT))) , maInner(VclPtr::Create(this, SW_RES(FT_INNER))) diff --git a/sw/source/uibase/sidebar/PageOrientationControl.cxx b/sw/source/uibase/sidebar/PageOrientationControl.cxx index 1c3dc3566cd5..18da73a34ba5 100644 --- a/sw/source/uibase/sidebar/PageOrientationControl.cxx +++ b/sw/source/uibase/sidebar/PageOrientationControl.cxx @@ -33,7 +33,7 @@ PageOrientationControl::PageOrientationControl( PagePropertyPanel& rPanel, const bool bLandscape ) : svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_ORIENTATION) ) - , mpOrientationValueSet( new svx::sidebar::ValueSetWithTextControl( svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_ORIENTATION) ) ) + , mpOrientationValueSet( VclPtr::Create( svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_ORIENTATION) ) ) , mbLandscape( bLandscape ) , mrPagePropPanel(rPanel) { diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx index 48f1b0a6d6c1..621d18f9bc8c 100644 --- a/sw/source/uibase/sidebar/PageSizeControl.cxx +++ b/sw/source/uibase/sidebar/PageSizeControl.cxx @@ -42,7 +42,7 @@ PageSizeControl::PageSizeControl( const bool bLandscape, const FieldUnit eFUnit ) : svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_SIZE) ) - , mpSizeValueSet( new svx::sidebar::ValueSetWithTextControl( svx::sidebar::ValueSetWithTextControl::TEXT_TEXT, this, SW_RES(VS_SIZE) ) ) + , mpSizeValueSet( VclPtr::Create( svx::sidebar::ValueSetWithTextControl::TEXT_TEXT, this, SW_RES(VS_SIZE) ) ) , maMoreButton( VclPtr::Create( this, SW_RES(CB_SIZE_MORE) ) ) , maWidthHeightField( VclPtr::Create( this, SW_RES(FLD_WIDTH_HEIGHT) ) ) , mePaper( ePaper ) diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.cxx b/sw/source/uibase/sidebar/StylePresetsPanel.cxx index a0c491fe0a84..7a4dbfc2933a 100644 --- a/sw/source/uibase/sidebar/StylePresetsPanel.cxx +++ b/sw/source/uibase/sidebar/StylePresetsPanel.cxx @@ -54,7 +54,7 @@ VclPtr StylePresetsPanel::Create (vcl::Window* pParent, if (pBindings == NULL) throw css::lang::IllegalArgumentException("no SfxBindings given to PagePropertyPanel::Create", NULL, 2); - return VclPtr(new StylePresetsPanel(pParent, rxFrame, pBindings), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, rxFrame, pBindings); } StylePresetsPanel::StylePresetsPanel(vcl::Window* pParent, diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.hxx b/sw/source/uibase/sidebar/StylePresetsPanel.hxx index 047272ea87ca..5f0b97d8e7f7 100644 --- a/sw/source/uibase/sidebar/StylePresetsPanel.hxx +++ b/sw/source/uibase/sidebar/StylePresetsPanel.hxx @@ -41,6 +41,7 @@ namespace sw { namespace sidebar { class StylePresetsPanel : public PanelLayout, public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { + friend class VclPtr; public: static VclPtr Create(vcl::Window* pParent, const css::uno::Reference& rxFrame, diff --git a/sw/source/uibase/sidebar/SwPanelFactory.cxx b/sw/source/uibase/sidebar/SwPanelFactory.cxx index 013519661a13..92dd4875d948 100644 --- a/sw/source/uibase/sidebar/SwPanelFactory.cxx +++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx @@ -139,7 +139,7 @@ Reference SAL_CALL SwPanelFactory::createUIElement ( } else if (rsResourceURL.endsWith("/NavigatorPanel")) { - VclPtr pPanel( new SwNavigationPI(pBindings, NULL, pParentWindow), SAL_NO_ACQUIRE ); + VclPtrInstance pPanel(pBindings, nullptr, pParentWindow); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, @@ -148,7 +148,7 @@ Reference SAL_CALL SwPanelFactory::createUIElement ( } else if (rsResourceURL.endsWith("/ManageChangesPanel")) { - VclPtr pPanel( new SwRedlineAcceptPanel(pParentWindow, xFrame), SAL_NO_ACQUIRE ); + VclPtrInstance pPanel(pParentWindow, xFrame); xElement = sfx2::sidebar::SidebarPanelBase::Create( rsResourceURL, xFrame, diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx index bb375020a3eb..c2e7406ce2aa 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -477,7 +477,7 @@ VclPtr ThemePanel::Create (vcl::Window* pParent, if (pBindings == NULL) throw css::lang::IllegalArgumentException("no SfxBindings given to PagePropertyPanel::Create", NULL, 2); - return VclPtr(new ThemePanel(pParent, rxFrame, pBindings), SAL_NO_ACQUIRE); + return VclPtr::Create(pParent, rxFrame, pBindings); } ThemePanel::ThemePanel(vcl::Window* pParent, diff --git a/sw/source/uibase/sidebar/ThemePanel.hxx b/sw/source/uibase/sidebar/ThemePanel.hxx index a14ac51de4ae..fa958cc82c5a 100644 --- a/sw/source/uibase/sidebar/ThemePanel.hxx +++ b/sw/source/uibase/sidebar/ThemePanel.hxx @@ -41,6 +41,7 @@ namespace sw { namespace sidebar { class ThemePanel : public PanelLayout, public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { + friend class VclPtr; public: static VclPtr Create(vcl::Window* pParent, const css::uno::Reference& rxFrame, diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 63470d10e378..026396312c95 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -711,7 +711,7 @@ void SwPagePreview::Execute( SfxRequest &rReq ) } else - SwPreviewZoomDlg( *pViewWin ).Execute(); + ScopedVclPtrInstance( *pViewWin )->Execute(); } break; diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 051081b5210c..2f19e1faf113 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -426,8 +426,7 @@ void SwNavHelpToolBox::MouseButtonDown(const MouseEvent &rEvt) void SwNavigationPI::CreateNavigationTool(const Rectangle& rRect, bool bSetFocus, vcl::Window *pParent) { Reference< XFrame > xFrame = GetCreateView()->GetViewFrame()->GetFrame().GetFrameInterface(); - SwScrollNaviPopup* pPopup = new - SwScrollNaviPopup(FN_SCROLL_NAVIGATION, xFrame, pParent); + VclPtrInstance pPopup(FN_SCROLL_NAVIGATION, xFrame, pParent); Rectangle aRect(rRect); Point aT1 = aRect.TopLeft(); diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 642c636631dc..d65f3b126257 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -937,9 +937,9 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp, { // Modal/Modeless nur durch Show/Execute if ( (pParent == NULL ) && ( rDescriptor.ParentIndex == -1 ) ) - pNewWindow = new toolkit::ScrollableWrapper( nullptr, nWinBits, Dialog::InitFlag::NoParent ); + pNewWindow = VclPtr>::Create( nullptr, nWinBits, Dialog::InitFlag::NoParent ); else - pNewWindow = new toolkit::ScrollableWrapper( pParent, nWinBits ); + pNewWindow = VclPtr>::Create( pParent, nWinBits ); // #i70217# Don't always create a new component object. It's possible that VCL has called // GetComponentInterface( sal_True ) in the Dialog ctor itself (see Window::IsTopWindow() ) // which creates a component object. diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 64d08c4f2559..51bab758eb33 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1325,7 +1325,7 @@ VclPtr VclBuilder::makeObject(vcl::Window *pParent, const OString & WinBits nBits = WB_CLIPCHILDREN|WB_MOVEABLE|WB_3DLOOK|WB_CLOSEABLE; if (extractResizable(rMap)) nBits |= WB_SIZEABLE; - xWindow = VclPtr(new MessageDialog(pParent, nBits), SAL_NO_ACQUIRE); + xWindow = VclPtr::Create(pParent, nBits); } else if (name == "GtkBox") { diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 9673a3c617f1..14bc8bd959e0 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -331,8 +331,8 @@ bool DigitalSignaturesDialog::canAddRemove() //It the user presses 'Add' or 'Remove' several times then, then the warning //is shown every time until the user presses 'OK'. From then on, the warning //is not displayed anymore as long as the signatures dialog is alive. - if (MessageDialog( - NULL, XMLSEC_RES(STR_XMLSECDLG_QUERY_REMOVEDOCSIGNBEFORESIGN), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute() == RET_NO) + if (ScopedVclPtr::Create( + nullptr, XMLSEC_RES(STR_XMLSECDLG_QUERY_REMOVEDOCSIGNBEFORESIGN), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)->Execute() == RET_NO) ret = false; else m_bWarningShowSignMacro = true; -- cgit