[Libreoffice-commits] core.git: Branch 'feature/vclptr' - cui/source svtools/source vcl/README.lifecycle

Michael Meeks michael.meeks at collabora.com
Sat Apr 18 13:55:00 PDT 2015


 cui/source/customize/cfg.cxx                |   12 +-
 cui/source/customize/macropg.cxx            |    6 -
 cui/source/dialogs/SpellDialog.cxx          |    2 
 cui/source/dialogs/cuicharmap.cxx           |    2 
 cui/source/dialogs/cuigaldlg.cxx            |    6 -
 cui/source/dialogs/cuihyperdlg.cxx          |    2 
 cui/source/dialogs/hangulhanjadlg.cxx       |    4 
 cui/source/dialogs/hldocntp.cxx             |    4 
 cui/source/dialogs/hldoctp.cxx              |    4 
 cui/source/dialogs/hlinettp.cxx             |    4 
 cui/source/dialogs/hlmailtp.cxx             |    4 
 cui/source/dialogs/iconcdlg.cxx             |    4 
 cui/source/dialogs/multipat.cxx             |    2 
 cui/source/dialogs/scriptdlg.cxx            |    2 
 cui/source/factory/dlgfact.cxx              |  160 ++++++++++++++--------------
 cui/source/inc/hldocntp.hxx                 |    2 
 cui/source/inc/hldoctp.hxx                  |    2 
 cui/source/inc/hlinettp.hxx                 |    2 
 cui/source/inc/hlmailtp.hxx                 |    2 
 cui/source/inc/iconcdlg.hxx                 |    4 
 cui/source/options/certpath.cxx             |    2 
 cui/source/options/fontsubs.cxx             |    2 
 cui/source/options/optaboutconfig.cxx       |    4 
 cui/source/options/optcolor.cxx             |   16 +-
 cui/source/options/optdict.cxx              |    3 
 cui/source/options/optfltr.cxx              |    2 
 cui/source/options/optinet2.cxx             |    4 
 cui/source/options/optjava.cxx              |    6 -
 cui/source/options/optopencl.cxx            |    4 
 cui/source/options/optpath.cxx              |    2 
 cui/source/options/treeopt.cxx              |    3 
 cui/source/options/webconninfo.cxx          |    2 
 cui/source/tabpages/autocdlg.cxx            |    4 
 cui/source/tabpages/chardlg.cxx             |    2 
 cui/source/tabpages/connect.cxx             |    2 
 cui/source/tabpages/dstribut.cxx            |    2 
 cui/source/tabpages/measure.cxx             |    2 
 cui/source/tabpages/tpbitmap.cxx            |    4 
 cui/source/tabpages/tpgradnt.cxx            |    2 
 cui/source/tabpages/tphatch.cxx             |    2 
 svtools/source/toolpanel/drawerlayouter.cxx |    4 
 vcl/README.lifecycle                        |    1 
 42 files changed, 152 insertions(+), 153 deletions(-)

New commits:
commit 354df32a6da2557ac9edc0937b0032406bc6ba15
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat Apr 18 20:48:34 2015 +0100

    cui: convert new to ::Create.
    
    Change-Id: Ifad69772a4954f14772cca9eeae913e546eff477

diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 05bbcd5..3606a61 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2206,7 +2206,7 @@ bool SvxConfigPage::MoveEntryData(
 SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSet)
     : SvxConfigPage(pParent, rSet)
 {
-    m_pContentsListBox = new SvxMenuEntriesListBox(m_pEntries, this);
+    m_pContentsListBox = VclPtr<SvxMenuEntriesListBox>::Create(m_pEntries, this);
     m_pContentsListBox->set_grid_left_attach(0);
     m_pContentsListBox->set_grid_top_attach(0);
     m_pContentsListBox->set_hexpand(true);
@@ -2461,7 +2461,7 @@ IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton )
         SvxConfigEntry* pMenuData = GetTopLevelSelection();
 
         VclPtr<SvxMainMenuOrganizerDialog> pDialog(
-            new SvxMainMenuOrganizerDialog( this,
+            VclPtr<SvxMainMenuOrganizerDialog>::Create( this,
                 GetSaveInData()->GetEntries(), pMenuData ));
 
         if ( pDialog->Execute() == RET_OK )
@@ -2583,7 +2583,7 @@ IMPL_LINK( SvxMenuConfigPage, AddCommandsHdl, Button *, pButton )
     if ( m_pSelectorDlg == nullptr )
     {
         // Create Script Selector which also shows builtin commands
-        m_pSelectorDlg = new SvxScriptSelectorDialog( this, true, m_xFrame );
+        m_pSelectorDlg = VclPtr<SvxScriptSelectorDialog>::Create( this, true, m_xFrame );
 
         m_pSelectorDlg->SetAddHdl(
             LINK( this, SvxMenuConfigPage, AddFunctionHdl ) );
@@ -2887,7 +2887,7 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
 {
     SetHelpId( HID_SVX_CONFIG_TOOLBAR );
 
-    m_pContentsListBox = new SvxToolbarEntriesListBox(m_pEntries, this);
+    m_pContentsListBox = VclPtr<SvxToolbarEntriesListBox>::Create(m_pEntries, this);
     m_pContentsListBox->set_grid_left_attach(0);
     m_pContentsListBox->set_grid_top_attach(0);
     m_pContentsListBox->set_hexpand(true);
@@ -3319,7 +3319,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton )
             }
 
             VclPtr<SvxIconSelectorDialog> pIconDialog(
-                new SvxIconSelectorDialog( 0,
+                VclPtr<SvxIconSelectorDialog>::Create( nullptr,
                     GetSaveInData()->GetImageManager(),
                     GetSaveInData()->GetParentImageManager() ));
 
@@ -4504,7 +4504,7 @@ IMPL_LINK( SvxToolbarConfigPage, AddCommandsHdl, Button *, pButton )
     if ( m_pSelectorDlg == nullptr )
     {
         // Create Script Selector which shows slot commands
-        m_pSelectorDlg = new SvxScriptSelectorDialog( this, true, m_xFrame );
+        m_pSelectorDlg = VclPtr<SvxScriptSelectorDialog>::Create( this, true, m_xFrame );
 
         // Position the Script Selector over the Add button so it is
         // beside the menu contents list and does not obscure it
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index a54a29b..cc1956a 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -130,8 +130,8 @@ bool MacroEventListBox::Notify( NotifyEvent& rNEvt )
 
 MacroEventListBox::MacroEventListBox( vcl::Window* pParent, WinBits nStyle )
     : Control( pParent, nStyle )
-    , maHeaderBar( new HeaderBar( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER ) )
-    , maListBox( new SvHeaderTabListBox( this, WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ) )
+    , maHeaderBar( VclPtr<HeaderBar>::Create( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER ) )
+    , maListBox( VclPtr<SvHeaderTabListBox>::Create( this, WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ) )
 {
     maListBox->SetHelpId( HID_MACRO_HEADERTABLISTBOX );
 
@@ -854,7 +854,7 @@ SvxMacroAssignDlg::SvxMacroAssignDlg( vcl::Window* pParent, const Reference< fra
     const Reference< container::XNameReplace >& xNameReplace, sal_uInt16 nSelectedIndex )
         : SvxMacroAssignSingleTabDialog(pParent, rSet)
 {
-    SetTabPage(new SvxMacroTabPage(get_content_area(), _rxDocumentFrame, rSet, xNameReplace, nSelectedIndex));
+    SetTabPage(VclPtr<SvxMacroTabPage>::Create(get_content_area(), _rxDocumentFrame, rSet, xNameReplace, nSelectedIndex));
 }
 
 
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index f2e62e7..87b6fbe 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -524,7 +524,7 @@ void SpellDialog::StartSpellOptDlg_Impl()
     SfxItemSet aSet( SfxGetpApp()->GetPool(), aSpellInfos);
     aSet.Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL ));
     VclPtr<SfxSingleTabDialog> pDlg(
-        new SfxSingleTabDialog(this, aSet, "SpellOptionsDialog", "cui/ui/spelloptionsdialog.ui"));
+        VclPtr<SfxSingleTabDialog>::Create(this, aSet, "SpellOptionsDialog", "cui/ui/spelloptionsdialog.ui"));
     VclPtr<SfxTabPage> pPage = SvxLinguTabPage::Create( pDlg->get_content_area(), &aSet );
     static_cast<SvxLinguTabPage*>(pPage.get())->HideGroups( GROUP_MODULES );
     pDlg->SetTabPage( pPage );
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index 9b95589..3982c34 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -184,8 +184,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxShowText(vcl::Windo
     return new SvxShowText(pParent);
 }
 
-
-
 void SvxShowText::Paint( const Rectangle& )
 {
     Color aTextCol = GetTextColor();
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 34a64c9..549d210 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -1037,7 +1037,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, SelectFileTypeHdl)
 
 void TPGalleryThemeProperties::SearchFiles()
 {
-    SearchProgress* pProgress = new SearchProgress( this, aURL );
+    SearchProgress* pProgress = VclPtr<SearchProgress>::Create( this, aURL );
 
     aFoundList.clear();
     m_pLbxFound->Clear();
@@ -1096,12 +1096,12 @@ void TPGalleryThemeProperties::TakeFiles()
 {
     if( m_pLbxFound->GetSelectEntryCount() || ( bTakeAll && bEntriesFound ) )
     {
-        TakeProgress* pTakeProgress = new TakeProgress( this );
+        VclPtrInstance<TakeProgress> pTakeProgress( this );
         pTakeProgress->Update();
 
         pTakeProgress->StartExecuteModal(
             Link() /* no postprocessing needed, pTakeProgress
-                      will be deleted in TakeProgress::CleanupHdl */ );
+                      will be disposed in TakeProgress::CleanupHdl */ );
     }
 }
 
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index ab3f23f..b0d7022 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -93,7 +93,7 @@ SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings)
     // insert pages
     Image aImage;
     OUString aStrTitle;
-    SvxIconChoiceCtrlEntry* pEntry = NULL;
+    SvxIconChoiceCtrlEntry *pEntry;
 
     aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP );
     aImage = Image( CUI_RES ( RID_SVXBMP_HLINETTP ) );
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 9a92381..29008b2 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -372,8 +372,8 @@ namespace svx
     SuggestionDisplay::SuggestionDisplay( vcl::Window* pParent, WinBits nBits )
         : Control( pParent, nBits )
         , m_bDisplayListBox( true )
-        , m_aValueSet( new SuggestionSet(this) )
-        , m_aListBox( new ListBox(this,GetStyle() | WB_BORDER) )
+        , m_aValueSet( VclPtr<SuggestionSet>::Create(this) )
+        , m_aListBox( VclPtr<ListBox>::Create(this,GetStyle() | WB_BORDER) )
         , m_bInSelectionUpdate( false )
     {
         m_aValueSet->SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) );
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 6a62347..b0657ee 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -243,9 +243,9 @@ void SvxHyperlinkNewDocTp::GetCurentItemData ( OUString& rStrURL, OUString& aStr
 |*
 |************************************************************************/
 
-IconChoicePage* SvxHyperlinkNewDocTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
+VclPtr<IconChoicePage> SvxHyperlinkNewDocTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
 {
-    return new SvxHyperlinkNewDocTp( pWindow, pDlg, rItemSet );
+    return VclPtr<SvxHyperlinkNewDocTp>::Create( pWindow, pDlg, rItemSet );
 }
 
 /*************************************************************************
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index df6f179..fd9340d 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -168,9 +168,9 @@ void SvxHyperlinkDocTp::GetCurentItemData ( OUString& rStrURL, OUString& aStrNam
 |*
 |************************************************************************/
 
-IconChoicePage* SvxHyperlinkDocTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
+VclPtr<IconChoicePage> SvxHyperlinkDocTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
 {
-    return new SvxHyperlinkDocTp( pWindow, pDlg, rItemSet );
+    return VclPtr<SvxHyperlinkDocTp>::Create( pWindow, pDlg, rItemSet );
 }
 
 /*************************************************************************
diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
index 7077dbd..e6cb7c0 100644
--- a/cui/source/dialogs/hlinettp.cxx
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -202,9 +202,9 @@ OUString SvxHyperlinkInternetTp::CreateAbsoluteURL() const
 |*
 |************************************************************************/
 
-IconChoicePage* SvxHyperlinkInternetTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
+VclPtr<IconChoicePage> SvxHyperlinkInternetTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
 {
-    return new SvxHyperlinkInternetTp( pWindow, pDlg, rItemSet );
+    return VclPtr<SvxHyperlinkInternetTp>::Create( pWindow, pDlg, rItemSet );
 }
 
 /*************************************************************************
diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx
index 160e56d..1033619 100644
--- a/cui/source/dialogs/hlmailtp.cxx
+++ b/cui/source/dialogs/hlmailtp.cxx
@@ -171,9 +171,9 @@ OUString SvxHyperlinkMailTp::CreateAbsoluteURL() const
 |*
 |************************************************************************/
 
-IconChoicePage* SvxHyperlinkMailTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
+VclPtr<IconChoicePage> SvxHyperlinkMailTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet )
 {
-    return new SvxHyperlinkMailTp( pWindow, pDlg, rItemSet );
+    return VclPtr<SvxHyperlinkMailTp>::Create( pWindow, pDlg, rItemSet );
 }
 
 /*************************************************************************
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index 4e0c09b..d1c8c35 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -156,8 +156,8 @@ void IconChoicePage::DataChanged( const DataChangedEvent& rDCEvt )
 extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvtIconChoiceCtrl(vcl::Window *pParent, VclBuilder::stringmap &)
 {
     return new SvtIconChoiceCtrl(pParent, WB_3DLOOK | WB_ICON | WB_BORDER |
-                            WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME |
-                            WB_NODRAGSELECTION | WB_TABSTOP);
+                                 WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME |
+                                 WB_NODRAGSELECTION | WB_TABSTOP);
 }
 
 IconChoiceDialog::IconChoiceDialog ( vcl::Window* pParent, const OUString& rID,
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index 72f627b..72afee2 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -186,7 +186,7 @@ SvxMultiPathDialog::SvxMultiPathDialog(vcl::Window* pParent)
     Size aSize(LogicToPixel(Size(195, 77), MAP_APPFONT));
     pRadioLBContainer->set_width_request(aSize.Width());
     pRadioLBContainer->set_height_request(aSize.Height());
-    m_pRadioLB = new svx::SvxRadioButtonListBox(*pRadioLBContainer, 0);
+    m_pRadioLB = VclPtr<svx::SvxRadioButtonListBox>::Create(*pRadioLBContainer, 0);
 
     static long aStaticTabs[]= { 2, 0, 12 };
     m_pRadioLB->SvSimpleTable::SetTabs( aStaticTabs );
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index a677670..98a97d0 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -96,7 +96,7 @@ SFTreeListBox::SFTreeListBox(vcl::Window* pParent)
 
 extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSFTreeListBox(vcl::Window *pParent, VclBuilder::stringmap &)
 {
-    return new SFTreeListBox(pParent);
+    return VclPtr<SFTreeListBox>::Create(pParent);
 }
 
 SFTreeListBox::~SFTreeListBox()
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index a540534..4267b01 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -971,12 +971,12 @@ bool AbstractPasswordToOpenModifyDialog_Impl::IsRecommendToOpenReadonly() const
 // Create dialogs with simplest interface
 VclAbstractDialog* AbstractDialogFactory_Impl::CreateVclDialog( vcl::Window* pParent, sal_uInt32 nResId )
 {
-    Dialog* pDlg=NULL;
+    VclPtr<Dialog> pDlg;
     switch ( nResId )
     {
         case RID_DEFAULTABOUT:
         {
-            pDlg = new AboutDialog(pParent);
+            pDlg = VclPtr<AboutDialog>::Create(pParent);
             break;
         }
         case SID_OPTIONS_TREEDIALOG :
@@ -987,7 +987,7 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateVclDialog( vcl::Window* pPa
             if (nResId == SID_OPTIONS_TREEDIALOG)
                 bActivateLastSelection = true;
             Reference< frame::XFrame > xFrame;
-            OfaTreeOptionsDialog* pOptDlg = new OfaTreeOptionsDialog( pParent, xFrame, bActivateLastSelection );
+            VclPtrInstance<OfaTreeOptionsDialog> pOptDlg( pParent, xFrame, bActivateLastSelection );
             if (nResId == SID_OPTIONS_DATABASES)
             {
                 pOptDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
@@ -997,7 +997,7 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateVclDialog( vcl::Window* pPa
                 //open the tab page "tools/options/languages"
                 pOptDlg->ActivatePage(OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE);
             }
-            pDlg = pOptDlg;
+            pDlg.reset(pOptDlg);
         }
         break;
         default:
@@ -1019,17 +1019,17 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateFrameDialog(
     vcl::Window* pParent, const Reference< frame::XFrame >& rxFrame,
     sal_uInt32 nResId, const OUString& rParameter )
 {
-    Dialog* pDlg = NULL;
+    VclPtr<Dialog> pDlg;
     if ( SID_OPTIONS_TREEDIALOG == nResId || SID_OPTIONS_DATABASES == nResId )
     {
         // only activate last page if we dont want to activate a special page
         bool bActivateLastSelection = ( nResId != SID_OPTIONS_DATABASES && rParameter.isEmpty() );
-        OfaTreeOptionsDialog* pOptDlg = new OfaTreeOptionsDialog( pParent, rxFrame, bActivateLastSelection );
+        VclPtrInstance<OfaTreeOptionsDialog> pOptDlg( pParent, rxFrame, bActivateLastSelection );
         if ( nResId == SID_OPTIONS_DATABASES )
             pOptDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS);
         else if ( !rParameter.isEmpty() )
             pOptDlg->ActivatePage( rParameter );
-        pDlg = pOptDlg;
+        pDlg.reset(pOptDlg);
     }
 
     if ( pDlg )
@@ -1050,10 +1050,10 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabDialog( sal_uInt32 nR
     switch ( nResId )
     {
         case RID_OFA_AUTOCORR_DLG :
-            pDlg = new OfaAutoCorrDlg( pParent, pAttrSet );
+            pDlg = VclPtr<OfaAutoCorrDlg>::Create( pParent, pAttrSet );
             break;
         case RID_SVXDLG_CUSTOMIZE :
-            pDlg = new SvxConfigDialog( pParent, pAttrSet );
+            pDlg = VclPtr<SvxConfigDialog>::Create( pParent, pAttrSet );
             break;
         default:
             break;
@@ -1071,17 +1071,17 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabDialog( sal_uInt32 nR
                                                 bool /*bEditFmt*/,
                                                 const OUString * )
 {
-    SfxTabDialog* pDlg=NULL;
+    VclPtr<SfxTabDialog> pDlg;
     switch ( nResId )
     {
         case RID_OFA_AUTOCORR_DLG :
-            pDlg = new OfaAutoCorrDlg( pParent, pAttrSet );
+            pDlg = VclPtr<OfaAutoCorrDlg>::Create( pParent, pAttrSet );
             break;
         case RID_SVXDLG_CUSTOMIZE :
             {
-                SvxConfigDialog* pDlg1 = new SvxConfigDialog( pParent, pAttrSet );
+                VclPtrInstance<SvxConfigDialog> pDlg1( pParent, pAttrSet );
                 pDlg1->SetFrame(xViewFrame);
-                pDlg = (SfxTabDialog*)pDlg1;
+                pDlg.reset(pDlg1);
             }
             break;
         default:
@@ -1099,7 +1099,7 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTextTabDialog( vcl::Wind
                                             SdrView* pView,
                                             SdrModel* )
 {
-    SfxTabDialog* pDlg = new SvxTextTabDialog( pParent, pAttrSet, pView );
+    VclPtrInstance<SvxTextTabDialog> pDlg( pParent, pAttrSet, pView );
     return new CuiAbstractTabDialog_Impl( pDlg );
 }
 
@@ -1108,7 +1108,7 @@ AbstractSvxCaptionDialog*       AbstractDialogFactory_Impl::CreateCaptionDialog(
                                             const SdrView* pView,
                                             sal_uInt16 nAnchorTypes )
 {
-    SvxCaptionTabDialog* pDlg = new SvxCaptionTabDialog( pParent, pView, nAnchorTypes );
+    VclPtrInstance<SvxCaptionTabDialog> pDlg( pParent, pView, nAnchorTypes );
     return new AbstractSvxCaptionDialog_Impl( pDlg );
 }
 
@@ -1117,14 +1117,14 @@ AbstractSvxDistributeDialog*    AbstractDialogFactory_Impl::CreateSvxDistributeD
                                             SvxDistributeHorizontal eHor ,
                                             SvxDistributeVertical eVer)
 {
-    SvxDistributeDialog* pDlg = new SvxDistributeDialog( pParent, rAttr, eHor, eVer);
+    VclPtrInstance<SvxDistributeDialog> pDlg( pParent, rAttr, eHor, eVer);
     return new AbstractSvxDistributeDialog_Impl( pDlg );
 }
 
 AbstractHangulHanjaConversionDialog* AbstractDialogFactory_Impl::CreateHangulHanjaConversionDialog(vcl::Window* pParent,
                                                                        editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection )
 {
-    HangulHanjaConversionDialog* pDlg = new HangulHanjaConversionDialog( pParent, _ePrimaryDirection);
+    VclPtrInstance<HangulHanjaConversionDialog> pDlg( pParent, _ePrimaryDirection);
     return new AbstractHangulHanjaConversionDialog_Impl( pDlg );
 }
 
@@ -1132,7 +1132,7 @@ AbstractThesaurusDialog* AbstractDialogFactory_Impl::CreateThesaurusDialog( vcl:
                                 css::uno::Reference< css::linguistic2::XThesaurus >  xThesaurus,
                                 const OUString &rWord, sal_Int16 nLanguage )
 {
-    SvxThesaurusDialog* pDlg = new SvxThesaurusDialog( pParent, xThesaurus, rWord, nLanguage );
+    VclPtrInstance<SvxThesaurusDialog> pDlg( pParent, xThesaurus, rWord, nLanguage );
     return new AbstractThesaurusDialog_Impl( pDlg );
 }
 
@@ -1141,19 +1141,19 @@ AbstractHyphenWordDialog* AbstractDialogFactory_Impl::CreateHyphenWordDialog( vc
                                                 ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator >  &xHyphen,
                                                 SvxSpellWrapper* pWrapper )
 {
-    SvxHyphenWordDialog* pDlg = new SvxHyphenWordDialog( rWord, nLang, pParent, xHyphen, pWrapper );
+    VclPtrInstance<SvxHyphenWordDialog> pDlg( rWord, nLang, pParent, xHyphen, pWrapper );
     return new AbstractHyphenWordDialog_Impl( pDlg );
 }
 
 AbstractFmShowColsDialog * AbstractDialogFactory_Impl::CreateFmShowColsDialog( vcl::Window* pParent )
 {
-    FmShowColsDialog* pDlg = new FmShowColsDialog( pParent);
+    VclPtrInstance<FmShowColsDialog> pDlg( pParent);
     return new AbstractFmShowColsDialog_Impl( pDlg );
 }
 AbstractSvxZoomDialog * AbstractDialogFactory_Impl::CreateSvxZoomDialog( vcl::Window* pParent,
                                             const SfxItemSet& rCoreSet)
 {
-    SvxZoomDialog* pDlg = new SvxZoomDialog( pParent, rCoreSet);
+    VclPtrInstance<SvxZoomDialog> pDlg( pParent, rCoreSet);
     return new AbstractSvxZoomDialog_Impl( pDlg );
 }
 
@@ -1162,26 +1162,26 @@ AbstractSpellDialog *  AbstractDialogFactory_Impl::CreateSvxSpellDialog(
                         SfxBindings* pBindings,
                         svx::SpellDialogChildWindow* pSpellChildWindow )
 {
-    svx::SpellDialog* pDlg = new svx::SpellDialog(pSpellChildWindow, pParent, pBindings);
+    VclPtrInstance<svx::SpellDialog> pDlg(pSpellChildWindow, pParent, pBindings);
     return new AbstractSpellDialog_Impl(pDlg);
 }
 
 VclAbstractRefreshableDialog * AbstractDialogFactory_Impl::CreateActualizeProgressDialog( vcl::Window* pParent, GalleryTheme* pThm )
 {
-   Dialog* pDlg = new ActualizeProgress( pParent, pThm);
+   VclPtrInstance<ActualizeProgress> pDlg(pParent, pThm);
    return new VclAbstractRefreshableDialog_Impl( pDlg );
 }
 
 AbstractSearchProgress * AbstractDialogFactory_Impl::CreateSearchProgressDialog( vcl::Window* pParent,
                                             const INetURLObject& rStartURL )
 {
-    SearchProgress* pDlg = new SearchProgress( pParent, rStartURL);
+    SearchProgress* pDlg = VclPtr<SearchProgress>::Create( pParent, rStartURL);
     return new AbstractSearchProgress_Impl( pDlg );
 }
 
 AbstractTakeProgress * AbstractDialogFactory_Impl::CreateTakeProgressDialog( vcl::Window* pParent )
 {
-    TakeProgress* pDlg = new TakeProgress( pParent );
+    VclPtrInstance<TakeProgress> pDlg( pParent );
     return new AbstractTakeProgress_Impl( pDlg );
 }
 
@@ -1196,7 +1196,7 @@ AbstractScriptSelectorDialog*
 AbstractDialogFactory_Impl::CreateScriptSelectorDialog(
     vcl::Window* pParent, bool bShowSlots, const Reference< frame::XFrame >& _rxFrame )
 {
-    SvxScriptSelectorDialog* pDlg = new SvxScriptSelectorDialog(pParent, bShowSlots, _rxFrame);
+    VclPtrInstance<SvxScriptSelectorDialog> pDlg(pParent, bShowSlots, _rxFrame);
     return new AbstractScriptSelectorDialog_Impl(pDlg);
 }
 
@@ -1217,21 +1217,21 @@ void AbstractScriptSelectorDialog_Impl::SetRunLabel()
 VclAbstractDialog * AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog( vcl::Window* pParent,
                                             const OUString& rLanguage)
 {
-    Dialog* pDlg = new SvxScriptOrgDialog( pParent, rLanguage);
+    VclPtrInstance<SvxScriptOrgDialog> pDlg( pParent, rLanguage);
     return new CuiVclAbstractDialog_Impl( pDlg );
 }
 
 AbstractTitleDialog * AbstractDialogFactory_Impl::CreateTitleDialog( vcl::Window* pParent,
                                             const OUString& rOldText)
 {
-   TitleDialog* pDlg = new TitleDialog( pParent, rOldText);
+   VclPtrInstance<TitleDialog> pDlg( pParent, rOldText);
    return new AbstractTitleDialog_Impl( pDlg );
 }
 
 AbstractGalleryIdDialog * AbstractDialogFactory_Impl::CreateGalleryIdDialog( vcl::Window* pParent,
                                             GalleryTheme* pThm )
 {
-   GalleryIdDialog* pDlg = new GalleryIdDialog( pParent, pThm);
+   VclPtrInstance<GalleryIdDialog> pDlg( pParent, pThm);
    return new AbstractGalleryIdDialog_Impl( pDlg );
 }
 
@@ -1239,7 +1239,7 @@ VclAbstractDialog2 * AbstractDialogFactory_Impl::CreateGalleryThemePropertiesDia
                                             ExchangeData* pData,
                                             SfxItemSet* pItemSet)
 {
-    Dialog* pDlg = new GalleryThemeProperties( pParent, pData, pItemSet);
+    VclPtrInstance<GalleryThemeProperties> pDlg( pParent, pData, pItemSet);
     return new VclAbstractDialog2_Impl( pDlg );
 }
 
@@ -1248,7 +1248,8 @@ AbstractURLDlg * AbstractDialogFactory_Impl::CreateURLDialog( vcl::Window* pPare
                                             const OUString& rTarget, const OUString& rName,
                                             TargetList& rTargetList )
 {
-    URLDlg* pDlg = new URLDlg( pParent, rURL, rAltText, rDescription, rTarget, rName, rTargetList);
+    VclPtrInstance<URLDlg> pDlg( pParent, rURL, rAltText, rDescription,
+                                 rTarget, rName, rTargetList);
     return new AbstractURLDlg_Impl( pDlg );
 }
 
@@ -1258,7 +1259,7 @@ AbstractSvxHlinkDlgMarkWnd* AbstractDialogFactory_Impl::CreateSvxHlinkDlgMarkWnd
     switch ( nResId )
     {
         case RID_SVXFLOAT_HYPERLINK_MARKWND :
-            pDlg = new  SvxHlinkDlgMarkWnd( pParent );
+            pDlg = VclPtr<SvxHlinkDlgMarkWnd>::Create ( pParent );
             break;
         default:
             break;
@@ -1272,7 +1273,7 @@ AbstractSvxHlinkDlgMarkWnd* AbstractDialogFactory_Impl::CreateSvxHlinkDlgMarkWnd
 SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabItemDialog(vcl::Window* pParent,
     const SfxItemSet& rSet)
 {
-    SfxTabDialog* pDlg = new SvxSearchFormatDialog(pParent, rSet);
+    VclPtrInstance<SvxSearchFormatDialog> pDlg(pParent, rSet);
     return new CuiAbstractTabDialog_Impl(pDlg);
 }
 
@@ -1280,7 +1281,7 @@ VclAbstractDialog*      AbstractDialogFactory_Impl::CreateSvxSearchAttributeDial
                                             SearchAttrItemList& rLst,
                                             const sal_uInt16* pWhRanges )
 {
-    Dialog* pDlg = new SvxSearchAttributeDialog( pParent, rLst, pWhRanges);
+    VclPtrInstance<SvxSearchAttributeDialog> pDlg( pParent, rLst, pWhRanges);
     return new CuiVclAbstractDialog_Impl( pDlg );
 }
 
@@ -1290,7 +1291,7 @@ AbstractSvxSearchSimilarityDialog * AbstractDialogFactory_Impl::CreateSvxSearchS
                                                             sal_uInt16 nShorter,
                                                             sal_uInt16 nLonger)
 {
-    SvxSearchSimilarityDialog* pDlg = new SvxSearchSimilarityDialog( pParent, bRelax, nOther, nShorter, nLonger );
+    VclPtrInstance<SvxSearchSimilarityDialog> pDlg( pParent, bRelax, nOther, nShorter, nLonger );
     return new AbstractSvxSearchSimilarityDialog_Impl( pDlg );
 }
 
@@ -1301,7 +1302,7 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxBorderBackgroundDlg(
     bool bEnableSelector,
     bool bEnableDrawingLayerFillStyles)
 {
-    SfxTabDialog* pDlg = new SvxBorderBackgroundDlg(
+    VclPtrInstance<SvxBorderBackgroundDlg> pDlg(
         pParent,
         rCoreSet,
         bEnableSelector,
@@ -1315,7 +1316,7 @@ AbstractSvxTransformTabDialog* AbstractDialogFactory_Impl::CreateSvxTransformTab
                                                                                 const SdrView* pView,
                                                                                 sal_uInt16 nAnchorTypes )
 {
-    SvxTransformTabDialog* pDlg = new SvxTransformTabDialog( pParent, pAttr,pView, nAnchorTypes);
+    VclPtrInstance<SvxTransformTabDialog> pDlg( pParent, pAttr,pView, nAnchorTypes);
     return new AbstractSvxTransformTabDialog_Impl( pDlg );
 }
 
@@ -1326,19 +1327,19 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSchTransformTabDialog( v
                                                                 bool bSizeTabPage
                                                                 )
 {
-    SfxTabDialog* pDlg=NULL;
+    VclPtr<SfxTabDialog> pDlg;
     switch ( nResId )
     {
         case RID_SCH_TransformTabDLG_SVXPAGE_ANGLE :
             {
-            pDlg = new SvxTransformTabDialog( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT :  SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE);
+            pDlg.reset( VclPtr<SvxTransformTabDialog>::Create( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT :  SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE) );
             pDlg->RemoveTabPage( "RID_SVXPAGE_ANGLE" );
             pDlg->RemoveTabPage( "RID_SVXPAGE_SLANT" );
             }
             break;
         case RID_SCH_TransformTabDLG_SVXPAGE_SLANT:
             {
-            pDlg = new  SvxTransformTabDialog( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT :  SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE);
+            pDlg.reset(VclPtr<SvxTransformTabDialog>::Create ( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT :  SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE ) );
             pDlg->RemoveTabPage( "RID_SVXPAGE_SLANT" );
             }
             break;
@@ -1355,20 +1356,20 @@ AbstractSvxJSearchOptionsDialog * AbstractDialogFactory_Impl::CreateSvxJSearchOp
                                                             const SfxItemSet& rOptionsSet,
                                                             sal_Int32 nInitialFlags)
 {
-    SvxJSearchOptionsDialog* pDlg = new SvxJSearchOptionsDialog( pParent, rOptionsSet, nInitialFlags );
+    VclPtrInstance<SvxJSearchOptionsDialog> pDlg( pParent, rOptionsSet, nInitialFlags );
     return new AbstractSvxJSearchOptionsDialog_Impl( pDlg );
 }
 
 AbstractFmInputRecordNoDialog * AbstractDialogFactory_Impl::CreateFmInputRecordNoDialog( vcl::Window* pParent )
 {
-    FmInputRecordNoDialog* pDlg = new FmInputRecordNoDialog( pParent );
+    VclPtrInstance<FmInputRecordNoDialog> pDlg( pParent );
     return new AbstractFmInputRecordNoDialog_Impl( pDlg );
 }
 
 AbstractSvxNewDictionaryDialog * AbstractDialogFactory_Impl::CreateSvxNewDictionaryDialog( vcl::Window* pParent,
                                             ::Reference< ::com::sun::star::linguistic2::XSpellChecker1 >  &xSpl )
 {
-    SvxNewDictionaryDialog* pDlg = new SvxNewDictionaryDialog( pParent, xSpl );
+    VclPtrInstance<SvxNewDictionaryDialog> pDlg( pParent, xSpl );
     return new AbstractSvxNewDictionaryDialog_Impl( pDlg );
 }
 
@@ -1381,7 +1382,7 @@ VclAbstractDialog*      AbstractDialogFactory_Impl::CreateSvxEditDictionaryDialo
     switch ( nResId )
     {
         case RID_SFXDLG_EDITDICT :
-            pDlg = new SvxEditDictionaryDialog( pParent, rName, xSpl );
+            pDlg = VclPtr<SvxEditDictionaryDialog>::Create( pParent, rName, xSpl );
             break;
         default:
             break;
@@ -1395,36 +1396,36 @@ VclAbstractDialog*      AbstractDialogFactory_Impl::CreateSvxEditDictionaryDialo
 AbstractSvxNameDialog * AbstractDialogFactory_Impl::CreateSvxNameDialog( vcl::Window* pParent,
                                     const OUString& rName, const OUString& rDesc )
 {
-    SvxNameDialog* pDlg = new SvxNameDialog( pParent, rName, rDesc );
+    VclPtrInstance<SvxNameDialog> pDlg( pParent, rName, rDesc );
     return new AbstractSvxNameDialog_Impl( pDlg );
 }
 
 AbstractSvxObjectNameDialog* AbstractDialogFactory_Impl::CreateSvxObjectNameDialog(vcl::Window* pParent, const OUString& rName )
 {
-    return new AbstractSvxObjectNameDialog_Impl(new SvxObjectNameDialog(pParent, rName));
+    return new AbstractSvxObjectNameDialog_Impl(VclPtr<SvxObjectNameDialog>::Create(pParent, rName));
 }
 
 AbstractSvxObjectTitleDescDialog* AbstractDialogFactory_Impl::CreateSvxObjectTitleDescDialog(vcl::Window* pParent, const OUString& rTitle, const OUString& rDescription)
 {
-    return new AbstractSvxObjectTitleDescDialog_Impl(new SvxObjectTitleDescDialog(pParent, rTitle, rDescription));
+    return new AbstractSvxObjectTitleDescDialog_Impl(VclPtr<SvxObjectTitleDescDialog>::Create(pParent, rTitle, rDescription));
 }
 
 AbstractSvxMessDialog * AbstractDialogFactory_Impl::CreateSvxMessDialog( vcl::Window* pParent, sal_uInt32,
                                     const OUString& rText, const OUString& rDesc, Image* pImg )
 {
-    SvxMessDialog* pDlg = new SvxMessDialog( pParent, rText, rDesc, pImg );
+    VclPtrInstance<SvxMessDialog> pDlg( pParent, rText, rDesc, pImg );
     return new AbstractSvxMessDialog_Impl( pDlg );
 }
 
 AbstractSvxMultiPathDialog * AbstractDialogFactory_Impl::CreateSvxMultiPathDialog(vcl::Window* pParent)
 {
-    SvxMultiPathDialog* pDlg = new SvxMultiPathDialog(pParent);
+    VclPtrInstance<SvxMultiPathDialog> pDlg(pParent);
     return new AbstractSvxMultiPathDialog_Impl( pDlg );
 }
 
 AbstractSvxMultiPathDialog * AbstractDialogFactory_Impl::CreateSvxPathSelectDialog(vcl::Window* pParent)
 {
-    SvxPathSelectDialog* pDlg = new SvxPathSelectDialog(pParent);
+    VclPtrInstance<SvxPathSelectDialog> pDlg(pParent);
     return new AbstractSvxPathSelectDialog_Impl( pDlg );
 }
 
@@ -1436,7 +1437,7 @@ AbstractSvxHpLinkDlg * AbstractDialogFactory_Impl::CreateSvxHpLinkDlg (vcl::Wind
     switch ( nResId )
     {
         case SID_HYPERLINK_DIALOG :
-            pDlg = new SvxHpLinkDlg( pParent, pBindings );
+            pDlg = VclPtr<SvxHpLinkDlg>::Create( pParent, pBindings );
             break;
         default:
             break;
@@ -1453,7 +1454,8 @@ AbstractFmSearchDialog*  AbstractDialogFactory_Impl::CreateFmSearchDialog(vcl::W
                                                         sal_Int16 nInitialContext,
                                                         const Link& lnkContextSupplier)
 {
-    FmSearchDialog* pDlg = new FmSearchDialog( pParent, strInitialText, _rContexts, nInitialContext, lnkContextSupplier );
+    VclPtrInstance<FmSearchDialog> pDlg( pParent, strInitialText, _rContexts,
+                                         nInitialContext, lnkContextSupplier );
     return new AbstractFmSearchDialog_Impl( pDlg );
 }
 
@@ -1461,7 +1463,7 @@ AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterEmb
                                             const Graphic& rGraphic,
                                             RECT_POINT eLightSource)
 {
-    GraphicFilterDialog* pDlg = new GraphicFilterEmboss( pParent, rGraphic, eLightSource );
+    VclPtrInstance<GraphicFilterEmboss> pDlg( pParent, rGraphic, eLightSource );
     return new AbstractGraphicFilterDialog_Impl( pDlg );
 }
 
@@ -1469,7 +1471,7 @@ AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterPos
                                             const Graphic& rGraphic,
                                             sal_uInt16 nCount)
 {
-    GraphicFilterDialog* pDlg = new GraphicFilterPoster( pParent, rGraphic, nCount );
+    VclPtrInstance<GraphicFilterPoster> pDlg( pParent, rGraphic, nCount );
     return new AbstractGraphicFilterDialog_Impl( pDlg );
 }
 
@@ -1477,21 +1479,21 @@ AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterSep
                                             const Graphic& rGraphic,
                                             sal_uInt16 nCount)
 {
-    GraphicFilterDialog* pDlg = new GraphicFilterSepia( pParent, rGraphic, nCount );
+    VclPtrInstance<GraphicFilterSepia> pDlg( pParent, rGraphic, nCount );
     return new AbstractGraphicFilterDialog_Impl( pDlg );
 }
 
 AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterSmooth(vcl::Window* pParent,
                                             const Graphic& rGraphic, double nRadius)
 {
-    GraphicFilterDialog* pDlg = new GraphicFilterSmooth( pParent, rGraphic, nRadius );
+    VclPtrInstance<GraphicFilterSmooth> pDlg( pParent, rGraphic, nRadius );
     return new AbstractGraphicFilterDialog_Impl( pDlg );
 }
 
 AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterSolarize (vcl::Window* pParent,
                                             const Graphic& rGraphic, sal_uInt8 nGreyThreshold, bool bInvert)
 {
-    GraphicFilterDialog* pDlg = new GraphicFilterSolarize( pParent, rGraphic, nGreyThreshold, bInvert );
+    VclPtrInstance<GraphicFilterSolarize> pDlg( pParent, rGraphic, nGreyThreshold, bInvert );
     return new AbstractGraphicFilterDialog_Impl( pDlg );
 }
 
@@ -1499,7 +1501,7 @@ AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterMos
                                             const Graphic& rGraphic, sal_uInt16 nTileWidth, sal_uInt16 nTileHeight,
                                             bool bEnhanceEdges)
 {
-    GraphicFilterDialog* pDlg = new GraphicFilterMosaic(pParent, rGraphic, nTileWidth, nTileHeight, bEnhanceEdges);
+    VclPtrInstance<GraphicFilterMosaic> pDlg(pParent, rGraphic, nTileWidth, nTileHeight, bEnhanceEdges);
     return new AbstractGraphicFilterDialog_Impl( pDlg );
 }
 
@@ -1508,7 +1510,7 @@ AbstractSvxAreaTabDialog* AbstractDialogFactory_Impl::CreateSvxAreaTabDialog( vc
                                                             SdrModel* pModel,
                                                             bool bShadow)
 {
-    SvxAreaTabDialog* pDlg = new SvxAreaTabDialog( pParent, pAttr, pModel, bShadow );
+    VclPtrInstance<SvxAreaTabDialog> pDlg( pParent, pAttr, pModel, bShadow );
     return new AbstractSvxAreaTabDialog_Impl( pDlg );
 }
 
@@ -1517,7 +1519,7 @@ SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxLineTabDialog( vcl::W
                                                                  const SdrObject* pObj ,
                                                                  bool bHasObj)
 {
-    SfxTabDialog* pDlg = new SvxLineTabDialog( pParent, pAttr, pModel,pObj,bHasObj );
+    VclPtrInstance<SvxLineTabDialog> pDlg( pParent, pAttr, pModel,pObj,bHasObj );
     return new CuiAbstractTabDialog_Impl( pDlg );
 }
 
@@ -1531,10 +1533,10 @@ SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( vcl::Window* pPa
     switch ( nResId )
     {
         case SID_EVENTCONFIG :
-            pDlg = new SfxMacroAssignDlg( pParent, _rxDocumentFrame, rAttr );
+            pDlg = VclPtr<SfxMacroAssignDlg>::Create( pParent, _rxDocumentFrame, rAttr );
             break;
         case RID_SVXDLG_CHARMAP :
-            pDlg = new SvxCharacterMap( pParent, true, &rAttr );
+            pDlg = VclPtr<SvxCharacterMap>::Create( pParent, true, &rAttr );
             break;
         default:
             break;
@@ -1556,13 +1558,13 @@ SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( vcl::Window* pPa
     switch ( nResId )
     {
         case RID_SVXPAGE_MEASURE :
-            pDlg = new SvxMeasureDialog( pParent, rAttr, pView );
+            pDlg = VclPtr<SvxMeasureDialog>::Create( pParent, rAttr, pView );
             break;
         case RID_SVXPAGE_CONNECTION :
-            pDlg = new SvxConnectionDialog( pParent, rAttr, pView );
+            pDlg = VclPtr<SvxConnectionDialog>::Create( pParent, rAttr, pView );
             break;
         case RID_SFXPAGE_DBREGISTER :
-            pDlg = new DatabaseRegistrationDialog( pParent, rAttr );
+            pDlg = VclPtr<DatabaseRegistrationDialog>::Create( pParent, rAttr );
             break;
         default:
             break;
@@ -1578,7 +1580,7 @@ AbstractSvxPostItDialog* AbstractDialogFactory_Impl::CreateSvxPostItDialog( vcl:
                                                                         const SfxItemSet& rCoreSet,
                                                                         bool bPrevNext )
 {
-    SvxPostItDialog* pDlg = new SvxPostItDialog( pParent, rCoreSet, bPrevNext );
+    VclPtrInstance<SvxPostItDialog> pDlg( pParent, rCoreSet, bPrevNext );
     return new AbstractSvxPostItDialog_Impl( pDlg );
 }
 
@@ -1590,7 +1592,7 @@ public:
         :m_aItems( SfxGetpApp()->GetPool(), SID_ATTR_MACROITEM, SID_ATTR_MACROITEM )
     {
         m_aItems.Put( SfxBoolItem( SID_ATTR_MACROITEM, _bUnoDialogMode ) );
-        m_pDialog.reset( new SvxMacroAssignDlg( _pParent, _rxDocumentFrame, m_aItems, _rxEvents, _nInitiallySelectedEvent ) );
+        m_pDialog.reset( VclPtr<SvxMacroAssignDlg>::Create( _pParent, _rxDocumentFrame, m_aItems, _rxEvents, _nInitiallySelectedEvent ) );
     }
 
     virtual short Execute() SAL_OVERRIDE;
@@ -1766,11 +1768,11 @@ SfxAbstractInsertObjectDialog* AbstractDialogFactory_Impl::CreateInsertObjectDia
 {
     InsertObjectDialog_Impl* pDlg=0;
     if ( rCommand == ".uno:InsertObject" )
-        pDlg = new SvInsertOleDlg( pParent, xStor, pList );
+        pDlg = VclPtr<SvInsertOleDlg>::Create( pParent, xStor, pList );
     else if ( rCommand == ".uno:InsertPlugin" )
-        pDlg = new SvInsertPlugInDialog( pParent, xStor );
+        pDlg = VclPtr<SvInsertPlugInDialog>::Create( pParent, xStor );
     else if ( rCommand == ".uno:InsertObjectFloatingFrame" )
-        pDlg = new SfxInsertFloatingFrameDialog( pParent, xStor );
+        pDlg = VclPtr<SfxInsertFloatingFrameDialog>::Create( pParent, xStor );
 
     if ( pDlg )
     {
@@ -1785,7 +1787,7 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateEditObjectDialog( vcl::Wind
 {
     if ( rCommand == ".uno:InsertObjectFloatingFrame" )
     {
-        InsertObjectDialog_Impl* pDlg = new SfxInsertFloatingFrameDialog( pParent, xObj );
+        VclPtrInstance<SfxInsertFloatingFrameDialog> pDlg( pParent, xObj );
         pDlg->SetHelpId( OUStringToOString( rCommand, RTL_TEXTENCODING_UTF8 ) );
         return new CuiVclAbstractDialog_Impl( pDlg );
     }
@@ -1796,12 +1798,12 @@ VclAbstractDialog* AbstractDialogFactory_Impl::CreateEditObjectDialog( vcl::Wind
 
 SfxAbstractPasteDialog* AbstractDialogFactory_Impl::CreatePasteDialog( vcl::Window* pParent )
 {
-    return new AbstractPasteDialog_Impl( new SvPasteObjectDialog( pParent ) );
+    return new AbstractPasteDialog_Impl( VclPtr<SvPasteObjectDialog>::Create( pParent ) );
 }
 
 SfxAbstractLinksDialog* AbstractDialogFactory_Impl::CreateLinksDialog( vcl::Window* pParent, sfx2::LinkManager* pMgr, bool bHTML, sfx2::SvBaseLink* p)
 {
-    SvBaseLinksDlg* pLinkDlg = new SvBaseLinksDlg( pParent, pMgr, bHTML );
+    VclPtrInstance<SvBaseLinksDlg> pLinkDlg( pParent, pMgr, bHTML );
     if ( p )
         pLinkDlg->SetActLink(p);
     return new AbstractLinksDialog_Impl( pLinkDlg );
@@ -1809,35 +1811,35 @@ SfxAbstractLinksDialog* AbstractDialogFactory_Impl::CreateLinksDialog( vcl::Wind
 
 SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* /*pObj*/ )
 {
-    return new CuiAbstractTabDialog_Impl( new SvxFormatCellsDialog( pParent, pAttr, pModel ) );
+    return new CuiAbstractTabDialog_Impl( VclPtr<SvxFormatCellsDialog>::Create( pParent, pAttr, pModel ) );
 }
 
 SvxAbstractSplittTableDialog* AbstractDialogFactory_Impl::CreateSvxSplittTableDialog( vcl::Window* pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal )
 {
-    return new SvxSplitTableDlg( pParent, bIsTableVertical, nMaxVertical, nMaxHorizontal );
+    return VclPtr<SvxSplitTableDlg>::Create( pParent, bIsTableVertical, nMaxVertical, nMaxHorizontal );
 }
 
 SvxAbstractNewTableDialog* AbstractDialogFactory_Impl::CreateSvxNewTableDialog( vcl::Window* pParent )
 {
-    return new SvxNewTableDialog( pParent );
+    return VclPtr<SvxNewTableDialog>::Create( pParent );
 }
 
 VclAbstractDialog* AbstractDialogFactory_Impl::CreateOptionsDialog(
     vcl::Window* pParent, const OUString& rExtensionId, const OUString& /*rApplicationContext*/ )
 {
-    return new CuiVclAbstractDialog_Impl( new OfaTreeOptionsDialog( pParent, rExtensionId ) );
+    return new CuiVclAbstractDialog_Impl( VclPtr<OfaTreeOptionsDialog>::Create( pParent, rExtensionId ) );
 }
 
 SvxAbstractInsRowColDlg* AbstractDialogFactory_Impl::CreateSvxInsRowColDlg( vcl::Window* pParent, bool bCol, const OString& sHelpId )
 {
-    return new SvxInsRowColDlg( pParent, bCol, sHelpId );
+    return VclPtr<SvxInsRowColDlg>::Create( pParent, bCol, sHelpId );
 }
 
 AbstractPasswordToOpenModifyDialog * AbstractDialogFactory_Impl::CreatePasswordToOpenModifyDialog(
     vcl::Window * pParent,
     sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify )
 {
-    PasswordToOpenModifyDialog * pDlg = new PasswordToOpenModifyDialog( pParent, nMinPasswdLen, nMaxPasswdLen, bIsPasswordToModify );
+    VclPtrInstance<PasswordToOpenModifyDialog> pDlg( pParent, nMinPasswdLen, nMaxPasswdLen, bIsPasswordToModify );
     return new AbstractPasswordToOpenModifyDialog_Impl( pDlg );
 }
 
diff --git a/cui/source/inc/hldocntp.hxx b/cui/source/inc/hldocntp.hxx
index 494b7a2..e72b133 100644
--- a/cui/source/inc/hldocntp.hxx
+++ b/cui/source/inc/hldocntp.hxx
@@ -54,7 +54,7 @@ public:
     virtual ~SvxHyperlinkNewDocTp ();
     virtual void dispose() SAL_OVERRIDE;
 
-    static  IconChoicePage* Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
+    static  VclPtr<IconChoicePage> Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
 
     virtual bool        AskApply () SAL_OVERRIDE;
     virtual void        DoApply () SAL_OVERRIDE;
diff --git a/cui/source/inc/hldoctp.hxx b/cui/source/inc/hldoctp.hxx
index 76dda78..457cf1e 100644
--- a/cui/source/inc/hldoctp.hxx
+++ b/cui/source/inc/hldoctp.hxx
@@ -70,7 +70,7 @@ public:
     virtual ~SvxHyperlinkDocTp();
     virtual void dispose() SAL_OVERRIDE;
 
-    static  IconChoicePage* Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
+    static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
 
     virtual void        SetMarkStr ( const OUString& aStrMark ) SAL_OVERRIDE;
 
diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx
index 03b0132..99f60cd 100644
--- a/cui/source/inc/hlinettp.hxx
+++ b/cui/source/inc/hlinettp.hxx
@@ -81,7 +81,7 @@ public:
     virtual ~SvxHyperlinkInternetTp();
     virtual void dispose() SAL_OVERRIDE;
 
-    static  IconChoicePage* Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
+    static  VclPtr<IconChoicePage> Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
 
     virtual void        SetMarkStr ( const OUString& aStrMark ) SAL_OVERRIDE;
 
diff --git a/cui/source/inc/hlmailtp.hxx b/cui/source/inc/hlmailtp.hxx
index 5eae01b..705a9a3 100644
--- a/cui/source/inc/hlmailtp.hxx
+++ b/cui/source/inc/hlmailtp.hxx
@@ -54,7 +54,7 @@ public:
     virtual ~SvxHyperlinkMailTp();
     virtual void dispose() SAL_OVERRIDE;
 
-    static  IconChoicePage* Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
+    static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
 
     virtual void        SetInitFocus() SAL_OVERRIDE;
 };
diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx
index 62260e2..74b686d 100644
--- a/cui/source/inc/iconcdlg.hxx
+++ b/cui/source/inc/iconcdlg.hxx
@@ -40,8 +40,8 @@ class IconChoiceDialog;
 class IconChoicePage;
 
 // Create-Function
-typedef IconChoicePage* (*CreatePage)(vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet &rAttrSet);
-typedef const sal_uInt16*         (*GetPageRanges)(); // gives international Which-value
+typedef VclPtr<IconChoicePage> (*CreatePage)(vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet &rAttrSet);
+typedef const sal_uInt16*      (*GetPageRanges)(); // gives international Which-value
 
 /// Data-structure for pages in dialog
 struct IconChoicePageData
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index 7ce1711..03d8b77 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -35,7 +35,7 @@ CertPathDialog::CertPathDialog(vcl::Window* pParent)
     m_pCertPathListContainer->set_width_request(aSize.Width());
     m_pCertPathListContainer->set_height_request(aSize.Height());
     m_pCertPathList =
-        new svx::SvxRadioButtonListBox(*m_pCertPathListContainer, 0);
+        VclPtr<svx::SvxRadioButtonListBox>::Create(*m_pCertPathListContainer, 0);
     m_sAddDialogText = get<FixedText>("certdir")->GetText();
     m_sManual = get<FixedText>("manual")->GetText();
 
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index 5fc134c..ac77289 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -62,7 +62,7 @@ SvxFontSubstTabPage::SvxFontSubstTabPage( vcl::Window* pParent,
     pCheckLBContainer->set_width_request(aControlSize.Width());
     pCheckLBContainer->set_height_request(aControlSize.Height());
 
-    m_pCheckLB = new SvxFontSubstCheckListBox(*pCheckLBContainer, 0);
+    m_pCheckLB = VclPtr<SvxFontSubstCheckListBox>::Create(*pCheckLBContainer, 0);
     m_pCheckLB->SetHelpId(HID_OFA_FONT_SUBST_CLB);
 
     m_pCheckLB->SetStyle(m_pCheckLB->GetStyle()|WB_HSCROLL|WB_VSCROLL);
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 2e8be40..851753d 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -130,7 +130,7 @@ CuiAboutConfigTabPage::CuiAboutConfigTabPage( vcl::Window* pParent/*, const SfxI
     m_pSearchBtn( get<PushButton>("searchButton") ),
     m_pSearchEdit( get<Edit>("searchEntry") ),
     m_vectorOfModified(),
-    m_pPrefBox( new SvSimpleTable(*m_pPrefCtrl, WB_SCROLL | WB_HSCROLL | WB_VSCROLL ) )
+    m_pPrefBox( VclPtr<SvSimpleTable>::Create(*m_pPrefCtrl, WB_SCROLL | WB_HSCROLL | WB_VSCROLL ) )
 {
     Size aControlSize(LogicToPixel(Size(385, 230), MAP_APPFONT));
     m_pPrefCtrl->set_width_request(aControlSize.Width());
@@ -564,7 +564,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
             else if( sPropertyType == "hyper" )
                 limit = HYPER_LEN_LIMIT;
 
-            CuiAboutConfigValueDialog* pValueDialog = new CuiAboutConfigValueDialog(0, sDialogValue, limit);
+            VclPtrInstance<CuiAboutConfigValueDialog> pValueDialog(nullptr, sDialogValue, limit);
 
             if( pValueDialog->Execute() == RET_OK )
             {
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 4c5834d..f65e4a8 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -292,7 +292,7 @@ ColorConfigWindow_Impl::Chapter::Chapter(FixedText* pText, bool bShow)
 ColorConfigWindow_Impl::Chapter::Chapter(vcl::Window *pGrid,
     unsigned nYPos, const OUString& rDisplayName)
 {
-    m_pText = new FixedText(pGrid, WB_LEFT|WB_VCENTER|WB_3DLOOK);
+    m_pText = VclPtr<FixedText>::Create(pGrid, WB_LEFT|WB_VCENTER|WB_3DLOOK);
     m_pText->set_font_attribute("weight", "bold");
     m_pText->set_grid_width(3);
     m_pText->set_grid_left_attach(0);
@@ -346,19 +346,19 @@ ColorConfigWindow_Impl::Entry::Entry( vcl::Window *pGrid, unsigned nYPos,
     : m_bOwnsWidgets(true)
     , m_aDefaultColor(rColorEntry.getDefaultColor())
 {
-    m_pText = new FixedText(pGrid, WB_LEFT|WB_VCENTER|WB_3DLOOK);
+    m_pText = VclPtr<FixedText>::Create(pGrid, WB_LEFT|WB_VCENTER|WB_3DLOOK);
     m_pText->set_grid_left_attach(0);
     m_pText->set_grid_top_attach(nYPos);
     m_pText->set_margin_left(6 + nCheckBoxLabelOffset);
     m_pText->SetText(rColorEntry.getDisplayName());
 
     WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_TABSTOP|WB_DROPDOWN;
-    m_pColorList = new ColorListBox(pGrid, nWinBits);
+    m_pColorList = VclPtr<ColorListBox>::Create(pGrid, nWinBits);
     m_pColorList->EnableAutoSize(true);
     m_pColorList->set_grid_left_attach(1);
     m_pColorList->set_grid_top_attach(nYPos);
 
-    m_pPreview = new vcl::Window(pGrid, WB_BORDER);
+    m_pPreview = VclPtr<vcl::Window>::Create(pGrid, WB_BORDER);
     m_pPreview->set_grid_left_attach(2);
     m_pPreview->set_grid_top_attach(nYPos);
     m_pPreview->set_margin_right(6);
@@ -869,11 +869,11 @@ ColorConfigCtrl_Impl::ColorConfigCtrl_Impl(vcl::Window* pParent)
     , pColorConfig(0)
     , pExtColorConfig(0)
 {
-    m_pHeaderHB = new HeaderBar(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
+    m_pHeaderHB = VclPtr<HeaderBar>::Create(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
 
-    m_pBody = new VclHBox(this);
-    m_pScrollWindow = new ColorConfigWindow_Impl(m_pBody);
-    m_pVScroll = new ScrollBar(m_pBody, WB_VERT);
+    m_pBody = VclPtr<VclHBox>::Create(this);
+    m_pScrollWindow = VclPtr<ColorConfigWindow_Impl>::Create(m_pBody);
+    m_pVScroll = VclPtr<ScrollBar>::Create(m_pBody, WB_VERT);
     m_pScrollWindow->Init(m_pVScroll, m_pHeaderHB);
 
     m_pBody->set_hexpand(true);
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index 5c25b4d..4d154e2 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -225,8 +225,7 @@ IMPL_LINK_NOARG_INLINE_END(SvxNewDictionaryDialog, ModifyHdl_Impl)
 extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxDictEdit(vcl::Window *pParent, VclBuilder::stringmap&)
 {
     WinBits nWinStyle = WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK;
-    SvxDictEdit *pEdit = new SvxDictEdit(pParent, nWinStyle);
-    return pEdit;
+    return new SvxDictEdit(pParent, nWinStyle);
 };
 
 SvxEditDictionaryDialog::SvxEditDictionaryDialog(
diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx
index 4b56daa..4e649d4 100644
--- a/cui/source/options/optfltr.cxx
+++ b/cui/source/options/optfltr.cxx
@@ -164,7 +164,7 @@ OfaMSFilterTabPage2::OfaMSFilterTabPage2( vcl::Window* pParent, const SfxItemSet
     m_pCheckLBContainer->set_width_request(aControlSize.Width());
     m_pCheckLBContainer->set_height_request(aControlSize.Height());
 
-    m_pCheckLB = new MSFltrSimpleTable(*m_pCheckLBContainer);
+    m_pCheckLB = VclPtr<MSFltrSimpleTable>::Create(*m_pCheckLBContainer);
 
     static long aStaticTabs[] = { 3, 0, 20, 40 };
     m_pCheckLB->SvSimpleTable::SetTabs( aStaticTabs );
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 766a474..79298f0 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -676,7 +676,7 @@ void SvxSecurityTabPage::dispose()
 IMPL_LINK_NOARG(SvxSecurityTabPage, SecurityOptionsHdl)
 {
     if ( !mpSecOptDlg )
-        mpSecOptDlg = new svx::SecurityOptionsDialog( this, mpSecOptions );
+        mpSecOptDlg = VclPtr<svx::SecurityOptionsDialog>::Create( this, mpSecOptions );
     mpSecOptDlg->Execute();
     return 0;
 }
@@ -817,7 +817,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, ShowPasswordsHdl)
 IMPL_LINK_NOARG(SvxSecurityTabPage, CertPathPBHdl)
 {
     if (!mpCertPathDlg)
-        mpCertPathDlg = new CertPathDialog(this);
+        mpCertPathDlg = VclPtr<CertPathDialog>::Create(this);
 
     OUString sOrig = mpCertPathDlg->getDirectory();
     short nRet = mpCertPathDlg->Execute();
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 98eb903..38b232a 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -161,7 +161,7 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet&
     aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
     pJavaListContainer->set_width_request(aControlSize.Width());
     pJavaListContainer->set_height_request(aControlSize.Height());
-    m_pJavaList = new SvxJavaListBox(*pJavaListContainer, m_sAccessibilityText);
+    m_pJavaList = VclPtr<SvxJavaListBox>::Create(*pJavaListContainer, m_sAccessibilityText);
 
     long aStaticTabs[]= { 4, 0, 0, 0, 0 };
 
@@ -306,7 +306,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ParameterHdl_Impl)
     Sequence< OUString > aParameterList;
     if ( !m_pParamDlg )
     {
-        m_pParamDlg = new SvxJavaParameterDlg( this );
+        m_pParamDlg = VclPtr<SvxJavaParameterDlg>::Create( this );
         javaFrameworkError eErr = jfw_getVMParameters( &m_parParameters, &m_nParamSize );
         if ( JFW_E_NONE == eErr && m_parParameters && m_nParamSize > 0 )
         {
@@ -356,7 +356,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ClassPathHdl_Impl)
 
     if ( !m_pPathDlg )
     {
-          m_pPathDlg = new SvxJavaClassPathDlg( this );
+          m_pPathDlg = VclPtr<SvxJavaClassPathDlg>::Create( this );
         javaFrameworkError eErr = jfw_getUserClassPath( &m_pClassPath );
         if ( JFW_E_NONE == eErr && m_pClassPath )
         {
diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx
index e83dcde..d8b6af4 100644
--- a/cui/source/options/optopencl.cxx
+++ b/cui/source/options/optopencl.cxx
@@ -72,8 +72,8 @@ SvxOpenCLTabPage::SvxOpenCLTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
     mpWhiteListDelete->SetClickHdl(LINK(this, SvxOpenCLTabPage, WhiteListDeleteHdl));
 
     WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP;
-    mpBlackList = new SvSimpleTable( *mpBlackListTable, nBits );
-    mpWhiteList = new SvSimpleTable( *mpWhiteListTable, nBits );
+    mpBlackList = VclPtr<SvSimpleTable>::Create( *mpBlackListTable, nBits );
+    mpWhiteList = VclPtr<SvSimpleTable>::Create( *mpWhiteListTable, nBits );
 
     HeaderBar &rBlBar = mpBlackList->GetTheHeaderBar();
     HeaderBar &rWiBar = mpWhiteList->GetTheHeaderBar();
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index dd87bbc..dbcb5d1 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -214,7 +214,7 @@ SvxPathTabPage::SvxPathTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
     m_pPathCtrl->set_width_request(aControlSize.Width());
     m_pPathCtrl->set_height_request(aControlSize.Height());
     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();
     rBar.SetSelectHdl( LINK( this, SvxPathTabPage, HeaderSelect_Impl ) );
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 02e2f17..2267d16 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -1088,7 +1088,8 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
             m_xContainerWinProvider = awt::ContainerWindowProvider::create( ::comphelper::getProcessComponentContext() );
         }
 
-        pPageInfo->m_pExtPage = new ExtensionsTabPage(
+        pPageInfo->m_pExtPage = VclPtr<ExtensionsTabPage>::Create(
+
             pTabBox, 0, pPageInfo->m_sPageURL, pPageInfo->m_sEventHdl, m_xContainerWinProvider );
     }
 
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
index f6d6cd5..17c630c 100644
--- a/cui/source/options/webconninfo.cxx
+++ b/cui/source/options/webconninfo.cxx
@@ -111,7 +111,7 @@ WebConnectionInfoDialog::WebConnectionInfoDialog(vcl::Window* pParent)
     get(m_pChangeBtn, "change");
 
     SvSimpleTableContainer *pPasswordsLBContainer = get<SvSimpleTableContainer>("logins");
-    m_pPasswordsLB = new PasswordTable(*pPasswordsLBContainer, 0);
+    m_pPasswordsLB = VclPtr<PasswordTable>::Create(*pPasswordsLBContainer, 0);
 
     long aStaticTabs[]= { 2, 0, 0 };
     m_pPasswordsLB->SetTabs( aStaticTabs );
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index e7aaccf..0145ec6 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -443,7 +443,7 @@ OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage( vcl::Window* pParent,
     aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
     pCheckLBContainer->set_width_request(aControlSize.Width());
     pCheckLBContainer->set_height_request(aControlSize.Height());
-    m_pCheckLB = new OfaACorrCheckListBox(*pCheckLBContainer);
+    m_pCheckLB = VclPtr<OfaACorrCheckListBox>::Create(*pCheckLBContainer);
 
     m_pCheckLB->SetStyle(m_pCheckLB->GetStyle()|WB_HSCROLL| WB_VSCROLL);
 
@@ -1824,7 +1824,7 @@ OfaQuoteTabPage::OfaQuoteTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
     aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
     pListContainer->set_width_request(aControlSize.Width());
     pListContainer->set_height_request(aControlSize.Height());
-    m_pSwCheckLB = new OfaACorrCheckListBox(*pListContainer),
+    m_pSwCheckLB = VclPtr<OfaACorrCheckListBox>::Create(*pListContainer),
 
     get(m_pSingleTypoCB, "singlereplace");
     get(m_pSglStartQuotePB, "startsingle");
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 2f445d3..2958eba 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1222,7 +1222,7 @@ int SvxCharNamePage::DeactivatePage( SfxItemSet* _pSet )
 VclPtr<SfxTabPage> SvxCharNamePage::Create( vcl::Window* pParent, const SfxItemSet* rSet )
 {
     return VclPtr<SfxTabPage>( new SvxCharNamePage( pParent, *rSet ),
-                              SAL_NO_ACQUIRE );
+                               SAL_NO_ACQUIRE );
 }
 
 
diff --git a/cui/source/tabpages/connect.cxx b/cui/source/tabpages/connect.cxx
index ba48baa..66b4935 100644
--- a/cui/source/tabpages/connect.cxx
+++ b/cui/source/tabpages/connect.cxx
@@ -54,7 +54,7 @@ SvxConnectionDialog::SvxConnectionDialog( vcl::Window* pParent, const SfxItemSet
                                 const SdrView* pSdrView )
     : SfxSingleTabDialog(pParent, rInAttrs)
 {
-    SvxConnectionPage* _pPage = new SvxConnectionPage( get_content_area(), rInAttrs );
+    VclPtrInstance<SvxConnectionPage> _pPage( get_content_area(), rInAttrs );
 
     _pPage->SetView( pSdrView );
     _pPage->Construct();
diff --git a/cui/source/tabpages/dstribut.cxx b/cui/source/tabpages/dstribut.cxx
index 61d4c9b..ac14dbd 100644
--- a/cui/source/tabpages/dstribut.cxx
+++ b/cui/source/tabpages/dstribut.cxx
@@ -37,7 +37,7 @@ SvxDistributeDialog::SvxDistributeDialog(vcl::Window* pParent,
         "cui/ui/distributiondialog.ui")
     , mpPage(NULL)
 {
-    mpPage = new SvxDistributePage(get_content_area(), rInAttrs, eHor, eVer);
+    mpPage = VclPtr<SvxDistributePage>::Create(get_content_area(), rInAttrs, eHor, eVer);
     SetTabPage(mpPage);
 }
 
diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx
index c9a54d9..2053ecf 100644
--- a/cui/source/tabpages/measure.cxx
+++ b/cui/source/tabpages/measure.cxx
@@ -64,7 +64,7 @@ SvxMeasureDialog::SvxMeasureDialog( vcl::Window* pParent, const SfxItemSet& rInA
                                 const SdrView* pSdrView )
     : SfxSingleTabDialog(pParent, rInAttrs)
 {
-    SvxMeasurePage* _pPage = new SvxMeasurePage( get_content_area(), rInAttrs );
+    VclPtrInstance<SvxMeasurePage> _pPage( get_content_area(), rInAttrs );
 
     _pPage->SetView( pSdrView );
     _pPage->Construct();
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 11c3464..1848967 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -530,7 +530,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickAddHdl_Impl)
 
         if( !pWarnBox )
         {
-            pWarnBox.reset(new MessageDialog( GetParentDialog()
+            pWarnBox.reset(VclPtr<MessageDialog>::Create( GetParentDialog()
                                         ,"DuplicateNameDialog"
                                         ,"cui/ui/queryduplicatedialog.ui"));
         }
@@ -639,7 +639,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl_Impl)
 
                 if( !pWarnBox )
                 {
-                    pWarnBox.reset(new MessageDialog( GetParentDialog()
+                    pWarnBox.reset(VclPtr<MessageDialog>::Create( GetParentDialog()
                                                  ,"DuplicateNameDialog"
                                                  ,"cui/ui/queryduplicatedialog.ui"));
                 }
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index 3a72288..9b292e9 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -478,7 +478,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl)
 
         if( !pWarnBox )
         {
-            pWarnBox.reset(new MessageDialog( GetParentDialog()
+            pWarnBox.reset(VclPtr<MessageDialog>::Create( GetParentDialog()
                                         ,"DuplicateNameDialog"
                                         ,"cui/ui/queryduplicatedialog.ui"));
         }
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index 3fecfd8..1a6085e 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -520,7 +520,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl)
 
         if( !pWarnBox )
         {
-            pWarnBox.reset(new MessageDialog( GetParentDialog()
+            pWarnBox.reset(VclPtr<MessageDialog>::Create( GetParentDialog()
                                          ,"DuplicateNameDialog"
                                          ,"cui/ui/queryduplicatedialog.ui"));
         }
diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx
index 1a1d417..c044105 100644
--- a/svtools/source/toolpanel/drawerlayouter.cxx
+++ b/svtools/source/toolpanel/drawerlayouter.cxx
@@ -132,7 +132,7 @@ namespace svt
     {
         ENSURE_OR_RETURN( i_nChildIndex < m_aDrawers.size(), "illegal index", NULL );
 
-        ToolPanelDrawer *pDrawer( m_aDrawers[ i_nChildIndex ] );
+        VclPtr<ToolPanelDrawer> pDrawer( m_aDrawers[ i_nChildIndex ] );
 
         Reference< XAccessible > xItemAccessible = pDrawer->GetAccessible( false );
         if ( !xItemAccessible.is() )
@@ -151,7 +151,7 @@ namespace svt
     {
         OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "DrawerDeckLayouter::PanelInserted: inconsistency!" );
 
-        VclPtr<ToolPanelDrawer> pDrawer( VclPtr<ToolPanelDrawer>::Create( m_rParentWindow, i_pPanel->GetDisplayName() ) );
+        VclPtrInstance<ToolPanelDrawer> pDrawer( m_rParentWindow, i_pPanel->GetDisplayName() );
         pDrawer->SetHelpId( i_pPanel->GetHelpID() );
         // proper Z-Order
         if ( i_nPosition == 0 )
diff --git a/vcl/README.lifecycle b/vcl/README.lifecycle
index 1f60917..c4ca67a 100644
--- a/vcl/README.lifecycle
+++ b/vcl/README.lifecycle
@@ -259,4 +259,3 @@ or:
 	   In simple cases, if we allocate the widget with VclPtrInstance
 	   or VclPtr<Foo>::Create - then we need to disposeAndClear it too.
 
-


More information about the Libreoffice-commits mailing list