[Libreoffice-commits] core.git: basctl/source basic/source cui/source dbaccess/source desktop/source extensions/source framework/source include/vcl sc/source sd/source sfx2/source starmath/source svtools/source svx/source sw/source toolkit/source vcl/source xmlsecurity/source

Noel Grandin noel at peralex.com
Sat Jun 6 13:27:20 PDT 2015


 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(-)

New commits:
commit 3f72218069f6f78a3ba21c40f00240d78cbe65c7
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jun 3 12:02:36 2015 +0200

    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 <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx
index 93302fe..1c878d82 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<SfxPrinter>::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 0e942fc..e993bed 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<Edit>::Create(this,  WB_LEFT | WB_BORDER) ),
-    aOk( new OKButton(this) ), aCancel( new CancelButton(this) ), aPromptText( VclPtr<FixedText>::Create(this, WB_WORDBREAK) )
+    aOk( VclPtr<OKButton>::Create(this) ), aCancel( VclPtr<CancelButton>::Create(this) ), aPromptText( VclPtr<FixedText>::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 cdc4248..09c9763 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<Edit>::Create(this, WB_3DLOOK | WB_LEFT | WB_BORDER) ),
-             aOk( new OKButton(this) ), aCancel( VclPtr<CancelButton>::Create(this) )
+             aOk( VclPtr<OKButton>::Create(this) ), aCancel( VclPtr<CancelButton>::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 c5a1e7a..d472b7f 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<MessageDialog>::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 4472404..c9b7af8 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<SvxHlinkDlgMarkWnd>::Create( this );
 }
 
 SvxHyperlinkTabPageBase::~SvxHyperlinkTabPageBase()
diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx
index 10ab452..a667eb9 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<AlignmentTabPage>;
     static const sal_uInt16 s_pRanges[];
 
 public:
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index b016220..c9b9b6c 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<OfaSwAutoFmtOptionsPage>;
     using TabPage::ActivatePage;
 
     VclPtr<OfaACorrCheckListBox>   m_pCheckLB;
@@ -338,6 +339,7 @@ public:
 
 class OfaQuoteTabPage : public SfxTabPage
 {
+    friend class VclPtr<OfaQuoteTabPage>;
     using TabPage::ActivatePage;
 
 private:
@@ -402,6 +404,7 @@ public:
 
 class OfaAutoCompleteTabPage : public SfxTabPage
 {
+    friend class VclPtr<OfaAutoCompleteTabPage>;
 public:
     class AutoCompleteMultiListBox : public MultiListBox
     {
diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx
index 89af13d..633e4e6 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<SvxBackgroundTabPage>;
     static const sal_uInt16 pPageRanges[];
 public:
     static VclPtr<SfxTabPage>  Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index 75b438b..ff77804 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<SvxBorderTabPage>;
     using TabPage::DeactivatePage;
 
     static const sal_uInt16 pRanges[];
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index 6049350..4eb009a 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<SvxCharNamePage>;
 
 private:
     static const sal_uInt16 pNameRanges[];
@@ -175,6 +176,7 @@ public:
 
 class SvxCharEffectsPage : public SvxCharBasePage
 {
+    friend class VclPtr<SvxCharEffectsPage>;
 
 private:
     static const sal_uInt16 pEffectsRanges[];
@@ -254,6 +256,7 @@ public:
 
 class SvxCharPositionPage : public SvxCharBasePage
 {
+    friend class VclPtr<SvxCharPositionPage>;
     static const sal_uInt16 pPositionRanges[];
 
 private:
@@ -333,6 +336,7 @@ public:
 
 class SvxCharTwoLinesPage : public SvxCharBasePage
 {
+    friend class VclPtr<SvxCharTwoLinesPage>;
 private:
     static const sal_uInt16 pTwoLinesRanges[];
     VclPtr<CheckBox>           m_pTwoLinesBtn;
diff --git a/cui/source/inc/grfpage.hxx b/cui/source/inc/grfpage.hxx
index 47fb0e9..47ac000 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<SvxGrfCropPage>;
     using Window::CalcZoom;
     using TabPage::ActivatePage;
     using TabPage::DeactivatePage;
diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx
index c4413ab..0c3e212 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<SvxNumberFormatTabPage>;
     using SfxTabPage::DeactivatePage;
     static const sal_uInt16 pRanges[];
 
diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx
index 73d9ace..96a0238 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<SvxLinguTabPage>;
 private:
     VclPtr<FixedText>          m_pLinguModulesFT;
     VclPtr<SvxCheckListBox>    m_pLinguModulesCLB;
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index f68bf33..c7b6436 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<SvxPageDescPage>;
     using TabPage::ActivatePage;
     using TabPage::DeactivatePage;
 
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index 0c55af1..db93978 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<SvxStdParagraphTabPage>;
     using TabPage::DeactivatePage;
     static const sal_uInt16 pStdRanges[];
 
@@ -124,6 +125,7 @@ public:
 
 class SvxParaAlignTabPage : public SfxTabPage
 {
+    friend class VclPtr<SvxParaAlignTabPage>;
     using TabPage::DeactivatePage;
     static const sal_uInt16 pAlignRanges[];
 
@@ -191,6 +193,7 @@ public:
 
 class SvxExtParagraphTabPage: public SfxTabPage
 {
+    friend class VclPtr<SvxExtParagraphTabPage>;
     using TabPage::DeactivatePage;
     static const sal_uInt16 pExtRanges[];
 
@@ -265,6 +268,7 @@ private:
 
 class SvxAsianTabPage : public SfxTabPage
 {
+    friend class VclPtr<SvxAsianTabPage>;
 
     VclPtr<CheckBox>     m_pForbiddenRulesCB;
     VclPtr<CheckBox>     m_pHangingPunctCB;
diff --git a/cui/source/inc/tabstpge.hxx b/cui/source/inc/tabstpge.hxx
index 05903af..d73e963 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<SvxTabulatorTabPage>;
     using TabPage::DeactivatePage;
     static const sal_uInt16 pRanges[];
 
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index 3bf5f84..b482e8b 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<svx::OptHeaderTabListBox>::Create( *m_pPathCtrl, nBits );
 
     HeaderBar &rBar = pPathBox->GetTheHeaderBar();
 
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 62989f3..a3c72ff 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -912,7 +912,7 @@ void SvxSecurityTabPage::InitControls()
 
 VclPtr<SfxTabPage> SvxSecurityTabPage::Create(vcl::Window* pParent, const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>(new SvxSecurityTabPage(pParent, *rAttrSet), SAL_NO_ACQUIRE);
+    return VclPtr<SvxSecurityTabPage>::Create(pParent, *rAttrSet);
 }
 
 void SvxSecurityTabPage::ActivatePage( const SfxItemSet& )
diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx
index 15403a1..c23dc7b 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<SvxSecurityTabPage>;
 private:
     VclPtr<PushButton>         m_pSecurityOptionsPB;
 
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 3c535f8..cafbe11 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -1153,8 +1153,7 @@ void SvxLinguTabPage::dispose()
 VclPtr<SfxTabPage> SvxLinguTabPage::Create( vcl::Window* pParent,
                                             const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>( new SvxLinguTabPage( pParent, *rAttrSet ),
-                               SAL_NO_ACQUIRE );
+    return VclPtr<SvxLinguTabPage>::Create( pParent, *rAttrSet );
 }
 
 
diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index 94012e5..cad777d 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -286,8 +286,7 @@ void AlignmentTabPage::dispose()
 
 VclPtr<SfxTabPage> AlignmentTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>( new AlignmentTabPage( pParent, *rAttrSet ),
-                               SAL_NO_ACQUIRE );
+    return VclPtr<AlignmentTabPage>::Create( pParent, *rAttrSet );
 }
 
 bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index ce474e3..37cc472 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -514,7 +514,7 @@ void OfaSwAutoFmtOptionsPage::dispose()
 VclPtr<SfxTabPage> OfaSwAutoFmtOptionsPage::Create( vcl::Window* pParent,
                                                     const SfxItemSet* rAttrSet)
 {
-    return VclPtr<SfxTabPage>( new OfaSwAutoFmtOptionsPage(pParent, *rAttrSet), SAL_NO_ACQUIRE );
+    return VclPtr<OfaSwAutoFmtOptionsPage>::Create(pParent, *rAttrSet);
 }
 
 bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet*  )
@@ -1906,8 +1906,7 @@ void OfaQuoteTabPage::dispose()
 VclPtr<SfxTabPage> OfaQuoteTabPage::Create( vcl::Window* pParent,
                                             const SfxItemSet* rAttrSet)
 {
-    return VclPtr<SfxTabPage>( new OfaQuoteTabPage(pParent, *rAttrSet),
-                               SAL_NO_ACQUIRE );
+    return VclPtr<OfaQuoteTabPage>::Create(pParent, *rAttrSet);
 }
 
 bool OfaQuoteTabPage::FillItemSet( SfxItemSet*  )
@@ -2247,7 +2246,7 @@ void OfaAutoCompleteTabPage::dispose()
 VclPtr<SfxTabPage> OfaAutoCompleteTabPage::Create( vcl::Window* pParent,
                                                    const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>( new OfaAutoCompleteTabPage( pParent, *rSet ), SAL_NO_ACQUIRE );
+    return VclPtr<OfaAutoCompleteTabPage>::Create( pParent, *rSet );
 }
 
 bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet* )
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 8c5703c..9ba70fa 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -482,7 +482,7 @@ void SvxBackgroundTabPage::dispose()
 
 VclPtr<SfxTabPage> SvxBackgroundTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>( new SvxBackgroundTabPage( pParent, *rAttrSet ), SAL_NO_ACQUIRE );
+    return VclPtr<SvxBackgroundTabPage>::Create( pParent, *rAttrSet );
 }
 
 void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet )
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 01881fe..3daf13f 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -372,8 +372,7 @@ void SvxBorderTabPage::dispose()
 VclPtr<SfxTabPage> SvxBorderTabPage::Create( vcl::Window* pParent,
                                              const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>(new SvxBorderTabPage( pParent, *rAttrSet ),
-                              SAL_NO_ACQUIRE);
+    return VclPtr<SvxBorderTabPage>::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 ac6b7c5..8cb2b46 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1220,8 +1220,7 @@ SfxTabPage::sfxpg SvxCharNamePage::DeactivatePage( SfxItemSet* _pSet )
 
 VclPtr<SfxTabPage> SvxCharNamePage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
 {
-    return VclPtr<SfxTabPage>( new SvxCharNamePage( pParent, *rSet ),
-                               SAL_NO_ACQUIRE );
+    return VclPtr<SvxCharNamePage>::Create( pParent, *rSet );
 }
 
 
@@ -1786,8 +1785,7 @@ SfxTabPage::sfxpg SvxCharEffectsPage::DeactivatePage( SfxItemSet* _pSet )
 
 VclPtr<SfxTabPage> SvxCharEffectsPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
 {
-    return VclPtr<SfxTabPage>( new SvxCharEffectsPage( pParent, *rSet ),
-                               SAL_NO_ACQUIRE );
+    return VclPtr<SvxCharEffectsPage>::Create( pParent, *rSet );
 }
 
 
@@ -2969,8 +2967,7 @@ SfxTabPage::sfxpg SvxCharPositionPage::DeactivatePage( SfxItemSet* _pSet )
 
 VclPtr<SfxTabPage> SvxCharPositionPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
 {
-    return VclPtr<SfxTabPage>( new SvxCharPositionPage( pParent, *rSet ),
-                               SAL_NO_ACQUIRE );
+    return VclPtr<SvxCharPositionPage>::Create( pParent, *rSet );
 }
 
 
@@ -3542,8 +3539,7 @@ SfxTabPage::sfxpg SvxCharTwoLinesPage::DeactivatePage( SfxItemSet* _pSet )
 
 VclPtr<SfxTabPage> SvxCharTwoLinesPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
 {
-    return VclPtr<SfxTabPage>( new SvxCharTwoLinesPage( pParent, *rSet ),
-                               SAL_NO_ACQUIRE );
+    return VclPtr<SvxCharTwoLinesPage>::Create( pParent, *rSet );
 }
 
 void SvxCharTwoLinesPage::Reset( const SfxItemSet* rSet )
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index 4e4095a..7d24012 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -156,8 +156,7 @@ void SvxGrfCropPage::dispose()
 
 VclPtr<SfxTabPage> SvxGrfCropPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
 {
-    return VclPtr<SfxTabPage>( new SvxGrfCropPage( pParent, *rSet ),
-                               SAL_NO_ACQUIRE );
+    return VclPtr<SvxGrfCropPage>::Create( pParent, *rSet );
 }
 
 void SvxGrfCropPage::Reset( const SfxItemSet *rSet )
diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx
index 2e90ed8..cb096ca 100644
--- a/cui/source/tabpages/macroass.cxx
+++ b/cui/source/tabpages/macroass.cxx
@@ -458,7 +458,7 @@ namespace
 {
     VclPtr<SfxMacroTabPage> CreateSfxMacroTabPage( vcl::Window* pParent, const SfxItemSet& rAttrSet )
     {
-        return VclPtr<SfxMacroTabPage>( new SfxMacroTabPage( pParent, NULL, rAttrSet ), SAL_NO_ACQUIRE );
+        return VclPtr<SfxMacroTabPage>::Create( pParent, nullptr, rAttrSet );
     }
 }
 
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index a8974af..54bcb27 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -383,7 +383,7 @@ void SvxNumberFormatTabPage::Init_Impl()
 VclPtr<SfxTabPage> SvxNumberFormatTabPage::Create( vcl::Window* pParent,
                                                    const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>( new SvxNumberFormatTabPage( pParent, *rAttrSet ), SAL_NO_ACQUIRE );
+    return VclPtr<SvxNumberFormatTabPage>::Create( pParent, *rAttrSet );
 }
 
 
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 65c28c7..7a60414 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<SfxTabPage> SvxPageDescPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
 {
-    return VclPtr<SfxTabPage>(new SvxPageDescPage( pParent, *rSet ), SAL_NO_ACQUIRE );
+    return VclPtr<SvxPageDescPage>::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<Printer>::Create();
         mbDelPrinter = true;
     }
 
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index d128a30..111dac9 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -196,7 +196,7 @@ IMPL_LINK_NOARG(SvxStdParagraphTabPage, ELRLoseFocusHdl)
 
 VclPtr<SfxTabPage> SvxStdParagraphTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>( new SvxStdParagraphTabPage( pParent, *rSet ), SAL_NO_ACQUIRE );
+    return VclPtr<SvxStdParagraphTabPage>::Create( pParent, *rSet );
 }
 
 bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
@@ -1072,7 +1072,7 @@ SfxTabPage::sfxpg SvxParaAlignTabPage::DeactivatePage( SfxItemSet* _pSet )
 
 VclPtr<SfxTabPage> SvxParaAlignTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
 {
-    return VclPtr<SfxTabPage>( new SvxParaAlignTabPage(pParent, *rSet), SAL_NO_ACQUIRE );
+    return VclPtr<SvxParaAlignTabPage>::Create(pParent, *rSet);
 }
 
 bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet )
@@ -1346,7 +1346,7 @@ void SvxParaAlignTabPage::PageCreated (const SfxAllItemSet& aSet)
 VclPtr<SfxTabPage> SvxExtParagraphTabPage::Create( vcl::Window* pParent,
                                             const SfxItemSet* rSet )
 {
-    return VclPtr<SfxTabPage>( new SvxExtParagraphTabPage( pParent, *rSet ), SAL_NO_ACQUIRE );
+    return VclPtr<SvxExtParagraphTabPage>::Create( pParent, *rSet );
 }
 
 bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
@@ -2193,7 +2193,7 @@ void SvxAsianTabPage::dispose()
 
 VclPtr<SfxTabPage> SvxAsianTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
 {
-    return VclPtr<SfxTabPage>(new SvxAsianTabPage(pParent, *rSet), SAL_NO_ACQUIRE );
+    return VclPtr<SvxAsianTabPage>::Create(pParent, *rSet);
 }
 
 const sal_uInt16*     SvxAsianTabPage::GetRanges()
diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx
index 6bef883..87c493b 100644
--- a/cui/source/tabpages/tabstpge.cxx
+++ b/cui/source/tabpages/tabstpge.cxx
@@ -265,7 +265,7 @@ bool SvxTabulatorTabPage::FillItemSet(SfxItemSet* rSet)
 
 VclPtr<SfxTabPage> SvxTabulatorTabPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>(new SvxTabulatorTabPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SvxTabulatorTabPage>::Create(pParent, *rSet);
 }
 
 void SvxTabulatorTabPage::Reset(const SfxItemSet* rSet)
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 6319c4d4..94231c5 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<MessageDialog>::Create( GetParentDialog()
                                         ,"DuplicateNameDialog"
                                         ,"cui/ui/queryduplicatedialog.ui"));
         }
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 557e89e..0282321 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<ToolBox>::Create(this,WB_TABSTOP) )
     ,m_aBorder(VclPtr<Window>::Create(this,WB_BORDER | WB_READONLY))
     ,m_aPreview(VclPtr<OPreviewWindow>::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 ed99f81..b9c8fba 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -83,7 +83,7 @@ namespace dbaui
 
     VclPtr<SfxTabPage> OConnectionTabPage::Create( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
     {
-        return VclPtr<SfxTabPage>(new OConnectionTabPage( pParent, *_rAttrSet ), SAL_NO_ACQUIRE);
+        return VclPtr<OConnectionTabPage>::Create( pParent, *_rAttrSet );
     }
 
     // OConnectionTabPage
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.hxx b/dbaccess/source/ui/dlg/ConnectionPage.hxx
index 2b4626d..6f373cc 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<OConnectionTabPage>;
     protected:
         // user authentification
         VclPtr<FixedText>          m_pFL2;
diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
index b081ad8..fd82603 100644
--- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
@@ -65,27 +65,27 @@ namespace dbaui
 
     VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateDbaseTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return VclPtr<OGenericAdministrationPage>( 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<OConnectionTabPageSetup>::Create ( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_DBASE_HELPTEXT, STR_DBASE_HEADERTEXT, STR_DBASE_PATH_OR_FILE );
     }
 
     VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateMSAccessTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return VclPtr<OGenericAdministrationPage>( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_MSACCESS_HELPTEXT, STR_MSACCESS_HEADERTEXT, STR_MSACCESS_MDB_FILE), SAL_NO_ACQUIRE );
+        return VclPtr<OConnectionTabPageSetup>::Create( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_MSACCESS_HELPTEXT, STR_MSACCESS_HEADERTEXT, STR_MSACCESS_MDB_FILE );
     }
 
     VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateADOTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return VclPtr<OGenericAdministrationPage>( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ADO_HELPTEXT, STR_ADO_HEADERTEXT, STR_COMMONURL), SAL_NO_ACQUIRE );
+        return VclPtr<OConnectionTabPageSetup>::Create( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ADO_HELPTEXT, STR_ADO_HEADERTEXT, STR_COMMONURL );
     }
 
     VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateODBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return VclPtr<OGenericAdministrationPage>( 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<OConnectionTabPageSetup>::Create( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ODBC_HELPTEXT, STR_ODBC_HEADERTEXT, STR_NAME_OF_ODBC_DATASOURCE );
     }
 
     VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateUserDefinedTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return VclPtr<OGenericAdministrationPage>( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, USHRT_MAX, USHRT_MAX, STR_COMMONURL), SAL_NO_ACQUIRE );
+        return VclPtr<OConnectionTabPageSetup>::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 1f0a22c..cad08bc 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<OConnectionTabPageSetup>;
         bool            m_bUserGrabFocus : 1;
     protected:
 
diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx
index ee25dd3..5e9afea 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.cxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.cxx
@@ -204,7 +204,7 @@ void OUserAdmin::FillUserNames()
 
 VclPtr<SfxTabPage> OUserAdmin::Create( vcl::Window* pParent, const SfxItemSet* _rAttrSet )
 {
-    return VclPtr<SfxTabPage>(new OUserAdmin( pParent, *_rAttrSet ), SAL_NO_ACQUIRE);
+    return VclPtr<OUserAdmin>::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 eeea260..f08b43f 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<OUserAdmin>;
 protected:
     VclPtr<ListBox>             m_pUSER;
     VclPtr<PushButton>          m_pNEWUSER;
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 3b85887..e7b2088 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<OSQLMessageBox>::Create(pWindow,e)->Execute();
         }
         throw;
     }
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index 63c8232..d0378ad 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<SplashScreenWindow>::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 bee83d8..db810db 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<BibBookContainer> 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 f93aee0..2f8bd08 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<FwkTabWindow>::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 813999a..fc9eb56 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>;
     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 3dfbf8a..d74f344 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<VirtualDevice> 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 163b874..d75a976 100644
--- a/sc/source/ui/attrdlg/tabpages.cxx
+++ b/sc/source/ui/attrdlg/tabpages.cxx
@@ -75,7 +75,7 @@ void ScTabPageProtection::dispose()
 
 VclPtr<SfxTabPage> ScTabPageProtection::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>( new ScTabPageProtection( pParent, *rAttrSet ), SAL_NO_ACQUIRE );
+    return VclPtr<ScTabPageProtection>::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 470a0b8..98ba533 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<Edit>::Create(this)),
     maChecks(VclPtr<ScCheckListBox>::Create(this,  WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT) ),
     maChkToggleAll(VclPtr<TriStateBox>::Create(this, 0)),
     maBtnSelectSingle(VclPtr<ImageButton>::Create(this, 0)),
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index c41bbc1..e36c39f 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<SfxTabPage> ScTpSubTotalGroup1::Create( vcl::Window*         pParent,
                                                  const SfxItemSet*  rArgSet )
-    { return VclPtr<SfxTabPage>( new ScTpSubTotalGroup1( pParent, *rArgSet ), SAL_NO_ACQUIRE ); }
+{
+    return VclPtr<ScTpSubTotalGroup1>::Create( pParent, *rArgSet );
+}
 
 VclPtr<SfxTabPage> ScTpSubTotalGroup2::Create( vcl::Window*          pParent,
                                        const SfxItemSet*    rArgSet )
-    { return VclPtr<SfxTabPage>( new ScTpSubTotalGroup2( pParent, *rArgSet ), SAL_NO_ACQUIRE ); }
+{
+    return VclPtr<ScTpSubTotalGroup2>::Create( pParent, *rArgSet );
+}
 
 VclPtr<SfxTabPage> ScTpSubTotalGroup3::Create( vcl::Window*          pParent,
                                        const SfxItemSet*    rArgSet )
-    { return VclPtr<SfxTabPage>( new ScTpSubTotalGroup3( pParent, *rArgSet ), SAL_NO_ACQUIRE ); }
+{
+    return VclPtr<ScTpSubTotalGroup3>::Create( pParent, *rArgSet );
+}
 
 ScTpSubTotalGroup1::ScTpSubTotalGroup1( vcl::Window* pParent, const SfxItemSet& rArgSet ) :
     ScTpSubTotalGroup( pParent, rArgSet )
@@ -487,7 +493,7 @@ void ScTpSubTotalOptions::Init()
 VclPtr<SfxTabPage> ScTpSubTotalOptions::Create( vcl::Window* pParent,
                                                 const SfxItemSet* rArgSet )
 {
-    return VclPtr<SfxTabPage>( new ScTpSubTotalOptions( pParent, *rArgSet ), SAL_NO_ACQUIRE );
+    return VclPtr<ScTpSubTotalOptions>::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 54edca1..23fb0f8 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -407,7 +407,7 @@ void ScTPValidationValue::Init()
 
 VclPtr<SfxTabPage> ScTPValidationValue::Create( vcl::Window* pParent, const SfxItemSet* rArgSet )
 {
-    return VclPtr<SfxTabPage>(new ScTPValidationValue( pParent, *rArgSet ), SAL_NO_ACQUIRE);
+    return VclPtr<ScTPValidationValue>::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 c18f331..0be22a9 100644
--- a/sc/source/ui/docshell/tpstat.cxx
+++ b/sc/source/ui/docshell/tpstat.cxx
@@ -29,7 +29,7 @@
 
 VclPtr<SfxTabPage> ScDocStatPage::Create( vcl::Window *pParent, const SfxItemSet* rSet )
 {
-    return VclPtr<SfxTabPage>( new ScDocStatPage ( pParent, *rSet ), SAL_NO_ACQUIRE );
+    return VclPtr<ScDocStatPage>::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 c22ec25..3fddc29 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<ScRightHeaderEditPage>;
 public:
     static VclPtr<SfxTabPage>  Create( vcl::Window* pParent, const SfxItemSet* rCoreSet );
 
@@ -113,6 +114,7 @@ private:
 
 class ScLeftHeaderEditPage : public ScHFEditPage
 {
+    friend class VclPtr<ScLeftHeaderEditPage>;
 public:
     static VclPtr<SfxTabPage>  Create( vcl::Window* pParent, const SfxItemSet* rCoreSet );
 
@@ -122,6 +124,7 @@ private:
 
 class ScRightFooterEditPage : public ScHFEditPage
 {
+    friend class VclPtr<ScRightFooterEditPage>;
 public:
     static VclPtr<SfxTabPage>  Create( vcl::Window* pParent, const SfxItemSet* rCoreSet );
 
@@ -131,6 +134,7 @@ private:
 
 class ScLeftFooterEditPage : public ScHFEditPage
 {
+    friend class VclPtr<ScLeftFooterEditPage>;
 public:
     static VclPtr<SfxTabPage>  Create( vcl::Window* pParent, const SfxItemSet* rCoreSet );
 
diff --git a/sc/source/ui/inc/tabpages.hxx b/sc/source/ui/inc/tabpages.hxx
index c2f9c38..b2c2014 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<ScTabPageProtection>;
     static const sal_uInt16 pProtectionRanges[];
 public:
     static  VclPtr<SfxTabPage> Create          ( vcl::Window*               pParent,
diff --git a/sc/source/ui/inc/tpcalc.hxx b/sc/source/ui/inc/tpcalc.hxx
index 25bd390..0b27e75 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<ScTpCalcOptions>;
 public:
     static  VclPtr<SfxTabPage> Create          ( vcl::Window*               pParent,
                                           const SfxItemSet*     rCoreSet );
diff --git a/sc/source/ui/inc/tpcompatibility.hxx b/sc/source/ui/inc/tpcompatibility.hxx
index 550bd9b..322e50d 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<ScTpCompatOptions>;
 public:
     using SfxTabPage::DeactivatePage;
 
diff --git a/sc/source/ui/inc/tpdefaults.hxx b/sc/source/ui/inc/tpdefaults.hxx
index 429cbab..deb2673 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<ScTpDefaultsOptions>;
 public:
     using SfxTabPage::DeactivatePage;
 
diff --git a/sc/source/ui/inc/tpformula.hxx b/sc/source/ui/inc/tpformula.hxx
index 7397d06..a3175b8 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<ScTpFormulaOptions>;
 public:
     using SfxTabPage::DeactivatePage;
 
diff --git a/sc/source/ui/inc/tphf.hxx b/sc/source/ui/inc/tphf.hxx
index da972cb..9f5c8a5 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<ScHeaderPage>;
 public:
     static VclPtr<SfxTabPage>  Create( vcl::Window* pParent, const SfxItemSet* rSet );
     static const sal_uInt16*      GetRanges();
@@ -70,6 +71,7 @@ private:
 
 class ScFooterPage : public ScHFPage
 {
+    friend class VclPtr<ScFooterPage>;
 public:
     static VclPtr<SfxTabPage>  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 5b8370f..bf38a92 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<ScTpPrintOptions>;
     VclPtr<CheckBox>       m_pSkipEmptyPagesCB;
     VclPtr<CheckBox>       m_pSelectedSheetsCB;
     VclPtr<CheckBox>       m_pForceBreaksCB;
diff --git a/sc/source/ui/inc/tpstat.hxx b/sc/source/ui/inc/tpstat.hxx
index d143610..14478dc7 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<ScDocStatPage>;
 public:
     static VclPtr<SfxTabPage> 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 a54536c..3295262 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<ScTpSubTotalGroup1>;
 protected:
             ScTpSubTotalGroup1( vcl::Window*              pParent,
                                 const SfxItemSet&    rArgSet );
@@ -91,6 +92,7 @@ public:
 
 class ScTpSubTotalGroup2 : public ScTpSubTotalGroup
 {
+    friend class VclPtr<ScTpSubTotalGroup2>;
 protected:
             ScTpSubTotalGroup2( vcl::Window*              pParent,
                                 const SfxItemSet&    rArgSet );
@@ -106,6 +108,7 @@ public:
 
 class ScTpSubTotalGroup3 : public ScTpSubTotalGroup
 {
+    friend class VclPtr<ScTpSubTotalGroup3>;
 protected:
             ScTpSubTotalGroup3( vcl::Window*              pParent,
                                 const SfxItemSet&    rArgSet );
@@ -121,6 +124,7 @@ public:
 
 class ScTpSubTotalOptions : public SfxTabPage
 {
+    friend class VclPtr<ScTpSubTotalOptions>;
 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 e135c91..46042b8 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<ScTablePage>;
     static const sal_uInt16 pPageTableRanges[];
 public:
     static  VclPtr<SfxTabPage> Create          ( vcl::Window*           pParent,
diff --git a/sc/source/ui/inc/tpusrlst.hxx b/sc/source/ui/inc/tpusrlst.hxx
index a0c8663..2a4c28f 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<ScTpUserLists>;
 public:
     static  VclPtr<SfxTabPage> Create          ( vcl::Window*               pParent,
                                           const SfxItemSet*     rAttrSet );
diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx
index f31c850..baece6c 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<ScTpContentOptions>;
     VclPtr<ListBox>         pGridLB;
     VclPtr<FixedText>       pColorFT;
     VclPtr<ColorListBox>    pColorLB;
@@ -84,6 +85,7 @@ public:
 class ScDocument;
 class ScTpLayoutOptions : public SfxTabPage
 {
+    friend class VclPtrInstance<ScTpLayoutOptions>;
     VclPtr<ListBox>        m_pUnitLB;
     VclPtr<MetricField>    m_pTabMF;
 
diff --git a/sc/source/ui/miscdlgs/filldlg.cxx b/sc/source/ui/miscdlgs/filldlg.cxx
index 4a0113d..73244b6 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<MessageDialog>::Create(this, aErrMsgInvalidVal)->Execute();
         pEdWrong->GrabFocus();
     }
 
diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx
index fb9a601..fb7f9ff 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<MessageDialog>::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<MessageDialog>::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 74cbf88..a3fad62 100644
--- a/sc/source/ui/optdlg/tpcalc.cxx
+++ b/sc/source/ui/optdlg/tpcalc.cxx
@@ -103,7 +103,7 @@ void ScTpCalcOptions::Init()
 
 VclPtr<SfxTabPage> ScTpCalcOptions::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>( new ScTpCalcOptions ( pParent, *rAttrSet ), SAL_NO_ACQUIRE );
+    return VclPtr<ScTpCalcOptions>::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<MessageDialog>::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 ca82829..3c83b98 100644
--- a/sc/source/ui/optdlg/tpcompatibility.cxx
+++ b/sc/source/ui/optdlg/tpcompatibility.cxx
@@ -34,7 +34,7 @@ void ScTpCompatOptions::dispose()
 
 VclPtr<SfxTabPage> ScTpCompatOptions::Create(vcl::Window *pParent, const SfxItemSet *rCoreAttrs)
 {
-    return VclPtr<SfxTabPage>(new ScTpCompatOptions(pParent, *rCoreAttrs), SAL_NO_ACQUIRE);
+    return VclPtr<ScTpCompatOptions>::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 79b8475..a2929f7 100644
--- a/sc/source/ui/optdlg/tpdefaults.cxx
+++ b/sc/source/ui/optdlg/tpdefaults.cxx
@@ -42,7 +42,7 @@ void ScTpDefaultsOptions::dispose()
 
 VclPtr<SfxTabPage> ScTpDefaultsOptions::Create(vcl::Window *pParent, const SfxItemSet *rCoreAttrs)
 {
-    return VclPtr<SfxTabPage>(new ScTpDefaultsOptions(pParent, *rCoreAttrs), SAL_NO_ACQUIRE);
+    return VclPtr<ScTpDefaultsOptions>::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 3e7feb1..2e4643e 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<SfxTabPage> ScTpFormulaOptions::Create(vcl::Window* pParent, const SfxItemSet* rCoreSet)
 {
-    return VclPtr<SfxTabPage>(new ScTpFormulaOptions(pParent, *rCoreSet), SAL_NO_ACQUIRE);
+    return VclPtr<ScTpFormulaOptions>::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 e38c830..6ee0b89 100644
--- a/sc/source/ui/optdlg/tpprint.cxx
+++ b/sc/source/ui/optdlg/tpprint.cxx
@@ -54,7 +54,7 @@ void ScTpPrintOptions::dispose()
 
 VclPtr<SfxTabPage> ScTpPrintOptions::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>(new ScTpPrintOptions( pParent, *rAttrSet ), SAL_NO_ACQUIRE);
+    return VclPtr<ScTpPrintOptions>::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 d1fab49..3f0e9e8 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -155,7 +155,7 @@ void ScTpUserLists::Init()
 
 VclPtr<SfxTabPage> ScTpUserLists::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>( new ScTpUserLists( pParent, *rAttrSet ), SAL_NO_ACQUIRE );
+    return VclPtr<ScTpUserLists>::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<ScColOrRowDlg>::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<MessageDialog>::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 f1a475f..c1ba49a 100644
--- a/sc/source/ui/optdlg/tpview.cxx
+++ b/sc/source/ui/optdlg/tpview.cxx
@@ -128,7 +128,7 @@ void ScTpContentOptions::dispose()
 VclPtr<SfxTabPage> ScTpContentOptions::Create( vcl::Window*     pParent,
                                                const SfxItemSet*     rCoreSet )
 {
-    return VclPtr<SfxTabPage>( new ScTpContentOptions (pParent, *rCoreSet), SAL_NO_ACQUIRE );
+    return VclPtr<ScTpContentOptions>::Create(pParent, *rCoreSet);
 }
 
 bool    ScTpContentOptions::FillItemSet( SfxItemSet* rCoreSet )
@@ -460,7 +460,7 @@ void ScTpLayoutOptions::dispose()
 VclPtr<SfxTabPage> ScTpLayoutOptions::Create( vcl::Window*          pParent,
                                               const SfxItemSet*   rCoreSet )
 {
-    VclPtr<ScTpLayoutOptions> pNew( new ScTpLayoutOptions( pParent, *rCoreSet), SAL_NO_ACQUIRE );
+    VclPtrInstance<ScTpLayoutOptions> 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 59b24a0..1a14789 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<SfxTabPage> ScRightHeaderEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet )
-    { return VclPtr<SfxTabPage>( new ScRightHeaderEditPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); }
+{
+    return VclPtr<ScRightHeaderEditPage>::Create( pParent, *rCoreSet );
+}
 
 // class ScLeftHeaderEditPage
 
@@ -879,7 +881,9 @@ ScLeftHeaderEditPage::ScLeftHeaderEditPage( vcl::Window* pParent, const SfxItemS
     {}
 
 VclPtr<SfxTabPage> ScLeftHeaderEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet )
-    { return VclPtr<SfxTabPage>( new ScLeftHeaderEditPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); };
+{
+    return VclPtr<ScLeftHeaderEditPage>::Create( pParent, *rCoreSet );
+}
 
 // class ScRightFooterEditPage
 
@@ -891,7 +895,9 @@ ScRightFooterEditPage::ScRightFooterEditPage( vcl::Window* pParent, const SfxIte
     {}
 
 VclPtr<SfxTabPage> ScRightFooterEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet )
-    { return VclPtr<SfxTabPage>( new ScRightFooterEditPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); };
+{
+    return VclPtr<ScRightFooterEditPage>::Create( pParent, *rCoreSet );
+}
 
 // class ScLeftFooterEditPage
 
@@ -903,6 +909,8 @@ ScLeftFooterEditPage::ScLeftFooterEditPage( vcl::Window* pParent, const SfxItemS
     {}
 
 VclPtr<SfxTabPage> ScLeftFooterEditPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet )
-    { return VclPtr<SfxTabPage>( new ScLeftFooterEditPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE ); };
+{
+    return VclPtr<ScLeftFooterEditPage>::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 cf1918e..8575607 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<SfxTabPage> ScHeaderPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet )
 {
-    return VclPtr<SfxTabPage>( new ScHeaderPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE );
+    return VclPtr<ScHeaderPage>::Create( pParent, *rCoreSet );
 }
 
 const sal_uInt16* ScHeaderPage::GetRanges()
@@ -266,7 +266,7 @@ ScFooterPage::ScFooterPage( vcl::Window* pParent, const SfxItemSet& rSet )
 
 VclPtr<SfxTabPage> ScFooterPage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet )
 {
-    return VclPtr<SfxTabPage>( new ScFooterPage( pParent, *rCoreSet ), SAL_NO_ACQUIRE );
+    return VclPtr<ScFooterPage>::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 910bc3f..685e288 100644
--- a/sc/source/ui/pagedlg/tptable.cxx
+++ b/sc/source/ui/pagedlg/tptable.cxx
@@ -156,7 +156,7 @@ void ScTablePage::dispose()
 
 VclPtr<SfxTabPage> ScTablePage::Create( vcl::Window* pParent, const SfxItemSet* rCoreSet )
 {
-    return VclPtr<SfxTabPage>( new ScTablePage( pParent, *rCoreSet ), SAL_NO_ACQUIRE );
+    return VclPtr<ScTablePage>::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 d557584..e3b77fd 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<CellLineStyleControl>::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<CellBorderStyleControl>::Create(pParent, *this);
 }
 
 void CellAppearancePropertyPanel::EndCellBorderStylePopupMode()
diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx
index 00e8eb1..7857685 100644
--- a/sc/source/ui/sidebar/ScPanelFactory.cxx
+++ b/sc/source/ui/sidebar/ScPanelFactory.cxx
@@ -94,12 +94,12 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement (
             pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings );
         else if (rsResourceURL.endsWith("/NavigatorPanel"))
         {
-            pPanel = VclPtr<vcl::Window>(new ScNavigatorDlg(pBindings, NULL, pParentWindow, false), SAL_NO_ACQUIRE);
+            pPanel = VclPtr<ScNavigatorDlg>::Create(pBindings, nullptr, pParentWindow, false);
             nMinimumSize = 0;
         }
         else if (rsResourceURL.endsWith("/FunctionsPanel"))
         {
-            pPanel = VclPtr<vcl::Window>(new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX)), SAL_NO_ACQUIRE);;
+            pPanel = VclPtr<ScFunctionDockWin>::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 6c12d03..b1b5d7f 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<MessageDialog>(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 29cfc5f..c3ae18d 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<MessageDialog>::Create(GetDialogParent(),
                                                      aErrMsg
-                                                   ).Execute();
+                                                   )->Execute();
                                 }
                             }
                         }
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
index ead579c..2da7991 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<XColorList> &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 1ab67e2..e700df1 100644
--- a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx
@@ -88,14 +88,12 @@ VclPtr<vcl::Window> AllMasterPagesSelector::Create (
 
     ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
 
-    VclPtr<MasterPagesSelector> pSelector(
-        new AllMasterPagesSelector (
+    VclPtrInstance<AllMasterPagesSelector> 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 58c9585..e63e00c 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<AllMasterPagesSelector>;
 public:
     static VclPtr<vcl::Window> Create (
         vcl::Window* pParent,
diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
index c900962..c772944 100644
--- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
@@ -53,14 +53,12 @@ VclPtr<vcl::Window> CurrentMasterPagesSelector::Create (
 
     ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
 
-    VclPtr<MasterPagesSelector> pSelector(
-        new CurrentMasterPagesSelector (
+    VclPtrInstance<CurrentMasterPagesSelector> 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 9443b99..b587a3f 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<CurrentMasterPagesSelector>;
 public:
     static VclPtr<vcl::Window> Create (
         vcl::Window* pParent,
diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx
index 73013aa..3adab6c 100644
--- a/sd/source/ui/sidebar/PanelFactory.cxx
+++ b/sd/source/ui/sidebar/PanelFactory.cxx
@@ -125,9 +125,9 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
 
 #define EndsWith(s,t) s.endsWithAsciiL(t,strlen(t))
     if (EndsWith(rsUIElementResourceURL, gsResourceNameCustomAnimations))
-        pControl = VclPtr<vcl::Window>(new CustomAnimationPanel(pParentWindow, *pBase, xFrame), SAL_NO_ACQUIRE);
+        pControl = VclPtr<CustomAnimationPanel>::Create(pParentWindow, *pBase, xFrame);
     else if (EndsWith(rsUIElementResourceURL, gsResourceNameLayouts))
-        pControl = VclPtr<vcl::Window>(new LayoutMenu(pParentWindow, *pBase, xSidebar), SAL_NO_ACQUIRE);
+        pControl = VclPtr<LayoutMenu>::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<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
     else if (EndsWith(rsUIElementResourceURL, gsResourceNameUsedMasterPages))
         pControl = CurrentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar);
     else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions))
-        pControl = VclPtr<vcl::Window>(new SlideTransitionPanel(pParentWindow, *pBase, xFrame), SAL_NO_ACQUIRE);
+        pControl = VclPtr<SlideTransitionPanel>::Create(pParentWindow, *pBase, xFrame);
     else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign))
-        pControl = VclPtr<vcl::Window>(new TableDesignPanel(pParentWindow, *pBase), SAL_NO_ACQUIRE);
+        pControl = VclPtr<TableDesignPanel>::Create(pParentWindow, *pBase);
     else if (EndsWith(rsUIElementResourceURL, gsResourceNameNavigator))
-        pControl = VclPtr<vcl::Window>(new NavigatorWrapper(pParentWindow, *pBase, pBindings), SAL_NO_ACQUIRE);
+        pControl = VclPtr<NavigatorWrapper>::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 b31e139..00c7db8 100644
--- a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
@@ -43,14 +43,12 @@ VclPtr<vcl::Window> RecentMasterPagesSelector::Create (
 
     ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
 
-    VclPtr<MasterPagesSelector> pSelector(
-        new RecentMasterPagesSelector (
+    VclPtrInstance<RecentMasterPagesSelector> 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 a7f4703..2a74f14 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<RecentMasterPagesSelector>;
 public:
     static VclPtr<vcl::Window> Create (
         vcl::Window* pParent,
diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx
index beb4dee..77c412b 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<MessageDialog> 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 d7f822d..2039b5d 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 a3aef2d..3357995 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<MessageDialog>(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 d8a49b3..1376f9e 100644
--- a/sfx2/source/sidebar/ControlFactory.cxx
+++ b/sfx2/source/sidebar/ControlFactory.cxx
@@ -27,12 +27,12 @@ namespace sfx2 { namespace sidebar {
 
 VclPtr<CheckBox> ControlFactory::CreateMenuButton (vcl::Window* pParentWindow)
 {
-    return VclPtr<CheckBox>(new MenuButton(pParentWindow), SAL_NO_ACQUIRE);
+    return VclPtr<MenuButton>::Create(pParentWindow);
 }
 
 VclPtr<ImageRadioButton> ControlFactory::CreateTabItem (vcl::Window* pParentWindow)
 {
-    return VclPtr<ImageRadioButton>(new TabItem(pParentWindow), SAL_NO_ACQUIRE);
+    return VclPtr<TabItem>::Create(pParentWindow);
 }
 
 } } // end of namespace sfx2::sidebar
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index dad3302..2d90b6a 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<SaveDefaultsQuery>::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<SaveDefaultsQuery>::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<SaveDefaultsQuery>::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<SaveDefaultsQuery>::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 a4c4431..05a7e6d 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<Printer>::Create();
     }
 
     return pTempPrinter;
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index 8b9dd52..55d0a48 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 34768b2..2767bb7 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<Printer>::Create();
         pImpl->mbDelPrinter = true;
     }
     SetMapMode(MapMode(MAP_TWIP));
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 009622d..fc5d15c 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<SvxSearchDialog>::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 a180731..2401be7 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<Printer>::Create();
         mbDelPrinter = true;
     }
 }
@@ -621,7 +621,7 @@ SfxTabPage::sfxpg SwDropCapsPage::DeactivatePage(SfxItemSet * _pSet)
 VclPtr<SfxTabPage> SwDropCapsPage::Create(vcl::Window *pParent,
                                           const SfxItemSet *rSet)
 {
-    return VclPtr<SfxTabPage>(new SwDropCapsPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwDropCapsPage>::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 26b8a21..ff8f908 100644
--- a/sw/source/ui/chrdlg/numpara.cxx
+++ b/sw/source/ui/chrdlg/numpara.cxx
@@ -126,8 +126,7 @@ void SwParagraphNumTabPage::dispose()
 VclPtr<SfxTabPage> SwParagraphNumTabPage::Create( vcl::Window* pParent,
                                                   const SfxItemSet* rSet )
 {
-    return VclPtr<SfxTabPage>( new SwParagraphNumTabPage(pParent, *rSet),
-                               SAL_NO_ACQUIRE );
+    return VclPtr<SwParagraphNumTabPage>::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 7b81325..62be945 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<SfxTabPage> SwCondCollPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
 {
-    return VclPtr<SfxTabPage>(new SwCondCollPage(pParent, *rSet),
-                              SAL_NO_ACQUIRE);
+    return VclPtr<SwCondCollPage>::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 758e53b..81a7d49a 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<SfxTabPage> SwAddPrinterTabPage::Create( vcl::Window* pParent,
                                                 const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>(new SwAddPrinterTabPage( pParent, *rAttrSet ),
-                              SAL_NO_ACQUIRE);
+    return VclPtr<SwAddPrinterTabPage>::Create( pParent, *rAttrSet );
 }
 
 bool    SwAddPrinterTabPage::FillItemSet( SfxItemSet* rCoreSet )
@@ -667,8 +666,7 @@ void SwStdFontTabPage::dispose()
 VclPtr<SfxTabPage> SwStdFontTabPage::Create( vcl::Window* pParent,
                                              const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>(new SwStdFontTabPage(pParent, *rAttrSet),
-                              SAL_NO_ACQUIRE);
+    return VclPtr<SwStdFontTabPage>::Create(pParent, *rAttrSet);
 }
 
 static void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType,
@@ -1192,8 +1190,7 @@ void SwTableOptionsTabPage::dispose()
 VclPtr<SfxTabPage> SwTableOptionsTabPage::Create( vcl::Window* pParent,
                                                   const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>( new SwTableOptionsTabPage(pParent, *rAttrSet ),
-                               SAL_NO_ACQUIRE );
+    return VclPtr<SwTableOptionsTabPage>::Create(pParent, *rAttrSet);
 }
 
 bool SwTableOptionsTabPage::FillItemSet( SfxItemSet* )
@@ -1453,7 +1450,7 @@ void SwShdwCrsrOptionsTabPage::dispose()
 
 VclPtr<SfxTabPage> SwShdwCrsrOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
 {
-    return VclPtr<SfxTabPage>(new SwShdwCrsrOptionsTabPage( pParent, *rSet ), SAL_NO_ACQUIRE);
+    return VclPtr<SwShdwCrsrOptionsTabPage>::Create( pParent, *rSet );
 }
 
 void SwShdwCrsrOptionsTabPage::PageCreated( const SfxAllItemSet& aSet )
@@ -1874,7 +1871,7 @@ void SwRedlineOptionsTabPage::dispose()
 
 VclPtr<SfxTabPage> SwRedlineOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>( new SwRedlineOptionsTabPage( pParent, *rSet ), SAL_NO_ACQUIRE );
+    return VclPtr<SwRedlineOptionsTabPage>::Create( pParent, *rSet );
 }
 
 bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* )
@@ -2388,7 +2385,7 @@ void SwCompareOptionsTabPage::dispose()
 
 VclPtr<SfxTabPage> SwCompareOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
 {
-    return VclPtr<SfxTabPage>(new SwCompareOptionsTabPage( pParent, *rAttrSet ), SAL_NO_ACQUIRE);
+    return VclPtr<SwCompareOptionsTabPage>::Create( pParent, *rAttrSet );
 }
 
 bool SwCompareOptionsTabPage::FillItemSet( SfxItemSet* )
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index 3a9f6b4..906825a 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -461,7 +461,7 @@ void SwEnvFormatPage::SetMinMax()
 
 VclPtr<SfxTabPage> SwEnvFormatPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>(new SwEnvFormatPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwEnvFormatPage>::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 be34f66..8e20c6a 100644
--- a/sw/source/ui/envelp/envlop1.cxx
+++ b/sw/source/ui/envelp/envlop1.cxx
@@ -321,7 +321,7 @@ void SwEnvPage::InitDatabaseBox()
 
 VclPtr<SfxTabPage> SwEnvPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>(new SwEnvPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwEnvPage>::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 b256af9..8fb8a391 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<SfxTabPage> SwEnvPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>(new SwEnvPrtPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwEnvPrtPage>::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 dfffd5d..96c02c2 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -488,7 +488,7 @@ void SwLabPage::InitDatabaseBox()
 
 VclPtr<SfxTabPage> SwLabPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>(new SwLabPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwLabPage>::Create(pParent, *rSet);
 }
 
 void SwLabPage::ActivatePage(const SfxItemSet& rSet)
@@ -633,7 +633,7 @@ void SwVisitingCardPage::dispose()
 
 VclPtr<SfxTabPage> SwVisitingCardPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>(new SwVisitingCardPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwVisitingCardPage>::Create(pParent, *rSet);
 }
 
 void SwVisitingCardPage::ActivatePage(const SfxItemSet& rSet)
@@ -794,7 +794,7 @@ void SwPrivateDataPage::dispose()
 
 VclPtr<SfxTabPage> SwPrivateDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>(new SwPrivateDataPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwPrivateDataPage>::Create(pParent, *rSet);
 }
 
 void SwPrivateDataPage::ActivatePage(const SfxItemSet& rSet)
@@ -907,7 +907,7 @@ void SwBusinessDataPage::dispose()
 
 VclPtr<SfxTabPage> SwBusinessDataPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>(new SwBusinessDataPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwBusinessDataPage>::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 e8b3d53..6ed49bc 100644
--- a/sw/source/ui/envelp/labfmt.cxx
+++ b/sw/source/ui/envelp/labfmt.cxx
@@ -488,7 +488,7 @@ void SwLabFormatPage::ChangeMinMax()
 
 VclPtr<SfxTabPage> SwLabFormatPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>(new SwLabFormatPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwLabFormatPage>::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 ae5970d..ae81bbe 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<Printer>::Create();
 
         VclPtrInstance< PrinterSetupDialog > pDlg(this);
         pDlg->SetPrinter(pPrinter);
@@ -110,7 +110,7 @@ IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton )
 
 VclPtr<SfxTabPage> SwLabPrtPage::Create(vcl::Window* pParent, const SfxItemSet* rSet)
 {
-    return VclPtr<SfxTabPage>(new SwLabPrtPage( pParent, *rSet ), SAL_NO_ACQUIRE);
+    return VclPtr<SwLabPrtPage>::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 43766da..9039269 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<SfxTabPage> SwColumnPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
 {
-    return VclPtr<SfxTabPage>(new SwColumnPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwColumnPage>::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 ae47f51..3c06257 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -861,7 +861,7 @@ void SwFrmPage::setOptimalRelWidth()
 
 VclPtr<SfxTabPage> SwFrmPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
 {
-    return VclPtr<SfxTabPage>(new SwFrmPage( pParent, *rSet ), SAL_NO_ACQUIRE);
+    return VclPtr<SwFrmPage>::Create( pParent, *rSet );
 }
 
 void SwFrmPage::EnableGraficMode()
@@ -2423,7 +2423,7 @@ void SwGrfExtPage::dispose()
 
 VclPtr<SfxTabPage> SwGrfExtPage::Create( vcl::Window *pParent, const SfxItemSet *rSet )
 {
-    return VclPtr<SfxTabPage>(new SwGrfExtPage( pParent, *rSet ), SAL_NO_ACQUIRE);
+    return VclPtr<SwGrfExtPage>::Create( pParent, *rSet );
 }
 
 void SwGrfExtPage::Reset(const SfxItemSet *rSet)
@@ -2850,7 +2850,7 @@ bool SwFrmURLPage::FillItemSet(SfxItemSet *rSet)
 
 VclPtr<SfxTabPage> SwFrmURLPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
 {
-    return VclPtr<SfxTabPage>(new SwFrmURLPage( pParent, *rSet ), SAL_NO_ACQUIRE);
+    return VclPtr<SwFrmURLPage>::Create( pParent, *rSet );
 }
 
 IMPL_LINK_NOARG(SwFrmURLPage, InsertFileHdl)
@@ -2942,7 +2942,7 @@ void SwFrmAddPage::dispose()
 
 VclPtr<SfxTabPage> SwFrmAddPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
 {
-    return VclPtr<SfxTabPage>(new SwFrmAddPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwFrmAddPage>::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 d9a0cbd..c3b1373 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -157,7 +157,7 @@ void SwWrapTabPage::dispose()
 
 VclPtr<SfxTabPage> SwWrapTabPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
 {
-    return VclPtr<SfxTabPage>(new SwWrapTabPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwWrapTabPage>::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 0324d6f..9648c96 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<Edit>::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 5703e6d..797ba4e 100644
--- a/sw/source/ui/misc/docfnote.cxx
+++ b/sw/source/ui/misc/docfnote.cxx
@@ -423,7 +423,7 @@ SwFootNoteOptionPage::~SwFootNoteOptionPage()
 
 VclPtr<SfxTabPage> SwFootNoteOptionPage::Create(vcl::Window *pParent, const SfxItemSet *rSet )
 {
-    return VclPtr<SfxTabPage>(new SwFootNoteOptionPage( pParent, *rSet ), SAL_NO_ACQUIRE);
+    return VclPtr<SwFootNoteOptionPage>::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 8d291d0..c7390af 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>;
     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 49ac9ab..11698c3 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -153,7 +153,7 @@ void SwFootNotePage::dispose()
 
 VclPtr<SfxTabPage> SwFootNotePage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
 {
-    return VclPtr<SfxTabPage>(new SwFootNotePage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwFootNotePage>::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 f725eba..ef7823c 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -182,7 +182,7 @@ void SwTextGridPage::dispose()
 
 VclPtr<SfxTabPage> SwTextGridPage::Create(vcl::Window *pParent, const SfxItemSet *rSet)
 {
-    return VclPtr<SfxTabPage>(new SwTextGridPage(pParent, *rSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwTextGridPage>::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 d27f981..6283bbd 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -1372,7 +1372,7 @@ void SwTextFlowPage::dispose()
 VclPtr<SfxTabPage> SwTextFlowPage::Create( vcl::Window* pParent,
                                            const SfxItemSet* rAttrSet)
 {
-    return VclPtr<SfxTabPage>(new SwTextFlowPage(pParent, *rAttrSet), SAL_NO_ACQUIRE);
+    return VclPtr<SwTextFlowPage>::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 1d7cf89..87123fd 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<MessageDialog>::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<MessageDialog>::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 0805005..01dbd79 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<MessageDialog>::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 6c5a5cd..9ce682a 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -221,7 +221,7 @@ VclPtr<MenuButton> SwAnnotationWin::CreateMenuButton()
     aRewriter.AddRule(UndoArg1,GetAuthor());
     aText = aRewriter.Apply(aText);
     mpButtonPopup->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
-    VclPtr<MenuButton> pMenuButton( new AnnotationMenuButton( *this ), SAL_NO_ACQUIRE );
+    VclPtrInstance<AnnotationMenuButton> 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 eb82784..bcc3650 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<SwStdFontTabPage>;
     VclPtr<FixedText>       pLabelFT;
 
     VclPtr<ComboBox>        pStandardBox;
diff --git a/sw/source/uibase/inc/pgfnote.hxx b/sw/source/uibase/inc/pgfnote.hxx
index 49f1974..223fe38 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<SwFootNotePage>;
     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 2c37741..d1a675e 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<svx::sidebar::ValueSetWithTextControl>::Create( svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) )
     , maMoreButton( VclPtr<PushButton>::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 5a80668..7d5fe56 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<svx::sidebar::ValueSetWithTextControl>::Create( svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_MARGIN) ) )
     , maCustom(VclPtr<FixedText>::Create(this, SW_RES(FT_CUSTOM)))
     , maLeft(VclPtr<FixedText>::Create(this, SW_RES(FT_LEFT)))
     , maInner(VclPtr<FixedText>::Create(this, SW_RES(FT_INNER)))
diff --git a/sw/source/uibase/sidebar/PageOrientationControl.cxx b/sw/source/uibase/sidebar/PageOrientationControl.cxx
index 1c3dc35..18da73a 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) )

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list