[Libreoffice-commits] core.git: Branch 'feature/vclptr' - chart2/source dbaccess/source extensions/source include/dbaccess include/svtools reportdesign/source svtools/source sw/source

Michael Meeks michael.meeks at collabora.com
Mon Apr 20 07:09:58 PDT 2015


 chart2/source/controller/dialogs/dlg_CreationWizard.cxx    |    4 -
 chart2/source/controller/inc/dlg_CreationWizard.hxx        |    2 
 dbaccess/source/ext/macromigration/macromigrationpages.cxx |   16 ++--
 dbaccess/source/ext/macromigration/macromigrationpages.hxx |    8 +-
 dbaccess/source/ui/app/AppController.cxx                   |    8 +-
 dbaccess/source/ui/app/AppDetailPageHelper.cxx             |   14 +--
 dbaccess/source/ui/app/AppDetailView.cxx                   |   18 ++--
 dbaccess/source/ui/app/AppSwapWindow.cxx                   |    2 
 dbaccess/source/ui/app/AppTitleWindow.cxx                  |    6 -
 dbaccess/source/ui/app/AppView.cxx                         |    8 +-
 dbaccess/source/ui/browser/brwctrlr.cxx                    |    2 
 dbaccess/source/ui/browser/brwview.cxx                     |    2 
 dbaccess/source/ui/browser/dataview.cxx                    |    2 
 dbaccess/source/ui/browser/dbtreeview.cxx                  |    2 
 dbaccess/source/ui/browser/genericcontroller.cxx           |    4 -
 dbaccess/source/ui/browser/sbagrid.cxx                     |    4 -
 dbaccess/source/ui/browser/unodatbr.cxx                    |    4 -
 dbaccess/source/ui/control/FieldDescControl.cxx            |   32 ++++----
 dbaccess/source/ui/control/RelationControl.cxx             |    2 
 dbaccess/source/ui/control/TableGrantCtrl.cxx              |    4 -
 dbaccess/source/ui/control/curledit.cxx                    |    4 -
 dbaccess/source/ui/dlg/ConnectionPageSetup.cxx             |   20 ++---
 dbaccess/source/ui/dlg/ConnectionPageSetup.hxx             |   10 +-
 dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx          |   48 ++++++-------
 dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx          |   20 ++---
 dbaccess/source/ui/dlg/TablesSingleDlg.cxx                 |    2 
 dbaccess/source/ui/dlg/UserAdmin.cxx                       |    2 
 dbaccess/source/ui/dlg/dbwiz.cxx                           |   12 +--
 dbaccess/source/ui/dlg/dbwizsetup.cxx                      |   14 +--
 dbaccess/source/ui/dlg/detailpages.cxx                     |    4 -
 dbaccess/source/ui/dlg/indexfieldscontrol.cxx              |    4 -
 dbaccess/source/ui/dlg/sqlmessage.cxx                      |   12 +--
 dbaccess/source/ui/dlg/textconnectionsettings.cxx          |    2 
 dbaccess/source/ui/inc/FieldDescControl.hxx                |    4 -
 dbaccess/source/ui/inc/JoinTableView.hxx                   |    2 
 dbaccess/source/ui/inc/QueryTableView.hxx                  |    2 
 dbaccess/source/ui/inc/RelationTableView.hxx               |    2 
 dbaccess/source/ui/inc/TableWindow.hxx                     |    2 
 dbaccess/source/ui/inc/WExtendPages.hxx                    |    4 -
 dbaccess/source/ui/inc/WTypeSelect.hxx                     |    2 
 dbaccess/source/ui/inc/dbwiz.hxx                           |    2 
 dbaccess/source/ui/inc/dbwizsetup.hxx                      |    2 
 dbaccess/source/ui/misc/WCopyTable.cxx                     |   24 +++---
 dbaccess/source/ui/misc/WNameMatch.cxx                     |    2 
 dbaccess/source/ui/misc/WTypeSelect.cxx                    |    2 
 dbaccess/source/ui/querydesign/JoinController.cxx          |    2 
 dbaccess/source/ui/querydesign/JoinDesignView.cxx          |    2 
 dbaccess/source/ui/querydesign/JoinTableView.cxx           |    6 -
 dbaccess/source/ui/querydesign/LimitBox.cxx                |    3 
 dbaccess/source/ui/querydesign/QueryDesignView.cxx         |    6 -
 dbaccess/source/ui/querydesign/QueryTableView.cxx          |   14 +--
 dbaccess/source/ui/querydesign/QueryTextView.cxx           |    2 
 dbaccess/source/ui/querydesign/QueryViewSwitch.cxx         |    4 -
 dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx      |   14 +--
 dbaccess/source/ui/querydesign/TableWindow.cxx             |    8 +-
 dbaccess/source/ui/querydesign/limitboxcontroller.cxx      |    2 
 dbaccess/source/ui/querydesign/querycontainerwindow.cxx    |    4 -
 dbaccess/source/ui/querydesign/querycontroller.cxx         |    8 --
 dbaccess/source/ui/relationdesign/RelationController.cxx   |    2 
 dbaccess/source/ui/relationdesign/RelationDesignView.cxx   |    2 
 dbaccess/source/ui/relationdesign/RelationTableView.cxx    |   12 +--
 dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx         |    2 
 dbaccess/source/ui/tabledesign/TEditControl.cxx            |    8 +-
 dbaccess/source/ui/tabledesign/TableController.cxx         |    2 
 dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx      |    2 
 dbaccess/source/ui/tabledesign/TableDesignView.cxx         |    8 +-
 dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx       |    6 -
 dbaccess/source/ui/uno/ColumnPeer.cxx                      |    2 
 extensions/source/abpilot/abspilot.cxx                     |   12 +--
 extensions/source/abpilot/abspilot.hxx                     |    2 
 extensions/source/dbpilots/gridwizard.cxx                  |    9 +-
 extensions/source/dbpilots/gridwizard.hxx                  |    2 
 extensions/source/dbpilots/groupboxwiz.cxx                 |   12 +--
 extensions/source/dbpilots/groupboxwiz.hxx                 |    2 
 extensions/source/dbpilots/listcombowizard.cxx             |   14 +--
 extensions/source/dbpilots/listcombowizard.hxx             |    2 
 include/dbaccess/genericcontroller.hxx                     |    2 
 include/svtools/roadmapwizard.hxx                          |    4 -
 include/svtools/wizardmachine.hxx                          |    2 
 reportdesign/source/ui/report/ReportController.cxx         |    2 
 svtools/source/dialogs/roadmapwizard.cxx                   |    4 -
 svtools/source/uno/wizard/wizardshell.cxx                  |    9 +-
 svtools/source/uno/wizard/wizardshell.hxx                  |    2 
 sw/source/ui/dbui/mailmergewizard.cxx                      |    4 -
 sw/source/uibase/inc/mailmergewizard.hxx                   |    2 
 85 files changed, 276 insertions(+), 279 deletions(-)

New commits:
commit f12488405cdfd8555078d15807aafc5ffd1b037b
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon Apr 20 14:00:04 2015 +0100

    dbaccess: convert new to ::Create.
    
    Also convert svtools' WizardShell::createPage.
    
    Change-Id: I09bd40ef4748aa2de7b49eeefc95be06b545ea05

diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
index 4584112..17da732 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -106,9 +106,9 @@ CreationWizard::CreationWizard( vcl::Window* pParent, const uno::Reference< fram
     ActivatePage();
 }
 
-svt::OWizardPage* CreationWizard::createPage(WizardState nState)
+VclPtr<TabPage> CreationWizard::createPage(WizardState nState)
 {
-    svt::OWizardPage* pRet = 0;
+    VclPtr<svt::OWizardPage> pRet;
     if(m_nOnePageOnlyIndex!=-1 && m_nOnePageOnlyIndex!=nState)
         return pRet;
     bool bDoLiveUpdate = m_nOnePageOnlyIndex == -1;
diff --git a/chart2/source/controller/inc/dlg_CreationWizard.hxx b/chart2/source/controller/inc/dlg_CreationWizard.hxx
index 33ba961..152fc84 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard.hxx
@@ -65,7 +65,7 @@ private:
     //no default constructor
     CreationWizard();
 
-    virtual svt::OWizardPage* createPage(WizardState nState) SAL_OVERRIDE;
+    virtual VclPtr<TabPage> createPage(WizardState nState) SAL_OVERRIDE;
 
     ::com::sun::star::uno::Reference<
                        ::com::sun::star::chart2::XChartDocument >   m_xChartModel;
diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.cxx b/dbaccess/source/ext/macromigration/macromigrationpages.cxx
index 65f033b..c97494f 100644
--- a/dbaccess/source/ext/macromigration/macromigrationpages.cxx
+++ b/dbaccess/source/ext/macromigration/macromigrationpages.cxx
@@ -83,9 +83,9 @@ namespace dbmm
         m_pCloseDocError->Show( _bShow );
     }
 
-    TabPage* PreparationPage::Create( ::svt::RoadmapWizard& _rParentDialog )
+    VclPtr<TabPage> PreparationPage::Create( ::svt::RoadmapWizard& _rParentDialog )
     {
-        return new PreparationPage(&_rParentDialog);
+        return VclPtr<PreparationPage>::Create(&_rParentDialog);
     }
 
     // SaveDBDocPage
@@ -176,9 +176,9 @@ namespace dbmm
         return true;
     }
 
-    TabPage* SaveDBDocPage::Create( ::svt::RoadmapWizard& _rParentDialog )
+    VclPtr<TabPage> SaveDBDocPage::Create( ::svt::RoadmapWizard& _rParentDialog )
     {
-        return new SaveDBDocPage( dynamic_cast< MacroMigrationDialog& >( _rParentDialog ) );
+        return VclPtr<SaveDBDocPage>::Create( dynamic_cast< MacroMigrationDialog& >( _rParentDialog ) );
     }
 
     // ProgressPage
@@ -209,9 +209,9 @@ namespace dbmm
         MacroMigrationPage::dispose();
     }
 
-    TabPage* ProgressPage::Create(::svt::RoadmapWizard& _rParentDialog)
+    VclPtr<TabPage> ProgressPage::Create(::svt::RoadmapWizard& _rParentDialog)
     {
-        return new ProgressPage(&_rParentDialog);
+        return VclPtr<ProgressPage>::Create(&_rParentDialog);
     }
 
     void ProgressPage::setDocumentCounts( const sal_Int32 _nForms, const sal_Int32 _nReports )
@@ -304,9 +304,9 @@ namespace dbmm
         MacroMigrationPage::dispose();
     }
 
-    TabPage* ResultPage::Create(::svt::RoadmapWizard& _rParentDialog)
+    VclPtr<TabPage> ResultPage::Create(::svt::RoadmapWizard& _rParentDialog)
     {
-        return new ResultPage(&_rParentDialog);
+        return VclPtr<ResultPage>::Create(&_rParentDialog);
     }
 
     void ResultPage::displayMigrationLog(const bool _bSuccessful, const OUString& _rSummary)
diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.hxx b/dbaccess/source/ext/macromigration/macromigrationpages.hxx
index d7d11ca..70a7082 100644
--- a/dbaccess/source/ext/macromigration/macromigrationpages.hxx
+++ b/dbaccess/source/ext/macromigration/macromigrationpages.hxx
@@ -60,7 +60,7 @@ namespace dbmm
         virtual ~PreparationPage();
         virtual void dispose() SAL_OVERRIDE;
 
-        static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
+        static VclPtr<TabPage> Create( ::svt::RoadmapWizard& _rParentDialog );
 
     public:
         void    showCloseDocsError(bool _bShow);
@@ -76,7 +76,7 @@ namespace dbmm
         SaveDBDocPage(MacroMigrationDialog& _rParentDialog);
         virtual ~SaveDBDocPage();
         virtual void dispose() SAL_OVERRIDE;
-        static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
+        static VclPtr<TabPage> Create( ::svt::RoadmapWizard& _rParentDialog );
 
     public:
         OUString getBackupLocation() const { return m_pLocationController->getURL(); }
@@ -107,7 +107,7 @@ namespace dbmm
         virtual ~ProgressPage();
         virtual void dispose() SAL_OVERRIDE;
 
-        static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
+        static VclPtr<TabPage> Create( ::svt::RoadmapWizard& _rParentDialog );
 
         void    setDocumentCounts( const sal_Int32 _nForms, const sal_Int32 _nReports );
         void    onFinishedSuccessfully();
@@ -140,7 +140,7 @@ namespace dbmm
         virtual ~ResultPage();
         virtual void dispose() SAL_OVERRIDE;
 
-        static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
+        static VclPtr<TabPage> Create( ::svt::RoadmapWizard& _rParentDialog );
 
         void            displayMigrationLog( const bool _bSuccessful, const OUString& _rLog );
 
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 8d5ae4c..0998cfd 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -425,7 +425,7 @@ void SAL_CALL OApplicationController::disposing()
 
 bool OApplicationController::Construct(vcl::Window* _pParent)
 {
-    setView( * new OApplicationView( _pParent, getORB(), *this, m_ePreviewMode ) );
+    setView( VclPtr<OApplicationView>::Create( _pParent, getORB(), *this, m_ePreviewMode ) );
     getView()->SetUniqueId(UID_APP_VIEW);
 
     // late construction
@@ -2078,7 +2078,8 @@ void OApplicationController::renameEntry()
                                     }
                                 }
                                 pNameChecker.reset( new HierarchicalNameCheck( xHNames.get(), OUString() ) );
-                                aDialog.reset( new OSaveAsDlg(
+                                aDialog.reset( VclPtr<OSaveAsDlg>::Create(
+
                                     getView(), getORB(), sName, sLabel, *pNameChecker, SAD_TITLE_RENAME ) );
                             }
                         }
@@ -2097,7 +2098,8 @@ void OApplicationController::renameEntry()
 
                         ensureConnection();
                         pNameChecker.reset( new DynamicTableOrQueryNameCheck( getConnection(), nCommandType ) );
-                        aDialog.reset( new OSaveAsDlg(
+                        aDialog.reset( VclPtr<OSaveAsDlg>::Create(
+
                             getView(), nCommandType, getORB(), getConnection(),
                                 *aList.begin(), *pNameChecker, SAD_TITLE_RENAME ) );
                     }
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 06c4a2a..6907968 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -188,10 +188,10 @@ namespace
 // class OAppDetailPageHelper
 OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindow& _rBorderWin,PreviewMode _ePreviewMode) : Window(_pParent,WB_DIALOGCONTROL)
     ,m_rBorderWin(_rBorderWin)
-    ,m_aFL(new FixedLine(this,WB_VERT))
-    ,m_aTBPreview(new ToolBox(this,WB_TABSTOP) )
-    ,m_aBorder(new Window(this,WB_BORDER | WB_READONLY))
-    ,m_aPreview(new OPreviewWindow(m_aBorder.get()))
+    ,m_aFL(VclPtr<FixedLine>::Create(this,WB_VERT))
+    ,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_ePreviewMode(_ePreviewMode)
 {
@@ -211,7 +211,7 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo
 
     m_aPreview->SetHelpId(HID_APP_VIEW_PREVIEW_1);
 
-    m_pTablePreview.set( new OTablePreviewWindow(m_aBorder.get(), WB_READONLY | WB_DIALOGCONTROL ) );
+    m_pTablePreview.set( VclPtr<OTablePreviewWindow>::Create(m_aBorder.get(), WB_READONLY | WB_DIALOGCONTROL ) );
     m_pTablePreview->SetHelpId(HID_APP_VIEW_PREVIEW_2);
 
     m_aDocumentInfo->SetHelpId(HID_APP_VIEW_PREVIEW_3);
@@ -570,7 +570,7 @@ void OAppDetailPageHelper::createTablesPage(const Reference< XConnection>& _xCon
 
     if ( !m_pLists[E_TABLE] )
     {
-        OTableTreeListBox* pTreeView = new OTableTreeListBox(this,
+        VclPtrInstance<OTableTreeListBox> pTreeView(this,
             WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP);
         pTreeView->SetHelpId(HID_APP_TABLE_TREE);
         m_pLists[E_TABLE] = pTreeView;
@@ -737,7 +737,7 @@ void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContaine
 
 DBTreeListBox* OAppDetailPageHelper::createSimpleTree( const OString& _sHelpId, const Image& _rImage)
 {
-    DBTreeListBox* pTreeView = new DBTreeListBox(this,
+    VclPtrInstance<DBTreeListBox> pTreeView(this,
                        WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP);
     pTreeView->SetHelpId( _sHelpId );
     return createTree( pTreeView, _rImage );
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index 2d51155..fb04e6d 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -341,10 +341,10 @@ void OCreationList::KeyInput( const KeyEvent& rKEvt )
 
 OTasksWindow::OTasksWindow(vcl::Window* _pParent,OApplicationDetailView* _pDetailView)
     : Window(_pParent,WB_DIALOGCONTROL )
-    ,m_aCreation(new OCreationList(*this))
-    ,m_aDescription(new FixedText(this))
-    ,m_aHelpText(new FixedText(this,WB_WORDBREAK))
-    ,m_aFL(new FixedLine(this,WB_VERT))
+    ,m_aCreation(VclPtr<OCreationList>::Create(*this))
+    ,m_aDescription(VclPtr<FixedText>::Create(this))
+    ,m_aHelpText(VclPtr<FixedText>::Create(this,WB_WORDBREAK))
+    ,m_aFL(VclPtr<FixedLine>::Create(this,WB_VERT))
     ,m_pDetailView(_pDetailView)
 {
     SetUniqueId(UID_APP_TASKS_WINDOW);
@@ -532,19 +532,19 @@ void OTasksWindow::Clear()
 // class OApplicationDetailView
 
 OApplicationDetailView::OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode) : OSplitterView(&_rParent,false )
-    ,m_aHorzSplitter(new Splitter(this))
-    ,m_aTasks(new dbaui::OTitleWindow(this,STR_TASKS,WB_BORDER | WB_DIALOGCONTROL) )
-    ,m_aContainer(new dbaui::OTitleWindow(this,0,WB_BORDER | WB_DIALOGCONTROL) )
+    ,m_aHorzSplitter(VclPtr<Splitter>::Create(this))
+    ,m_aTasks(VclPtr<dbaui::OTitleWindow>::Create(this,STR_TASKS,WB_BORDER | WB_DIALOGCONTROL) )
+    ,m_aContainer(VclPtr<dbaui::OTitleWindow>::Create(this,0,WB_BORDER | WB_DIALOGCONTROL) )
     ,m_rBorderWin(_rParent)
 {
     SetUniqueId(UID_APP_DETAIL_VIEW);
     ImplInitSettings( true, true, true );
 
-    m_pControlHelper = new OAppDetailPageHelper(m_aContainer.get(),m_rBorderWin,_ePreviewMode);
+    m_pControlHelper = VclPtr<OAppDetailPageHelper>::Create(m_aContainer.get(),m_rBorderWin,_ePreviewMode);
     m_pControlHelper->Show();
     m_aContainer->setChildWindow(m_pControlHelper);
 
-    OTasksWindow* pTasks = new OTasksWindow(m_aTasks.get(),this);
+    VclPtrInstance<OTasksWindow> pTasks(m_aTasks.get(),this);
     pTasks->Show();
     pTasks->Disable(m_rBorderWin.getView()->getCommandController().isDataSourceReadOnly());
     m_aTasks->setChildWindow(pTasks);
diff --git a/dbaccess/source/ui/app/AppSwapWindow.cxx b/dbaccess/source/ui/app/AppSwapWindow.cxx
index 8a337c6..1f215df 100644
--- a/dbaccess/source/ui/app/AppSwapWindow.cxx
+++ b/dbaccess/source/ui/app/AppSwapWindow.cxx
@@ -38,7 +38,7 @@ using namespace ::com::sun::star::container;
 // class OApplicationSwapWindow
 OApplicationSwapWindow::OApplicationSwapWindow( vcl::Window* _pParent, OAppBorderWindow& _rBorderWindow )
     :Window(_pParent,WB_DIALOGCONTROL )
-    ,m_aIconControl(new OApplicationIconControl(this))
+    ,m_aIconControl(VclPtr<OApplicationIconControl>::Create(this))
     ,m_eLastType(E_NONE)
     ,m_rBorderWin( _rBorderWindow )
 {
diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx
index 5beb0ee..71317b0 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.cxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.cxx
@@ -29,9 +29,9 @@ namespace dbaui
 
 OTitleWindow::OTitleWindow(vcl::Window* _pParent,sal_uInt16 _nTitleId,WinBits _nBits,bool _bShift)
 : Window(_pParent,_nBits | WB_DIALOGCONTROL)
-, m_aSpace1(new FixedText(this))
-, m_aSpace2(new FixedText(this))
-, m_aTitle(new FixedText(this))
+, m_aSpace1(VclPtr<FixedText>::Create(this))
+, m_aSpace2(VclPtr<FixedText>::Create(this))
+, m_aTitle(VclPtr<FixedText>::Create(this))
 , m_pChild(NULL)
 , m_bShift(_bShift)
 {
diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx
index 9a24ebf..6fa8030 100644
--- a/dbaccess/source/ui/app/AppView.cxx
+++ b/dbaccess/source/ui/app/AppView.cxx
@@ -68,9 +68,9 @@ OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePrev
 
     SetBorderStyle(WindowBorderStyle::MONO);
 
-    m_pPanel = new OTitleWindow(this,STR_DATABASE,WB_BORDER | WB_DIALOGCONTROL, false);
+    m_pPanel = VclPtr<OTitleWindow>::Create(this,STR_DATABASE,WB_BORDER | WB_DIALOGCONTROL, false);
     m_pPanel->SetBorderStyle(WindowBorderStyle::MONO);
-    OApplicationSwapWindow* pSwap = new OApplicationSwapWindow( m_pPanel, *this );
+    VclPtrInstance<OApplicationSwapWindow> pSwap( m_pPanel, *this );
     pSwap->Show();
     pSwap->SetUniqueId(UID_APP_SWAP_VIEW);
 
@@ -78,7 +78,7 @@ OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePrev
     m_pPanel->SetUniqueId(UID_APP_DATABASE_VIEW);
     m_pPanel->Show();
 
-    m_pDetailView = new OApplicationDetailView(*this,_ePreviewMode);
+    m_pDetailView = VclPtr<OApplicationDetailView>::Create(*this,_ePreviewMode);
     m_pDetailView->Show();
 
     ImplInitSettings();
@@ -195,7 +195,7 @@ OApplicationView::OApplicationView( vcl::Window* pParent
     {
     }
 
-    m_pWin = new OAppBorderWindow(this,_ePreviewMode);
+    m_pWin = VclPtr<OAppBorderWindow>::Create(this,_ePreviewMode);
     m_pWin->SetUniqueId(UID_APP_VIEW_BORDER_WIN);
     m_pWin->Show();
 
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 5b174bf..6ba8a67 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -757,7 +757,7 @@ bool SbaXDataBrowserController::Construct(vcl::Window* pParent)
     }
 
     // create the view
-    setView( * new UnoDataBrowserView( pParent, *this, getORB() ) );
+    setView( VclPtr<UnoDataBrowserView>::Create( pParent, *this, getORB() ) );
     if (!getBrowserView())
         return false;
 
diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx
index 59585c5..a940238 100644
--- a/dbaccess/source/ui/browser/brwview.cxx
+++ b/dbaccess/source/ui/browser/brwview.cxx
@@ -171,7 +171,7 @@ void UnoDataBrowserView::showStatus( const OUString& _rStatus )
     else
     {
         if (!m_pStatus)
-            m_pStatus = new FixedText(this);
+            m_pStatus = VclPtr<FixedText>::Create(this);
         m_pStatus->SetText(_rStatus);
         m_pStatus->Show();
         Resize();
diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx
index 7c85660..fd7451f 100644
--- a/dbaccess/source/ui/browser/dataview.cxx
+++ b/dbaccess/source/ui/browser/dataview.cxx
@@ -66,7 +66,7 @@ namespace dbaui
         :Window(pParent,nStyle)
         ,m_xContext(_rxContext)
         ,m_xController( &_rController )
-        ,m_aSeparator( new FixedLine(this) )
+        ,m_aSeparator( VclPtr<FixedLine>::Create(this) )
     {
         m_pAccel.reset(::svt::AcceleratorExecute::createAcceleratorHelper());
         m_aSeparator->Show();
diff --git a/dbaccess/source/ui/browser/dbtreeview.cxx b/dbaccess/source/ui/browser/dbtreeview.cxx
index ad337c8..4a63fe7 100644
--- a/dbaccess/source/ui/browser/dbtreeview.cxx
+++ b/dbaccess/source/ui/browser/dbtreeview.cxx
@@ -36,7 +36,7 @@ DBTreeView::DBTreeView( vcl::Window* pParent, WinBits nBits)
                     , m_pTreeListBox(NULL)
 {
 
-    m_pTreeListBox = new DBTreeListBox(this, WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
+    m_pTreeListBox = VclPtr<DBTreeListBox>::Create(this, WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
     m_pTreeListBox->EnableCheckButton(NULL);
     m_pTreeListBox->SetDragDropMode( 0 );
     m_pTreeListBox->EnableInplaceEditing( true );
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index 4080220..3179d4f 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -982,9 +982,9 @@ Reference< XConnection > OGenericUnoController::connect( const OUString& _rDataS
     return xConnection;
 }
 
-void OGenericUnoController::setView( ODataView& i_rView )
+void OGenericUnoController::setView( const VclPtr<ODataView> &i_rView )
 {
-    m_pView = &i_rView;
+    m_pView = i_rView;
 }
 
 void OGenericUnoController::clearView()
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index fe2268b..11633ef 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -551,7 +551,7 @@ SbaXGridPeer* SbaXGridPeer::getImplementation(const Reference< XInterface >& _rx
 
 VclPtr<FmGridControl> SbaXGridPeer::imp_CreateControl(vcl::Window* pParent, WinBits nStyle)
 {
-    return new SbaGridControl( m_xContext, pParent, this, nStyle);
+    return VclPtr<SbaGridControl>::Create( m_xContext, pParent, this, nStyle);
 }
 
 // SbaGridHeader
@@ -729,7 +729,7 @@ void SbaGridControl::dispose()
 
 VclPtr<BrowserHeader> SbaGridControl::imp_CreateHeaderBar(BrowseBox* pParent)
 {
-    return new SbaGridHeader(pParent);
+    return VclPtr<SbaGridHeader>::Create(pParent);
 }
 
 CellController* SbaGridControl::GetController(long nRow, sal_uInt16 nCol)
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 7ec0b2a..2bc1d3e 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -348,11 +348,11 @@ bool SbaTableQueryBrowser::Construct(vcl::Window* pParent)
         // create controls and set sizes
         const long  nFrameWidth = getBrowserView()->LogicToPixel( ::Size( 3, 0 ), MAP_APPFONT ).Width();
 
-        m_pSplitter = new Splitter(getBrowserView(),WB_HSCROLL);
+        m_pSplitter = VclPtr<Splitter>::Create(getBrowserView(),WB_HSCROLL);
         m_pSplitter->SetPosSizePixel( ::Point(0,0), ::Size(nFrameWidth,0) );
         m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) );
 
-        m_pTreeView = new DBTreeView(getBrowserView(), WB_TABSTOP | WB_BORDER);
+        m_pTreeView = VclPtr<DBTreeView>::Create(getBrowserView(), WB_TABSTOP | WB_BORDER);
         m_pTreeView->SetPreExpandHandler(LINK(this, SbaTableQueryBrowser, OnExpandEntry));
 
         m_pTreeView->setCopyHandler(LINK(this, SbaTableQueryBrowser, OnCopyEntry));
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index a83aef2..a6fb6d7 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -139,8 +139,8 @@ OFieldDescControl::OFieldDescControl( vcl::Window* pParent, OTableDesignHelpBar*
 
 void OFieldDescControl::Contruct()
 {
-    m_pVertScroll = new ScrollBar(this, WB_VSCROLL | WB_REPEAT | WB_DRAG);
-    m_pHorzScroll = new ScrollBar(this, WB_HSCROLL | WB_REPEAT | WB_DRAG);
+    m_pVertScroll = VclPtr<ScrollBar>::Create(this, WB_VSCROLL | WB_REPEAT | WB_DRAG);
+    m_pHorzScroll = VclPtr<ScrollBar>::Create(this, WB_HSCROLL | WB_REPEAT | WB_DRAG);
     m_pVertScroll->SetScrollHdl(LINK(this, OFieldDescControl, OnScroll));
     m_pHorzScroll->SetScrollHdl(LINK(this, OFieldDescControl, OnScroll));
     m_pVertScroll->Show();
@@ -782,7 +782,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
             return;
         m_nPos++;
         pDefaultText = CreateText(STR_DEFAULT_VALUE);
-        pDefault = new OPropEditCtrl( this, STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_DEFAULT, WB_BORDER );
+        pDefault = VclPtr<OPropEditCtrl>::Create( this, STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_DEFAULT, WB_BORDER );
         InitializeControl(pDefault,HID_TAB_ENT_DEFAULT,false);
         break;
     case tpAutoIncrementValue:
@@ -790,7 +790,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
             return;
         m_nPos++;
         m_pAutoIncrementValueText = CreateText(STR_AUTOINCREMENT_VALUE);
-        m_pAutoIncrementValue = new OPropEditCtrl( this, STR_HELP_AUTOINCREMENT_VALUE, FIELD_PROPERTY_AUTOINCREMENT, WB_BORDER );
+        m_pAutoIncrementValue = VclPtr<OPropEditCtrl>::Create( this, STR_HELP_AUTOINCREMENT_VALUE, FIELD_PROPERTY_AUTOINCREMENT, WB_BORDER );
         m_pAutoIncrementValue->SetText( getAutoIncrementValue() );
         InitializeControl(m_pAutoIncrementValue,HID_TAB_AUTOINCREMENTVALUE,false);
         break;
@@ -805,7 +805,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
         {
             m_nPos++;
             pRequiredText = CreateText(STR_FIELD_REQUIRED);
-            pRequired = new OPropListBoxCtrl( this, STR_HELP_FIELD_REQUIRED, FIELD_PROPERTY_REQUIRED, WB_DROPDOWN);
+            pRequired = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_FIELD_REQUIRED, FIELD_PROPERTY_REQUIRED, WB_DROPDOWN);
 
             pRequired->InsertEntry( aYes );
             pRequired->InsertEntry( aNo );
@@ -821,7 +821,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
             return;
         m_nPos++;
         pAutoIncrementText = CreateText(STR_FIELD_AUTOINCREMENT);
-        pAutoIncrement = new OPropListBoxCtrl( this, STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_AUTOINC, WB_DROPDOWN );
+        pAutoIncrement = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_AUTOINC, WB_DROPDOWN );
         pAutoIncrement->InsertEntry( aYes );
         pAutoIncrement->InsertEntry( aNo );
         pAutoIncrement->SelectEntryPos(0);
@@ -841,7 +841,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
             return;
         m_nPos++;
         m_pTypeText = CreateText(STR_TAB_FIELD_DATATYPE);
-        m_pType = new OPropListBoxCtrl( this, STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_TYPE, WB_DROPDOWN );
+        m_pType = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_AUTOINCREMENT, FIELD_PROPERTY_TYPE, WB_DROPDOWN );
         m_pType->SetDropDownLineCount(20);
         {
             const OTypeInfoMap* pTypeInfo = getTypeInfo();
@@ -874,7 +874,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
                 DBG_UNHANDLED_EXCEPTION();
             }
             m_pColumnNameText = CreateText(STR_TAB_FIELD_NAME);
-            m_pColumnName = new OPropColumnEditCtrl( this,
+            m_pColumnName = VclPtr<OPropColumnEditCtrl>::Create( this,
                                                     aTmpString,
                                                     STR_HELP_DEFAULT_VALUE,
                                                     FIELD_PROPERTY_COLUMNNAME,
@@ -891,7 +891,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
         m_nPos++;
         pNumTypeText = CreateText(STR_NUMERIC_TYPE);
 
-        pNumType = new OPropListBoxCtrl( this, STR_HELP_NUMERIC_TYPE, FIELD_PROPERTY_NUMTYPE, WB_DROPDOWN );
+        pNumType = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_NUMERIC_TYPE, FIELD_PROPERTY_NUMTYPE, WB_DROPDOWN );
         pNumType->SetDropDownLineCount(5);
 
         pNumType->InsertEntry( OUString("Byte") );
@@ -925,12 +925,12 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
             m_nPos++;
             pFormatText = CreateText(STR_FORMAT);
 
-            pFormatSample = new OPropEditCtrl( this, STR_HELP_FORMAT_CODE, -1, WB_BORDER );
+            pFormatSample = VclPtr<OPropEditCtrl>::Create( this, STR_HELP_FORMAT_CODE, -1, WB_BORDER );
             pFormatSample->SetReadOnly(true);
             pFormatSample->Enable(false);
             InitializeControl(pFormatSample,HID_TAB_ENT_FORMAT_SAMPLE,false);
 
-            pFormat = new PushButton( this, ModuleRes(PB_FORMAT) );
+            pFormat = VclPtr<PushButton>::Create( this, ModuleRes(PB_FORMAT) );
             const sal_Int32 nControlHeight = GetMaxControlHeight();
             pFormat->SetSizePixel(Size(nControlHeight, nControlHeight));
             pFormat->SetClickHdl( LINK( this, OFieldDescControl, FormatClickHdl ) );
@@ -945,7 +945,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
 
         m_nPos++;
         pBoolDefaultText = CreateText(STR_DEFAULT_VALUE);
-        pBoolDefault = new OPropListBoxCtrl( this, STR_HELP_BOOL_DEFAULT, FIELD_PROPERTY_BOOL_DEFAULT, WB_DROPDOWN );
+        pBoolDefault = VclPtr<OPropListBoxCtrl>::Create( this, STR_HELP_BOOL_DEFAULT, FIELD_PROPERTY_BOOL_DEFAULT, WB_DROPDOWN );
         pBoolDefault->SetDropDownLineCount(3);
         pBoolDefault->InsertEntry(OUString(ModuleRes(STR_VALUE_NONE)));
         pBoolDefault->InsertEntry(aYes);
@@ -967,17 +967,17 @@ void OFieldDescControl::InitializeControl(Control* _pControl,const OString& _sHe
     _pControl->EnableClipSiblings();
 }
 
-FixedText* OFieldDescControl::CreateText(sal_uInt16 _nTextRes)
+VclPtr<FixedText> OFieldDescControl::CreateText(sal_uInt16 _nTextRes)
 {
-    FixedText* pFixedText = new FixedText( this );
+    VclPtrInstance<FixedText> pFixedText( this );
     pFixedText->SetText( ModuleRes(_nTextRes) );
     pFixedText->EnableClipSiblings();
     return pFixedText;
 }
 
-OPropNumericEditCtrl* OFieldDescControl::CreateNumericControl(sal_uInt16 _nHelpStr,short _nProperty,const OString& _sHelpId)
+VclPtr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(sal_uInt16 _nHelpStr,short _nProperty,const OString& _sHelpId)
 {
-    OPropNumericEditCtrl* pControl = new OPropNumericEditCtrl( this, _nHelpStr, _nProperty, WB_BORDER );
+    VclPtrInstance<OPropNumericEditCtrl> pControl( this, _nHelpStr, _nProperty, WB_BORDER );
     pControl->SetDecimalDigits(0);
     pControl->SetMin(0);
     pControl->SetMax(0x7FFFFFFF);   // Should be changed outside, if needed
diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx
index d5b9cda..09be082 100644
--- a/dbaccess/source/ui/control/RelationControl.cxx
+++ b/dbaccess/source/ui/control/RelationControl.cxx
@@ -166,7 +166,7 @@ namespace dbaui
             InsertDataColumn( DEST_COLUMN, m_pConnData->getReferencedTable()->GetWinName(), 100);
             // If the Defs do not yet exits, we need to set them with SetSource-/-DestDef
 
-            m_pListCell.reset( new ListBoxControl( &GetDataWindow() ) );
+            m_pListCell.reset( VclPtr<ListBoxControl>::Create( &GetDataWindow() ) );
 
             // set browse mode
             SetMode(    BROWSER_COLUMNSELECTION |
diff --git a/dbaccess/source/ui/control/TableGrantCtrl.cxx b/dbaccess/source/ui/control/TableGrantCtrl.cxx
index 79ea40c..0fcc53c 100644
--- a/dbaccess/source/ui/control/TableGrantCtrl.cxx
+++ b/dbaccess/source/ui/control/TableGrantCtrl.cxx
@@ -128,10 +128,10 @@ void OTableGrantControl::Init()
     // ComboBox instanzieren
     if(!m_pCheckCell)
     {
-        m_pCheckCell    = new CheckBoxControl( &GetDataWindow() );
+        m_pCheckCell    = VclPtr<CheckBoxControl>::Create( &GetDataWindow() );
         m_pCheckCell->GetBox().EnableTriState(false);
 
-        m_pEdit         = new Edit( &GetDataWindow() );
+        m_pEdit         = VclPtr<Edit>::Create( &GetDataWindow() );
         m_pEdit->SetReadOnly();
         m_pEdit->Enable(false);
     }
diff --git a/dbaccess/source/ui/control/curledit.cxx b/dbaccess/source/ui/control/curledit.cxx
index 56197ff..917e887 100644
--- a/dbaccess/source/ui/control/curledit.cxx
+++ b/dbaccess/source/ui/control/curledit.cxx
@@ -89,10 +89,10 @@ void OConnectionURLEdit::SetText(const OUString& _rStr, const Selection& /*_rNew
 {
     // create new sub controls, if necessary
     if (!GetSubEdit())
-        SetSubEdit(new Edit(this, 0));
+        SetSubEdit(VclPtr<Edit>::Create(this, 0));
     if ( !m_pForcedPrefix )
     {
-        m_pForcedPrefix = new FixedText(this, WB_VCENTER);
+        m_pForcedPrefix = VclPtr<FixedText>::Create(this, WB_VCENTER);
 
         // we use a gray background for the fixed text
         StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
index 4199794..b081ad8 100644
--- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx
@@ -63,29 +63,29 @@ namespace dbaui
     using namespace ::dbtools;
     using namespace ::svt;
 
-    OGenericAdministrationPage* OConnectionTabPageSetup::CreateDbaseTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateDbaseTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_DBASE_HELPTEXT, STR_DBASE_HEADERTEXT, STR_DBASE_PATH_OR_FILE);
+        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 );
     }
 
-    OGenericAdministrationPage* OConnectionTabPageSetup::CreateMSAccessTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateMSAccessTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_MSACCESS_HELPTEXT, STR_MSACCESS_HEADERTEXT, STR_MSACCESS_MDB_FILE);
+        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 );
     }
 
-    OGenericAdministrationPage* OConnectionTabPageSetup::CreateADOTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateADOTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ADO_HELPTEXT, STR_ADO_HEADERTEXT, STR_COMMONURL);
+        return VclPtr<OGenericAdministrationPage>( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ADO_HELPTEXT, STR_ADO_HEADERTEXT, STR_COMMONURL), SAL_NO_ACQUIRE );
     }
 
-    OGenericAdministrationPage* OConnectionTabPageSetup::CreateODBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateODBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, STR_ODBC_HELPTEXT, STR_ODBC_HEADERTEXT, STR_NAME_OF_ODBC_DATASOURCE);
+        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 );
     }
 
-    OGenericAdministrationPage* OConnectionTabPageSetup::CreateUserDefinedTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateUserDefinedTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, USHRT_MAX, USHRT_MAX, STR_COMMONURL);
+        return VclPtr<OGenericAdministrationPage>( new OConnectionTabPageSetup( pParent, "ConnectionPage", "dbaccess/ui/dbwizconnectionpage.ui", _rAttrSet, USHRT_MAX, USHRT_MAX, STR_COMMONURL), SAL_NO_ACQUIRE );
     }
 
     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 633dcb7..1f0a22c 100644
--- a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx
+++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx
@@ -48,11 +48,11 @@ namespace dbaui
     public:
         virtual ~OConnectionTabPageSetup();
         virtual void dispose() SAL_OVERRIDE;
-        static  OGenericAdministrationPage* CreateDbaseTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
-        static  OGenericAdministrationPage* CreateMSAccessTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
-        static  OGenericAdministrationPage* CreateADOTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
-        static  OGenericAdministrationPage* CreateODBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
-        static  OGenericAdministrationPage* CreateUserDefinedTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+        static  VclPtr<OGenericAdministrationPage> CreateDbaseTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+        static  VclPtr<OGenericAdministrationPage> CreateMSAccessTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+        static  VclPtr<OGenericAdministrationPage> CreateADOTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+        static  VclPtr<OGenericAdministrationPage> CreateODBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+        static  VclPtr<OGenericAdministrationPage> CreateUserDefinedTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
 
         virtual bool        FillItemSet (SfxItemSet* _rCoreAttrs) SAL_OVERRIDE;
 
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index 6a8f356..c457c96 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -60,9 +60,9 @@ namespace dbaui
 {
 using namespace ::com::sun::star;
 
-    OGenericAdministrationPage* OTextConnectionPageSetup::CreateTextTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OTextConnectionPageSetup::CreateTextTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return ( new OTextConnectionPageSetup( pParent, _rAttrSet ) );
+        return VclPtr<OTextConnectionPageSetup>::Create( pParent, _rAttrSet );
     }
 
     // OTextConnectionPageSetup
@@ -70,7 +70,7 @@ using namespace ::com::sun::star;
         :OConnectionTabPageSetup(pParent, "DBWizTextPage", "dbaccess/ui/dbwiztextpage.ui", _rCoreAttrs, STR_TEXT_HELPTEXT, STR_TEXT_HEADERTEXT, STR_TEXT_PATH_OR_FILE)
     {
 
-        m_pTextConnectionHelper = new OTextConnectionHelper( get<VclVBox>("TextPageContainer"), TC_EXTENSION | TC_SEPARATORS );
+        m_pTextConnectionHelper = VclPtr<OTextConnectionHelper>::Create( get<VclVBox>("TextPageContainer"), TC_EXTENSION | TC_SEPARATORS );
         m_pTextConnectionHelper->SetClickHandler(LINK( this, OTextConnectionPageSetup, ImplGetExtensionHdl ) );
     }
 
@@ -129,9 +129,9 @@ using namespace ::com::sun::star;
         return m_pTextConnectionHelper->prepareLeave();
     }
 
-    OGenericAdministrationPage* OLDAPConnectionPageSetup::CreateLDAPTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OLDAPConnectionPageSetup::CreateLDAPTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return ( new OLDAPConnectionPageSetup( pParent, _rAttrSet ) );
+        return VclPtr<OLDAPConnectionPageSetup>::Create( pParent, _rAttrSet );
     }
 
     // OLDAPPageSetup
@@ -241,9 +241,9 @@ using namespace ::com::sun::star;
         return 0L;
     }
 
-    OMySQLIntroPageSetup* OMySQLIntroPageSetup::CreateMySQLIntroTabPage( vcl::Window* _pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OMySQLIntroPageSetup> OMySQLIntroPageSetup::CreateMySQLIntroTabPage( vcl::Window* _pParent, const SfxItemSet& _rAttrSet )
     {
-        return ( new OMySQLIntroPageSetup( _pParent, _rAttrSet) );
+        return VclPtr<OMySQLIntroPageSetup>::Create( _pParent, _rAttrSet);
     }
 
 
@@ -324,7 +324,7 @@ using namespace ::com::sun::star;
     // MySQLNativeSetupPage
     MySQLNativeSetupPage::MySQLNativeSetupPage( vcl::Window* _pParent, const SfxItemSet& _rCoreAttrs )
         :OGenericAdministrationPage( _pParent, "DBWizMysqlNativePage", "dbaccess/ui/dbwizmysqlnativepage.ui", _rCoreAttrs )
-        ,m_aMySQLSettings       ( new MySQLNativeSettings(*get<VclVBox>("MySQLSettingsContainer"), getControlModifiedLink()) )
+        ,m_aMySQLSettings       ( VclPtr<MySQLNativeSettings>::Create(*get<VclVBox>("MySQLSettingsContainer"), getControlModifiedLink()) )
     {
         get(m_pHelpText, "helptext");
         m_aMySQLSettings->Show();
@@ -344,9 +344,9 @@ using namespace ::com::sun::star;
         OGenericAdministrationPage::dispose();
     }
 
-    OGenericAdministrationPage* MySQLNativeSetupPage::Create( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> MySQLNativeSetupPage::Create( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return new MySQLNativeSetupPage( pParent, _rAttrSet );
+        return VclPtr<MySQLNativeSetupPage>::Create( pParent, _rAttrSet );
     }
 
     void MySQLNativeSetupPage::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList )
@@ -453,26 +453,26 @@ using namespace ::com::sun::star;
         OGenericAdministrationPage::dispose();
     }
 
-    OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
+        return VclPtr<OGeneralSpecialJDBCConnectionPageSetup>::Create( pParent,
                                                          _rAttrSet,
                                                          DSID_MYSQL_PORTNUMBER ,
                                                          STR_MYSQL_DEFAULT,
                                                          STR_MYSQLJDBC_HELPTEXT,
                                                          STR_MYSQLJDBC_HEADERTEXT,
-                                                         STR_MYSQL_DRIVERCLASSTEXT) );
+                                                         STR_MYSQL_DRIVERCLASSTEXT);
     }
 
-    OGenericAdministrationPage* OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return ( new OGeneralSpecialJDBCConnectionPageSetup( pParent,
+        return VclPtr<OGeneralSpecialJDBCConnectionPageSetup>::Create( pParent,
                                                           _rAttrSet,
                                                           DSID_ORACLE_PORTNUMBER,
                                                           STR_ORACLE_DEFAULT,
                                                           STR_ORACLE_HELPTEXT,
                                                           STR_ORACLE_HEADERTEXT,
-                                                          STR_ORACLE_DRIVERCLASSTEXT) );
+                                                          STR_ORACLE_DRIVERCLASSTEXT);
     }
 
     void OGeneralSpecialJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
@@ -578,9 +578,9 @@ using namespace ::com::sun::star;
         return 0L;
     }
 
-    OGenericAdministrationPage* OJDBCConnectionPageSetup::CreateJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OJDBCConnectionPageSetup::CreateJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return ( new OJDBCConnectionPageSetup( pParent, _rAttrSet));
+        return VclPtr<OJDBCConnectionPageSetup>::Create( pParent, _rAttrSet);
     }
 
     // OMySQLJDBCConnectionPageSetup
@@ -700,9 +700,9 @@ using namespace ::com::sun::star;
         return 0L;
     }
 
-    OGenericAdministrationPage* OSpreadSheetConnectionPageSetup::CreateSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OSpreadSheetConnectionPageSetup::CreateSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return ( new OSpreadSheetConnectionPageSetup( pParent, _rAttrSet ) );
+        return VclPtr<OSpreadSheetConnectionPageSetup>::Create( pParent, _rAttrSet );
     }
 
 
@@ -747,9 +747,9 @@ using namespace ::com::sun::star;
         return bChangedSomething;
     }
 
-    OGenericAdministrationPage* OAuthentificationPageSetup::CreateAuthentificationTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OAuthentificationPageSetup::CreateAuthentificationTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
     {
-        return ( new OAuthentificationPageSetup( pParent, _rAttrSet) );
+        return VclPtr<OAuthentificationPageSetup>::Create( pParent, _rAttrSet);
     }
 
 
@@ -824,9 +824,9 @@ using namespace ::com::sun::star;
         return bChangedSomething;
     }
 
-    OGenericAdministrationPage* OFinalDBPageSetup::CreateFinalDBTabPageSetup( vcl::Window* pParent, const SfxItemSet& _rAttrSet)
+    VclPtr<OGenericAdministrationPage> OFinalDBPageSetup::CreateFinalDBTabPageSetup( vcl::Window* pParent, const SfxItemSet& _rAttrSet)
     {
-        return ( new OFinalDBPageSetup( pParent, _rAttrSet) );
+        return VclPtr<OFinalDBPageSetup>::Create( pParent, _rAttrSet);
     }
 
 
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index 23416fc..109c3f3 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -40,7 +40,7 @@ namespace dbaui
     {
     public:
         virtual bool        FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
-        static  OGenericAdministrationPage* CreateSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+        static VclPtr<OGenericAdministrationPage> CreateSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
         OSpreadSheetConnectionPageSetup(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs);
         virtual ~OSpreadSheetConnectionPageSetup();
         virtual void dispose() SAL_OVERRIDE;
@@ -62,7 +62,7 @@ namespace dbaui
         VclPtr<OTextConnectionHelper>  m_pTextConnectionHelper;
 
         virtual bool        FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
-        static   OGenericAdministrationPage* CreateTextTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+        static VclPtr<OGenericAdministrationPage> CreateTextTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
         OTextConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
         virtual ~OTextConnectionPageSetup();
         virtual void dispose() SAL_OVERRIDE;
@@ -82,7 +82,7 @@ namespace dbaui
     {
     public:
         virtual bool        FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
-        static  OGenericAdministrationPage* CreateLDAPTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+        static VclPtr<OGenericAdministrationPage> CreateLDAPTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
         OLDAPConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
         virtual ~OLDAPConnectionPageSetup();
         virtual void dispose() SAL_OVERRIDE;
@@ -118,7 +118,7 @@ namespace dbaui
         virtual ~MySQLNativeSetupPage();
         virtual void dispose() SAL_OVERRIDE;
 
-        static OGenericAdministrationPage* Create( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+        static VclPtr<OGenericAdministrationPage> Create( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
 
     protected:
         virtual void fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList ) SAL_OVERRIDE;
@@ -146,8 +146,8 @@ namespace dbaui
                                         , sal_uInt16 _nDriverClassId );
         virtual ~OGeneralSpecialJDBCConnectionPageSetup();
         virtual void dispose() SAL_OVERRIDE;
-    static  OGenericAdministrationPage* CreateMySQLJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
-    static  OGenericAdministrationPage* CreateOracleJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+    static VclPtr<OGenericAdministrationPage> CreateMySQLJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+    static VclPtr<OGenericAdministrationPage> CreateOracleJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
 
     protected:
         virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
@@ -183,7 +183,7 @@ namespace dbaui
                 OJDBCConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
         virtual ~OJDBCConnectionPageSetup();
         virtual void dispose() SAL_OVERRIDE;
-        static  OGenericAdministrationPage* CreateJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+        static VclPtr<OGenericAdministrationPage> CreateJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
 
     protected:
         virtual bool checkTestConnection() SAL_OVERRIDE;
@@ -215,7 +215,7 @@ namespace dbaui
         virtual ~OMySQLIntroPageSetup();
         virtual void dispose() SAL_OVERRIDE;
 
-        static OMySQLIntroPageSetup*    CreateMySQLIntroTabPage( vcl::Window* _pParent, const SfxItemSet& _rAttrSet );
+        static VclPtr<OMySQLIntroPageSetup> CreateMySQLIntroTabPage( vcl::Window* _pParent, const SfxItemSet& _rAttrSet );
         ConnectionType      getMySQLMode();
         Link                maClickHdl;
         void                SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
@@ -242,7 +242,7 @@ namespace dbaui
     {
     public:
         virtual bool        FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
-        static  OGenericAdministrationPage* CreateAuthentificationTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+        static VclPtr<OGenericAdministrationPage> CreateAuthentificationTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
         OAuthentificationPageSetup(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs);
         virtual ~OAuthentificationPageSetup();
         virtual void dispose() SAL_OVERRIDE;
@@ -265,7 +265,7 @@ namespace dbaui
     {
     public:
         virtual bool        FillItemSet ( SfxItemSet* _rCoreAttrs ) SAL_OVERRIDE;
-           static   OGenericAdministrationPage* CreateFinalDBTabPageSetup( vcl::Window* pParent, const SfxItemSet& _rAttrSet);
+        static VclPtr<OGenericAdministrationPage> CreateFinalDBTabPageSetup( vcl::Window* pParent, const SfxItemSet& _rAttrSet);
 
         VclPtr<FixedText>   m_pFTFinalHeader;
         VclPtr<FixedText>   m_pFTFinalHelpText;
diff --git a/dbaccess/source/ui/dlg/TablesSingleDlg.cxx b/dbaccess/source/ui/dlg/TablesSingleDlg.cxx
index 6957d26..8a29c48 100644
--- a/dbaccess/source/ui/dlg/TablesSingleDlg.cxx
+++ b/dbaccess/source/ui/dlg/TablesSingleDlg.cxx
@@ -54,7 +54,7 @@ OTableSubscriptionDialog::OTableSubscriptionDialog(vcl::Window* pParent
     m_pImpl->translateProperties(xDatasource, *m_pOutSet);
     SetInputSet(m_pOutSet);
 
-    OTableSubscriptionPage* pTabPage = new OTableSubscriptionPage(get_content_area(), *m_pOutSet, this);
+    VclPtrInstance<OTableSubscriptionPage> pTabPage(get_content_area(), *m_pOutSet, this);
     pTabPage->SetServiceFactory(_rxORB);
     SetTabPage(pTabPage);
 }
diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx
index 8d621bc..9438194 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.cxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.cxx
@@ -124,7 +124,7 @@ OUserAdmin::OUserAdmin(vcl::Window* pParent,const SfxItemSet& _rAttrSet)
     , m_pNEWUSER(0)
     , m_pCHANGEPWD(0)
     , m_pDELETEUSER(0)
-    ,m_TableCtrl(new OTableGrantControl(get<VclAlignment>("table"), WB_TABSTOP))
+    ,m_TableCtrl(VclPtr<OTableGrantControl>::Create(get<VclAlignment>("table"), WB_TABSTOP))
 {
     m_TableCtrl->Show();
     get(m_pUSER, "user");
diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx
index a4f0eca4..f4eb2ff 100644
--- a/dbaccess/source/ui/dlg/dbwiz.cxx
+++ b/dbaccess/source/ui/dlg/dbwiz.cxx
@@ -233,16 +233,16 @@ void ODbTypeWizDialog::clearPassword()
     m_pImpl->clearPassword();
 }
 
-TabPage* ODbTypeWizDialog::createPage(WizardState _nState)
+VclPtr<TabPage> ODbTypeWizDialog::createPage(WizardState _nState)
 {
     sal_uInt16 nStringId = STR_PAGETITLE_ADVANCED;
-    TabPage* pPage = NULL;
+    VclPtr<TabPage> pPage;
     switch(_nState)
     {
         case START_PAGE: // start state
         {
-            pPage = new OGeneralPageDialog(this,*m_pOutSet);
-            OGeneralPage* pGeneralPage = static_cast< OGeneralPage* >( pPage );
+            pPage = VclPtr<OGeneralPageDialog>::Create(this,*m_pOutSet);
+            OGeneralPage* pGeneralPage = static_cast< OGeneralPage* >( pPage.get() );
             pGeneralPage->SetTypeSelectHandler( LINK( this, ODbTypeWizDialog, OnTypeSelected));
             nStringId = STR_PAGETITLE_GENERAL;
         }
@@ -290,8 +290,8 @@ TabPage* ODbTypeWizDialog::createPage(WizardState _nState)
     // register ourself as modified listener
     if ( pPage )
     {
-        static_cast<OGenericAdministrationPage*>(pPage)->SetServiceFactory( m_pImpl->getORB() );
-        static_cast<OGenericAdministrationPage*>(pPage)->SetAdminDialog(this,this);
+        static_cast<OGenericAdministrationPage*>(pPage.get())->SetServiceFactory( m_pImpl->getORB() );
+        static_cast<OGenericAdministrationPage*>(pPage.get())->SetAdminDialog(this,this);
         pPage->SetText(ModuleRes(nStringId));
         defaultButton( _nState == START_PAGE ? WZB_NEXT : WZB_FINISH );
         enableButtons( WZB_FINISH, _nState == START_PAGE ? sal_False : sal_True);
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 07c7418..5cba935 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -471,16 +471,16 @@ void ODbTypeWizDialogSetup::clearPassword()
     m_pImpl->clearPassword();
 }
 
-TabPage* ODbTypeWizDialogSetup::createPage(WizardState _nState)
+VclPtr<TabPage> ODbTypeWizDialogSetup::createPage(WizardState _nState)
 {
-    SfxTabPage* pFirstPage;
-    OGenericAdministrationPage* pPage = NULL;
+    VclPtr<SfxTabPage> pFirstPage;
+    VclPtr<OGenericAdministrationPage> pPage;
     switch(_nState)
     {
         case PAGE_DBSETUPWIZARD_INTRO:
-            pFirstPage = new OGeneralPageWizard(this,*m_pOutSet);
-            pPage = static_cast<OGenericAdministrationPage*> (pFirstPage);
-            m_pGeneralPage = static_cast<OGeneralPageWizard*>(pFirstPage);
+            pFirstPage = VclPtr<OGeneralPageWizard>::Create(this,*m_pOutSet);
+            pPage = static_cast<OGenericAdministrationPage*> (pFirstPage.get());
+            m_pGeneralPage = static_cast<OGeneralPageWizard*>(pFirstPage.get());
             m_pGeneralPage->SetTypeSelectHandler(LINK(this, ODbTypeWizDialogSetup, OnTypeSelected));
             m_pGeneralPage->SetCreationModeHandler(LINK( this, ODbTypeWizDialogSetup, OnChangeCreationMode ) );
             m_pGeneralPage->SetDocumentSelectionHandler(LINK( this, ODbTypeWizDialogSetup, OnRecentDocumentSelected ) );
@@ -552,7 +552,7 @@ TabPage* ODbTypeWizDialogSetup::createPage(WizardState _nState)
 
         case PAGE_DBSETUPWIZARD_FINAL:
             pPage = OFinalDBPageSetup::CreateFinalDBTabPageSetup(this,*m_pOutSet);
-            m_pFinalPage = static_cast<OFinalDBPageSetup*> (pPage);
+            m_pFinalPage = static_cast<OFinalDBPageSetup*> (pPage.get());
             break;
     }
 
diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx
index 86c2e1a..b090ddc 100644
--- a/dbaccess/source/ui/dlg/detailpages.cxx
+++ b/dbaccess/source/ui/dlg/detailpages.cxx
@@ -556,7 +556,7 @@ namespace dbaui
     // MySQLNativePage
     MySQLNativePage::MySQLNativePage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs )
         :OCommonBehaviourTabPage(pParent, "MysqlNativePage", "dbaccess/ui/mysqlnativepage.ui", _rCoreAttrs, CBTP_USE_CHARSET )
-        ,m_aMySQLSettings       ( new MySQLNativeSettings(*get<VclVBox>("MySQLSettingsContainer"), getControlModifiedLink()) )
+        ,m_aMySQLSettings       ( VclPtr<MySQLNativeSettings>::Create(*get<VclVBox>("MySQLSettingsContainer"), getControlModifiedLink()) )
     {
         get(m_pSeparator1, "connectionheader");
         get(m_pSeparator2, "userheader");
@@ -750,7 +750,7 @@ namespace dbaui
         :OCommonBehaviourTabPage(pParent, "EmptyPage", "dbaccess/ui/emptypage.ui", _rCoreAttrs, 0)
     {
 
-        m_pTextConnectionHelper = new OTextConnectionHelper( get<VclVBox>("EmptyPage"), TC_EXTENSION | TC_HEADER | TC_SEPARATORS | TC_CHARSET );
+        m_pTextConnectionHelper = VclPtr<OTextConnectionHelper>::Create( get<VclVBox>("EmptyPage"), TC_EXTENSION | TC_HEADER | TC_SEPARATORS | TC_CHARSET );
     }
 
     OTextDetailsPage::~OTextDetailsPage()
diff --git a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
index f99b65e..474230d 100644
--- a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
+++ b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
@@ -245,7 +245,7 @@ namespace dbaui
             nSortOrderColumnWidth += GetTextWidth(OUString('0')) * 2;
             InsertDataColumn(COLUMN_ID_ORDER, sColumnName, nSortOrderColumnWidth, HIB_STDSTYLE, 1);
 
-            m_pSortingCell = new ListBoxControl(&GetDataWindow());
+            m_pSortingCell = VclPtr<ListBoxControl>::Create(&GetDataWindow());
             m_pSortingCell->InsertEntry(m_sAscendingText);
             m_pSortingCell->InsertEntry(m_sDescendingText);
             m_pSortingCell->SetHelpId( HID_DLGINDEX_INDEXDETAILS_SORTORDER );
@@ -261,7 +261,7 @@ namespace dbaui
 
         // create the cell controllers
         // for the field name cell
-        m_pFieldNameCell = new ListBoxControl(&GetDataWindow());
+        m_pFieldNameCell = VclPtr<ListBoxControl>::Create(&GetDataWindow());
         m_pFieldNameCell->InsertEntry(OUString());
         m_pFieldNameCell->SetHelpId( HID_DLGINDEX_INDEXDETAILS_FIELD );
         const OUString* pFields = _rAvailableFields.getConstArray();
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx
index d86fbda..e42073e 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -671,9 +671,9 @@ void OSQLMessageBox::Construct( WinBits _nStyle, MessageType _eImage )
 
 OSQLMessageBox::OSQLMessageBox(vcl::Window* _pParent, const SQLExceptionInfo& _rException, WinBits _nStyle, const OUString& _rHelpURL )
     :ButtonDialog( _pParent, WB_HORZ | WB_STDDIALOG )
-    ,m_aInfoImage( new FixedImage(this) )
-    ,m_aTitle( new FixedText(this, WB_WORDBREAK | WB_LEFT) )
-    ,m_aMessage( new FixedText(this, WB_WORDBREAK | WB_LEFT) )
+    ,m_aInfoImage( VclPtr<FixedImage>::Create(this) )
+    ,m_aTitle( VclPtr<FixedText>::Create(this, WB_WORDBREAK | WB_LEFT) )
+    ,m_aMessage( VclPtr<FixedText>::Create(this, WB_WORDBREAK | WB_LEFT) )
     ,m_sHelpURL( _rHelpURL )
     ,m_pImpl( new SQLMessageBox_Impl( _rException ) )
 {
@@ -682,9 +682,9 @@ OSQLMessageBox::OSQLMessageBox(vcl::Window* _pParent, const SQLExceptionInfo& _r
 
 OSQLMessageBox::OSQLMessageBox( vcl::Window* _pParent, const OUString& _rTitle, const OUString& _rMessage, WinBits _nStyle, MessageType _eType, const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo )
     :ButtonDialog( _pParent, WB_HORZ | WB_STDDIALOG )
-    ,m_aInfoImage( new FixedImage(this) )
-    ,m_aTitle( new FixedText(this, WB_WORDBREAK | WB_LEFT) )
-    ,m_aMessage( new FixedText(this, WB_WORDBREAK | WB_LEFT) )
+    ,m_aInfoImage( VclPtr<FixedImage>::Create(this) )
+    ,m_aTitle( VclPtr<FixedText>::Create(this, WB_WORDBREAK | WB_LEFT) )
+    ,m_aMessage( VclPtr<FixedText>::Create(this, WB_WORDBREAK | WB_LEFT) )
 {
     SQLContext aError;
     aError.Message = _rTitle;
diff --git a/dbaccess/source/ui/dlg/textconnectionsettings.cxx b/dbaccess/source/ui/dlg/textconnectionsettings.cxx
index 0fd69e9..9fa798b 100644
--- a/dbaccess/source/ui/dlg/textconnectionsettings.cxx
+++ b/dbaccess/source/ui/dlg/textconnectionsettings.cxx
@@ -34,7 +34,7 @@ namespace dbaui
         ,m_rItems( _rItems )
     {
         get(m_pOK, "ok");
-        m_pTextConnectionHelper.reset( new OTextConnectionHelper( get<VclVBox>("TextPageContainer"), TC_HEADER | TC_SEPARATORS | TC_CHARSET ) );
+        m_pTextConnectionHelper.reset( VclPtr<OTextConnectionHelper>::Create( get<VclVBox>("TextPageContainer"), TC_HEADER | TC_SEPARATORS | TC_CHARSET ) );
 
         m_pOK->SetClickHdl( LINK( this, TextConnectionSettingsDialog, OnOK ) );
     }
diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx
index 6de1b7f..983bfc6 100644
--- a/dbaccess/source/ui/inc/FieldDescControl.hxx
+++ b/dbaccess/source/ui/inc/FieldDescControl.hxx
@@ -133,8 +133,8 @@ namespace dbaui
 
         bool                isTextFormat(const OFieldDescription* _pFieldDescr,sal_uInt32& _nFormatKey) const;
         void                Contruct();
-        OPropNumericEditCtrl* CreateNumericControl(sal_uInt16 _nHelpStr,short _nProperty,const OString& _sHelpId);
-        FixedText*          CreateText(sal_uInt16 _nTextRes);
+        VclPtr<OPropNumericEditCtrl> CreateNumericControl(sal_uInt16 _nHelpStr,short _nProperty,const OString& _sHelpId);
+        VclPtr<FixedText>   CreateText(sal_uInt16 _nTextRes);
         void                InitializeControl(Control* _pControl,const OString& _sHelpId,bool _bAddChangeHandler);
 
     protected:
diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx
index 466d77c..608c2d8 100644
--- a/dbaccess/source/ui/inc/JoinTableView.hxx
+++ b/dbaccess/source/ui/inc/JoinTableView.hxx
@@ -293,7 +293,7 @@ namespace dbaui
             @param _pData The data corresponding to the window.
             @return The new TableWindow
         */
-        virtual OTableWindow* createWindow(const TTableWindowData::value_type& _pData) = 0;
+        virtual VclPtr<OTableWindow> createWindow(const TTableWindowData::value_type& _pData) = 0;
 
         /** determines whether the classes Init method should accept a query
             name, or only table names */
diff --git a/dbaccess/source/ui/inc/QueryTableView.hxx b/dbaccess/source/ui/inc/QueryTableView.hxx
index 962c71c..3b8d746 100644
--- a/dbaccess/source/ui/inc/QueryTableView.hxx
+++ b/dbaccess/source/ui/inc/QueryTableView.hxx
@@ -47,7 +47,7 @@ namespace dbaui
         virtual void ConnDoubleClicked(OTableConnection* pConnection) SAL_OVERRIDE;
         virtual void KeyInput(const KeyEvent& rEvt) SAL_OVERRIDE;
 
-        virtual OTableWindow* createWindow(const TTableWindowData::value_type& _pData) SAL_OVERRIDE;
+        virtual VclPtr<OTableWindow> createWindow(const TTableWindowData::value_type& _pData) SAL_OVERRIDE;
 
         /** called when init fails at the tablewindowdata because the m_xTable
             object could not provide columns, but no exception was thrown.
diff --git a/dbaccess/source/ui/inc/RelationTableView.hxx b/dbaccess/source/ui/inc/RelationTableView.hxx
index 1ae9625..da09f88 100644
--- a/dbaccess/source/ui/inc/RelationTableView.hxx
+++ b/dbaccess/source/ui/inc/RelationTableView.hxx
@@ -40,7 +40,7 @@ namespace dbaui
         virtual void ConnDoubleClicked( OTableConnection* pConnection ) SAL_OVERRIDE;
         virtual void AddTabWin(const OUString& _rComposedName, const OUString& rWinName, bool bNewTable = false) SAL_OVERRIDE;
 
-        virtual OTableWindow* createWindow(const TTableWindowData::value_type& _pData) SAL_OVERRIDE;
+        virtual VclPtr<OTableWindow> createWindow(const TTableWindowData::value_type& _pData) SAL_OVERRIDE;
 
         /** determines whether the classes Init method should accept a query
             name, or only table names */
diff --git a/dbaccess/source/ui/inc/TableWindow.hxx b/dbaccess/source/ui/inc/TableWindow.hxx
index 459184f..2d1aac6 100644
--- a/dbaccess/source/ui/inc/TableWindow.hxx
+++ b/dbaccess/source/ui/inc/TableWindow.hxx
@@ -82,7 +82,7 @@ namespace dbaui
         virtual void    MouseButtonDown( const MouseEvent& rEvt ) SAL_OVERRIDE;
         virtual void    DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
 
-        OTableWindowListBox*    CreateListBox();
+        VclPtr<OTableWindowListBox> CreateListBox();
             // called at FIRST Init
         bool FillListBox();
             // called at EACH Init
diff --git a/dbaccess/source/ui/inc/WExtendPages.hxx b/dbaccess/source/ui/inc/WExtendPages.hxx
index 612dc48..e51abe0 100644
--- a/dbaccess/source/ui/inc/WExtendPages.hxx
+++ b/dbaccess/source/ui/inc/WExtendPages.hxx
@@ -35,7 +35,7 @@ namespace dbaui
         {
         }
 
-        static OWizTypeSelect* Create( vcl::Window* _pParent, SvStream& _rInput ) { return new OWizHTMLExtend( _pParent, _rInput ); }
+        static VclPtr<OWizTypeSelect> Create( vcl::Window* _pParent, SvStream& _rInput ) { return VclPtr<OWizHTMLExtend>::Create( _pParent, _rInput ); }
     };
     // Wizard Page: OWizRTFExtend
     class OWizRTFExtend : public OWizTypeSelect
@@ -48,7 +48,7 @@ namespace dbaui
         {
         }
 
-        static OWizTypeSelect* Create( vcl::Window* _pParent, SvStream& _rInput ) { return new OWizRTFExtend( _pParent, _rInput ); }
+        static VclPtr<OWizTypeSelect> Create( vcl::Window* _pParent, SvStream& _rInput ) { return VclPtr<OWizRTFExtend>::Create( _pParent, _rInput ); }
     };
 
     // Wizard Page: OWizNormalExtend
diff --git a/dbaccess/source/ui/inc/WTypeSelect.hxx b/dbaccess/source/ui/inc/WTypeSelect.hxx
index c2f7d8e..d86c70e 100644
--- a/dbaccess/source/ui/inc/WTypeSelect.hxx
+++ b/dbaccess/source/ui/inc/WTypeSelect.hxx
@@ -127,7 +127,7 @@ namespace dbaui
         inline void setDuplicateName(bool _bDuplicateName) { m_bDuplicateName = _bDuplicateName; }
     };
 
-    typedef OWizTypeSelect* (*TypeSelectionPageFactory)( vcl::Window*, SvStream& );
+    typedef VclPtr<OWizTypeSelect> (*TypeSelectionPageFactory)( vcl::Window*, SvStream& );
 }
 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WTYPESELECT_HXX
 
diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx
index b12d103..ce534eb 100644
--- a/dbaccess/source/ui/inc/dbwiz.hxx
+++ b/dbaccess/source/ui/inc/dbwiz.hxx
@@ -93,7 +93,7 @@ public:
 
 protected:
     /// to override to create new pages
-    virtual TabPage*    createPage(WizardState _nState) SAL_OVERRIDE;
+    virtual VclPtr<TabPage> createPage(WizardState _nState) SAL_OVERRIDE;
     virtual WizardState determineNextState(WizardState _nCurrentState) const SAL_OVERRIDE;
     virtual bool        leaveState(WizardState _nState) SAL_OVERRIDE;
     virtual ::svt::IWizardPageController*
diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx
index ce39f6f..7992666 100644
--- a/dbaccess/source/ui/inc/dbwizsetup.hxx
+++ b/dbaccess/source/ui/inc/dbwizsetup.hxx
@@ -128,7 +128,7 @@ public:
 
 protected:
     /// to override to create new pages
-    virtual TabPage*    createPage(WizardState _nState) SAL_OVERRIDE;
+    virtual VclPtr<TabPage> createPage(WizardState _nState) SAL_OVERRIDE;
     virtual bool        leaveState(WizardState _nState) SAL_OVERRIDE;
     virtual void        enterState(WizardState _nState) SAL_OVERRIDE;
     virtual ::svt::IWizardPageController* getPageController( TabPage* _pCurrentPage ) const SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index fdfda8c..fe61d4c 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -578,16 +578,16 @@ OCopyTableWizard::OCopyTableWizard( vcl::Window * pParent, const OUString& _rDef
         m_sName = ::dbtools::composeTableName(m_xDestConnection->getMetaData(),sCatalog,sSchema,sTable,false,::dbtools::eInTableDefinitions);
     }
 
-    OCopyTable* pPage1( new OCopyTable( this ) );
+    VclPtrInstance<OCopyTable> pPage1( this );
     pPage1->disallowUseHeaderLine();
     if ( !bAllowViews )
         pPage1->disallowViews();
     pPage1->setCreateStyleAction();
     AddWizardPage(pPage1);
 
-    AddWizardPage( new OWizNameMatching( this ) );
-    AddWizardPage( new OWizColumnSelect( this ) );
-    AddWizardPage( new OWizNormalExtend( this ) );
+    AddWizardPage( VclPtr<OWizNameMatching>::Create( this ) );
+    AddWizardPage( VclPtr<OWizColumnSelect>::Create( this ) );
+    AddWizardPage( VclPtr<OWizNormalExtend>::Create( this ) );
     ActivatePage();
 }
 
@@ -624,13 +624,13 @@ OCopyTableWizard::OCopyTableWizard( vcl::Window* pParent, const OUString& _rDefa
 
     m_xInteractionHandler.set( InteractionHandler::createWithParent(m_xContext, 0), UNO_QUERY );
 
-    OCopyTable* pPage1( new OCopyTable( this ) );
+    VclPtrInstance<OCopyTable> pPage1( this );
     pPage1->disallowViews();
     pPage1->setCreateStyleAction();
     AddWizardPage( pPage1 );
 
-    AddWizardPage( new OWizNameMatching( this ) );
-    AddWizardPage( new OWizColumnSelect( this ) );
+    AddWizardPage( VclPtr<OWizNameMatching>::Create( this ) );
+    AddWizardPage( VclPtr<OWizColumnSelect>::Create( this ) );
     AddWizardPage( (*_pTypeSelectionPageFactory)( this, _rTypeSelectionPageArg ) );
 
     ActivatePage();
@@ -640,11 +640,11 @@ void OCopyTableWizard::construct()
 {
     SetSizePixel(Size(580, 350));
 
-    AddButton( m_pbHelp = new HelpButton(this, WB_TABSTOP) );
-    AddButton( m_pbCancel = new CancelButton(this, WB_TABSTOP) );
-    AddButton( m_pbPrev = new PushButton(this, WB_TABSTOP));
-    AddButton( m_pbNext = new PushButton(this, WB_TABSTOP));
-    AddButton( m_pbFinish = new PushButton(this, WB_TABSTOP));
+    AddButton( m_pbHelp = VclPtr<HelpButton>::Create(this, WB_TABSTOP) );
+    AddButton( m_pbCancel = VclPtr<CancelButton>::Create(this, WB_TABSTOP) );
+    AddButton( m_pbPrev = VclPtr<PushButton>::Create(this, WB_TABSTOP));
+    AddButton( m_pbNext = VclPtr<PushButton>::Create(this, WB_TABSTOP));
+    AddButton( m_pbFinish = VclPtr<PushButton>::Create(this, WB_TABSTOP));
 
     m_pbHelp->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
     m_pbCancel->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index 46c7634..3ddbc83 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -374,7 +374,7 @@ OColumnTreeBox::OColumnTreeBox( vcl::Window* pParent, WinBits nBits )
 
 extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeOColumnTreeBox(vcl::Window *pParent, VclBuilder::stringmap &)
 {
-    return new OColumnTreeBox(pParent);
+    return new OColumnTreeBox(pParent, SAL_NO_ACQUIRE);
 }
 
 void OColumnTreeBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind)
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index 5f9643b..e294f32 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -218,7 +218,7 @@ OUString OWizTypeSelectControl::getAutoIncrementValue() const
 #define IMG_PRIMARY_KEY 1
 OWizTypeSelect::OWizTypeSelect( vcl::Window* pParent, SvStream* _pStream )
                :OWizardPage( pParent, "TypeSelect", "dbaccess/ui/typeselectpage.ui")
-               ,m_pTypeControl(new OWizTypeSelectControl(get<VclVBox>("control_container"), this) )
+               ,m_pTypeControl(VclPtr<OWizTypeSelectControl>::Create(get<VclVBox>("control_container"), this) )
                ,m_pParserStream( _pStream )
                ,m_nDisplayRow(0)
                ,m_bAutoIncrementEnabled(false)
diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx
index c5a3cad..ac48303 100644
--- a/dbaccess/source/ui/querydesign/JoinController.cxx
+++ b/dbaccess/source/ui/querydesign/JoinController.cxx
@@ -269,7 +269,7 @@ void OJoinController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
             return;
         case ID_BROWSER_ADDTABLE:
             if ( !m_pAddTableDialog )
-                m_pAddTableDialog = new OAddTableDlg( getView(), impl_getDialogContext() );
+                m_pAddTableDialog = VclPtr<OAddTableDlg>::Create( getView(), impl_getDialogContext() );
 
             if ( m_pAddTableDialog->IsVisible() )
             {
diff --git a/dbaccess/source/ui/querydesign/JoinDesignView.cxx b/dbaccess/source/ui/querydesign/JoinDesignView.cxx
index 673bcc7..61e4028 100644
--- a/dbaccess/source/ui/querydesign/JoinDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinDesignView.cxx
@@ -56,7 +56,7 @@ OJoinDesignView::OJoinDesignView(vcl::Window* _pParent, OJoinController& _rContr
     ,m_pTableView(NULL)
     ,m_rController( _rController )
 {
-    m_pScrollWindow = new OScrollWindowHelper(this);
+    m_pScrollWindow = VclPtr<OScrollWindowHelper>::Create(this);
 }
 
 OJoinDesignView::~OJoinDesignView()
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 32242f1..ed5b079 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -65,9 +65,9 @@ using namespace ::com::sun::star::lang;
 #define TABWIN_HEIGHT_STD   120
 
 OScrollWindowHelper::OScrollWindowHelper( vcl::Window* pParent) : Window( pParent)
-    ,m_aHScrollBar( new ScrollBar(this, WB_HSCROLL|WB_REPEAT|WB_DRAG) )
-    ,m_aVScrollBar( new ScrollBar(this, WB_VSCROLL|WB_REPEAT|WB_DRAG) )
-    ,m_pCornerWindow(new ScrollBarBox(this, WB_3DLOOK))
+    ,m_aHScrollBar( VclPtr<ScrollBar>::Create(this, WB_HSCROLL|WB_REPEAT|WB_DRAG) )
+    ,m_aVScrollBar( VclPtr<ScrollBar>::Create(this, WB_VSCROLL|WB_REPEAT|WB_DRAG) )
+    ,m_pCornerWindow(VclPtr<ScrollBarBox>::Create(this, WB_3DLOOK))
     ,m_pTableView(NULL)
 {
 
diff --git a/dbaccess/source/ui/querydesign/LimitBox.cxx b/dbaccess/source/ui/querydesign/LimitBox.cxx
index d22cb84d..4cd4206 100644
--- a/dbaccess/source/ui/querydesign/LimitBox.cxx
+++ b/dbaccess/source/ui/querydesign/LimitBox.cxx
@@ -110,8 +110,7 @@ void LimitBox::LoadDefaultLimits()
 
 extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLimitBox( vcl::Window *pParent, VclBuilder::stringmap & )
 {
-    LimitBox* pBox = new LimitBox( pParent, WB_DROPDOWN | WB_VSCROLL );
-    return pBox;
+    return new LimitBox( pParent, WB_DROPDOWN | WB_VSCROLL );
 }
 
 
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 3a3c4de..998e147 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -2490,7 +2490,7 @@ OQueryDesignView::OQueryDesignView( OQueryContainerWindow* _pParent,
                                     OQueryController& _rController,
                                     const Reference< XComponentContext >& _rxContext)
     :OQueryView( _pParent, _rController, _rxContext )
-    ,m_aSplitter( new Splitter(this) )
+    ,m_aSplitter( VclPtr<Splitter>::Create(this) )
     ,m_eChildFocus(NONE)
     ,m_bInSplitHandler( false )
 {
@@ -2505,7 +2505,7 @@ OQueryDesignView::OQueryDesignView( OQueryContainerWindow* _pParent,
     {
     }
 
-    m_pSelectionBox = new OSelectionBrowseBox(this);
+    m_pSelectionBox = VclPtr<OSelectionBrowseBox>::Create(this);
 
     setNoneVisbleRow(static_cast<OQueryController&>(getController()).getVisibleRows());
     m_pSelectionBox->Show();
@@ -2545,7 +2545,7 @@ IMPL_LINK( OQueryDesignView, SplitHdl, void*, /*p*/ )
 
 void OQueryDesignView::Construct()
 {
-    m_pTableView = new OQueryTableView(m_pScrollWindow,this);
+    m_pTableView = VclPtr<OQueryTableView>::Create(m_pScrollWindow,this);
     ::dbaui::notifySystemWindow(this,m_pTableView,::comphelper::mem_fun(&TaskPaneList::AddWindow));
     OQueryView::Construct();
 }
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 374a2e4..b39bf31 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -306,7 +306,7 @@ void OQueryTableView::ReSync()
         }
 
         // adds a new connection to join view and notifies our accessible and invaldates the controller
-        addConnection(new OQueryTableConnection(this, *aConIter));
+        addConnection(VclPtr<OQueryTableConnection>::Create(this, *aConIter));
     }
 }
 
@@ -318,9 +318,9 @@ void OQueryTableView::ClearAll()
     m_pView->getController().setModified(sal_True);
 }
 
-OTableWindow* OQueryTableView::createWindow(const TTableWindowData::value_type& _pData)
+VclPtr<OTableWindow> OQueryTableView::createWindow(const TTableWindowData::value_type& _pData)
 {
-    return new OQueryTableWindow(this,_pData);
+    return VclPtr<OQueryTableWindow>::Create(this,_pData);
 }
 
 void OQueryTableView::NotifyTabConnection(const OQueryTableConnection& rNewConn, bool _bCreateUndoAction)
@@ -355,7 +355,7 @@ void OQueryTableView::NotifyTabConnection(const OQueryTableConnection& rNewConn,
         OQueryTableConnectionData* pNewData = static_cast< OQueryTableConnectionData*>(rNewConn.GetData()->NewInstance());
         pNewData->CopyFrom(*rNewConn.GetData());
         TTableConnectionData::value_type aData(pNewData);
-        OQueryTableConnection* pNewConn = new OQueryTableConnection(this, aData);
+        VclPtrInstance<OQueryTableConnection> pNewConn(this, aData);
         GetConnection(pNewConn);
 
         connectionModified(this,pNewConn,_bCreateUndoAction);
@@ -457,7 +457,7 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString&
         // I do not need to add TabWinData to the DocShell list, ShowTabWin does that.
 
     // Create a new window
-    OQueryTableWindow* pNewTabWin = static_cast<OQueryTableWindow*>(createWindow(pNewTabWinData));
+    VclPtr<OQueryTableWindow> pNewTabWin = static_cast<OQueryTableWindow*>(createWindow(pNewTabWinData).get());
     // No need to initialize, as that happens in ShowTabWin
 
     // New UndoAction
@@ -531,7 +531,7 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString&
                                 break;
                         }
                     }
-                    if ( aIter != aEnd && pNewTabWin != aIter->second )
+                    if ( aIter != aEnd && pNewTabWin.get() != aIter->second.get() )
                         addConnections( this, *pNewTabWin, *static_cast<OQueryTableWindow*>(aIter->second.get()), xFKeyColumns );
                 }
                 break;
@@ -669,7 +669,7 @@ void OQueryTableView::createNewConnection()
         else
         {
             // create a new conenction and append it
-            OQueryTableConnection* pQConn = new OQueryTableConnection(this, pData);
+            VclPtrInstance<OQueryTableConnection> pQConn(this, pData);
             GetConnection(pQConn);
             pConn = pQConn;
         }
diff --git a/dbaccess/source/ui/querydesign/QueryTextView.cxx b/dbaccess/source/ui/querydesign/QueryTextView.cxx
index cb86ac7..775408b 100644
--- a/dbaccess/source/ui/querydesign/QueryTextView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTextView.cxx
@@ -42,7 +42,7 @@ using namespace ::com::sun::star::frame;
 OQueryTextView::OQueryTextView(OQueryContainerWindow* _pParent)
     :Window(_pParent)
 {
-    m_pEdit = new OSqlEdit(this);
+    m_pEdit = VclPtr<OSqlEdit>::Create(this);
     m_pEdit->SetRightToLeft(false);
     m_pEdit->ClearModifyFlag();
     m_pEdit->SaveValue();
diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
index 101a9ab..4baf6079 100644
--- a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
+++ b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
@@ -36,8 +36,8 @@ OQueryViewSwitch::OQueryViewSwitch(OQueryContainerWindow* _pParent, OQueryContro
 : m_bAddTableDialogWasVisible(false)
 {
 
-    m_pTextView     = new OQueryTextView(_pParent);
-    m_pDesignView   = new OQueryDesignView( _pParent, _rController, _rxContext );
+    m_pTextView     = VclPtr<OQueryTextView>::Create(_pParent);
+    m_pDesignView   = VclPtr<OQueryDesignView>::Create( _pParent, _rController, _rxContext );
 }
 
 OQueryViewSwitch::~OQueryViewSwitch()
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 8c3be11..0b0c4c8 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -116,12 +116,12 @@ OSelectionBrowseBox::OSelectionBrowseBox( vcl::Window* pParent )
                 |   BROWSER_HLINESFULL      | BROWSER_VLINESFULL
                 |   BROWSER_HEADERBAR_NEW   ;
 
-    m_pTextCell     = new Edit(&GetDataWindow(), 0);
-    m_pVisibleCell  = new CheckBoxControl(&GetDataWindow());
-    m_pTableCell    = new ListBoxControl(&GetDataWindow());     m_pTableCell->SetDropDownLineCount( 20 );
-    m_pFieldCell    = new ComboBoxControl(&GetDataWindow());    m_pFieldCell->SetDropDownLineCount( 20 );
-    m_pOrderCell    = new ListBoxControl(&GetDataWindow());
-    m_pFunctionCell = new ListBoxControl(&GetDataWindow());     m_pFunctionCell->SetDropDownLineCount( 20 );
+    m_pTextCell     = VclPtr<Edit>::Create(&GetDataWindow(), 0);
+    m_pVisibleCell  = VclPtr<CheckBoxControl>::Create(&GetDataWindow());
+    m_pTableCell    = VclPtr<ListBoxControl>::Create(&GetDataWindow());     m_pTableCell->SetDropDownLineCount( 20 );
+    m_pFieldCell    = VclPtr<ComboBoxControl>::Create(&GetDataWindow());    m_pFieldCell->SetDropDownLineCount( 20 );
+    m_pOrderCell    = VclPtr<ListBoxControl>::Create(&GetDataWindow());
+    m_pFunctionCell = VclPtr<ListBoxControl>::Create(&GetDataWindow());     m_pFunctionCell->SetDropDownLineCount( 20 );
 
     m_pVisibleCell->SetHelpId(HID_QRYDGN_ROW_VISIBLE);
     m_pTableCell->SetHelpId(HID_QRYDGN_ROW_TABLE);
@@ -283,7 +283,7 @@ namespace
 
 VclPtr<BrowserHeader> OSelectionBrowseBox::imp_CreateHeaderBar(BrowseBox* /*pParent*/)
 {
-    return new OSelectionBrwBoxHeader(this);
+    return VclPtr<OSelectionBrwBoxHeader>::Create(this);
 }
 
 void OSelectionBrowseBox::ColumnMoved( sal_uInt16 nColId, bool _bCreateUndo )
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index 7e60b20d..ee5d721 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -69,8 +69,8 @@ namespace DatabaseObject = css::sdb::application::DatabaseObject;
 OTableWindow::OTableWindow( vcl::Window* pParent, const TTableWindowData::value_type& pTabWinData )
           : ::comphelper::OContainerListener(m_aMutex)
           ,Window( pParent, WB_3DLOOK|WB_MOVEABLE )
-          ,m_aTypeImage( new FixedImage(this) )
-          ,m_aTitle( new OTableWindowTitle(this) )
+          ,m_aTypeImage( VclPtr<FixedImage>::Create(this) )
+          ,m_aTitle( VclPtr<OTableWindowTitle>::Create(this) )
           ,m_pListBox(NULL)
           ,m_pAccessible(NULL)
           ,m_pData( pTabWinData )
@@ -161,9 +161,9 @@ void OTableWindow::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
     SetSizePixel( rNewSize );
 }
 
-OTableWindowListBox* OTableWindow::CreateListBox()
+VclPtr<OTableWindowListBox> OTableWindow::CreateListBox()
 {
-    return new OTableWindowListBox(this);
+    return VclPtr<OTableWindowListBox>::Create(this);
 }
 
 bool OTableWindow::FillListBox()
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
index e9c63e0..54a682e 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
@@ -200,7 +200,7 @@ uno::Reference< awt::XWindow > SAL_CALL LimitBoxController::createItemWindow(
     if ( pParent )
     {
         SolarMutexGuard aSolarMutexGuard;
-        m_pLimitBox = new LimitBoxImpl(pParent, this);
+        m_pLimitBox = VclPtr<LimitBoxImpl>::Create(pParent, this);
         m_pLimitBox->SetSizePixel(m_pLimitBox->CalcBlockSize(6,1));
         xItemWindow = VCLUnoHelper::GetInterface( m_pLimitBox );
     }
diff --git a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
index 28f1c2d..2fcfe15 100644
--- a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
+++ b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
@@ -49,7 +49,7 @@ namespace dbaui
     {
         m_pViewSwitch = new OQueryViewSwitch( this, _rController, _rxContext );
 
-        m_pSplitter = new Splitter(this,WB_VSCROLL);
+        m_pSplitter = VclPtr<Splitter>::Create(this,WB_VSCROLL);
         m_pSplitter->Hide();
         m_pSplitter->SetSplitHdl( LINK( this, OQueryContainerWindow, SplitHdl ) );
         m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) );
@@ -174,7 +174,7 @@ namespace dbaui
     {
         if(!m_pBeamer)
         {
-            m_pBeamer = new OBeamer(this);
+            m_pBeamer = VclPtr<OBeamer>::Create(this);
 
             ::dbaui::notifySystemWindow(this,m_pBeamer,::comphelper::mem_fun(&TaskPaneList::AddWindow));
 
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 0360492..ae27497 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -763,9 +763,9 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
                 if ( pNode )
                 {
                     vcl::Window* pView = getView();
-                    ModalDialog* pWindow = new ModalDialog( pView, WB_STDMODAL | WB_SIZEMOVE | WB_CENTER );
+                    ScopedVclPtrInstance<ModalDialog> pWindow( pView, WB_STDMODAL | WB_SIZEMOVE | WB_CENTER );
                     pWindow->SetSizePixel( ::Size( pView->GetSizePixel().Width() / 2, pView->GetSizePixel().Height() / 2 ) );
-                    SvTreeListBox* pTreeBox = new SvTreeListBox( pWindow, WB_BORDER | WB_HASLINES | WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HASLINESATROOT | WB_VSCROLL );
+                    ScopedVclPtrInstance<SvTreeListBox> pTreeBox( pWindow, WB_BORDER | WB_HASLINES | WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HASLINESATROOT | WB_VSCROLL );
                     pTreeBox->SetPosSizePixel( ::Point( 6, 6 ), ::Size( pWindow->GetSizePixel().Width() - 12, pWindow->GetSizePixel().Height() - 12 ));
                     pTreeBox->SetNodeDefaultImages();
 
@@ -799,8 +799,6 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
                     pTreeBox->Show();
                     pWindow->Execute();
 
-                    delete pTreeBox;
-                    delete pWindow;
                     delete pNode;
                 }
                 break;
@@ -1117,7 +1115,7 @@ bool OQueryController::Construct(vcl::Window* pParent)
 {
     // TODO: we have to check if we should create the text view or the design view
 
-    setView( * new OQueryContainerWindow( pParent, *this, getORB() ) );
+    setView( VclPtr<OQueryContainerWindow>::Create( pParent, *this, getORB() ) );
 
     return OJoinController::Construct(pParent);
 }
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index c1aa00d..8bfa419 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -245,7 +245,7 @@ OUString ORelationController::getPrivateTitle( ) const
 
 bool ORelationController::Construct(vcl::Window* pParent)
 {
-    setView( * new ORelationDesignView( pParent, *this, getORB() ) );
+    setView( VclPtr<ORelationDesignView>::Create( pParent, *this, getORB() ) );
     OJoinController::Construct(pParent);
     return true;
 }
diff --git a/dbaccess/source/ui/relationdesign/RelationDesignView.cxx b/dbaccess/source/ui/relationdesign/RelationDesignView.cxx
index 86b52a3..72e75de 100644
--- a/dbaccess/source/ui/relationdesign/RelationDesignView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationDesignView.cxx
@@ -52,7 +52,7 @@ ORelationDesignView::ORelationDesignView(vcl::Window* _pParent, ORelationControl
 
 void ORelationDesignView::Construct()
 {
-    m_pTableView    = new ORelationTableView(m_pScrollWindow,this);
+    m_pTableView    = VclPtr<ORelationTableView>::Create(m_pScrollWindow,this);
     OJoinDesignView::Construct();
 }
 
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index a74fbcf..06f5839 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -151,7 +151,7 @@ void ORelationTableView::ReSync()
             }
         }
 
-        addConnection( new ORelationTableConnection(this, *aConIter), false ); // don't add the data again
+        addConnection( VclPtr<ORelationTableConnection>::Create(this, *aConIter), false );
     }
 
     if ( !GetTabWinMap().empty() )
@@ -207,7 +207,7 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
             if( pTabConnData->Update() )
             {
                 // enter UI-object into ConnList
-                addConnection( new ORelationTableConnection( this, pTabConnData ) );
+                addConnection( VclPtr<ORelationTableConnection>::Create( this, pTabConnData ) );
             }
         }
         catch(const SQLException&)
@@ -258,7 +258,7 @@ void ORelationTableView::AddNewRelation()
     {
         // already updated by the dialog
         // announce it to the document
-        addConnection( new ORelationTableConnection(this, pNewConnData) );
+        addConnection( VclPtr<ORelationTableConnection>::Create(this, pNewConnData) );
     }
 }
 
@@ -368,15 +368,15 @@ void ORelationTableView::lookForUiActivities()
         if (aRelDlg->Execute() == RET_OK)
         {
             // already updated by the dialog
-            addConnection( new ORelationTableConnection( this, m_pCurrentlyTabConnData ) );
+            addConnection( VclPtr<ORelationTableConnection>::Create( this, m_pCurrentlyTabConnData ) );
         }
         m_pCurrentlyTabConnData.reset();
     }
 }
 
-OTableWindow* ORelationTableView::createWindow(const TTableWindowData::value_type& _pData)
+VclPtr<OTableWindow> ORelationTableView::createWindow(const TTableWindowData::value_type& _pData)
 {
-    return new ORelationTableWindow(this,_pData);
+    return VclPtr<ORelationTableWindow>::Create(this,_pData);
 }
 
 bool ORelationTableView::allowQueries() const
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
index 4d7e83d..f6af18e 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx
@@ -31,7 +31,7 @@ using namespace dbaui;
 OFieldDescGenWin::OFieldDescGenWin( vcl::Window* pParent, OTableDesignHelpBar* pHelp ) :
      TabPage( pParent, WB_3DLOOK | WB_DIALOGCONTROL )
 {
-    m_pFieldControl = new OTableFieldControl(this,pHelp);
+    m_pFieldControl = VclPtr<OTableFieldControl>::Create(this,pHelp);
     m_pFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL);
     m_pFieldControl->Show();
 }
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 00773e4..525cdb8 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -210,19 +210,19 @@ void OTableEditorCtrl::InitCellController()
         OSL_FAIL("getMaxColumnNameLength");
     }
 
-    pNameCell = new OSQLNameEdit(&GetDataWindow(), WB_LEFT, sExtraNameChars);
+    pNameCell = VclPtr<OSQLNameEdit>::Create(&GetDataWindow(), WB_LEFT, sExtraNameChars);
     pNameCell->SetMaxTextLen( nMaxTextLen );
     pNameCell->setCheck( isSQL92CheckEnabled(xCon) );
 
     // Cell type
-    pTypeCell = new ListBoxControl( &GetDataWindow() );
+    pTypeCell = VclPtr<ListBoxControl>::Create( &GetDataWindow() );
     pTypeCell->SetDropDownLineCount( 15 );
 
     // Cell description
-    pDescrCell = new Edit( &GetDataWindow(), WB_LEFT );
+    pDescrCell = VclPtr<Edit>::Create( &GetDataWindow(), WB_LEFT );
     pDescrCell->SetMaxTextLen( MAX_DESCR_LEN );
 
-    pHelpTextCell = new Edit( &GetDataWindow(), WB_LEFT );
+    pHelpTextCell = VclPtr<Edit>::Create( &GetDataWindow(), WB_LEFT );
     pHelpTextCell->SetMaxTextLen( MAX_DESCR_LEN );
 
     pNameCell->SetHelpId(HID_TABDESIGN_NAMECELL);
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 59e0e8a..a3f9ee9 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -540,7 +540,7 @@ void OTableController::impl_initialize()
 
 bool OTableController::Construct(vcl::Window* pParent)
 {
-    setView( * new OTableDesignView( pParent, getORB(), *this ) );
+    setView( VclPtr<OTableDesignView>::Create( pParent, getORB(), *this ) );
     OTableController_BASE::Construct(pParent);
     return true;
 }
diff --git a/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx b/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx
index 7916d6d..8c84a1b 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx
@@ -29,7 +29,7 @@ using namespace dbaui;
 OTableDesignHelpBar::OTableDesignHelpBar( vcl::Window* pParent ) :
      TabPage( pParent, WB_3DLOOK )
 {
-    m_pTextWin = new MultiLineEdit( this, WB_VSCROLL | WB_LEFT | WB_BORDER | WB_NOTABSTOP | WB_READONLY);
+    m_pTextWin = VclPtr<MultiLineEdit>::Create( this, WB_VSCROLL | WB_LEFT | WB_BORDER | WB_NOTABSTOP | WB_READONLY);
     m_pTextWin->SetHelpId(HID_TABLE_DESIGN_HELP_WINDOW);
     m_pTextWin->SetReadOnly();
     m_pTextWin->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
diff --git a/dbaccess/source/ui/tabledesign/TableDesignView.cxx b/dbaccess/source/ui/tabledesign/TableDesignView.cxx
index fd64b0f..3f8aafb 100644
--- a/dbaccess/source/ui/tabledesign/TableDesignView.cxx
+++ b/dbaccess/source/ui/tabledesign/TableDesignView.cxx
@@ -42,13 +42,13 @@ using namespace ::com::sun::star::beans;
 
 // class OTableBorderWindow
 OTableBorderWindow::OTableBorderWindow(vcl::Window* pParent) : Window(pParent,WB_BORDER)
-    ,m_aHorzSplitter( new Splitter(this) )
+    ,m_aHorzSplitter( VclPtr<Splitter>::Create(this) )
 {
 
     ImplInitSettings( true, true, true );
     // Children erzeugen
-    m_pEditorCtrl   = new OTableEditorCtrl( this);
-    m_pFieldDescWin = new OTableFieldDescWin( this );
+    m_pEditorCtrl   = VclPtr<OTableEditorCtrl>::Create( this);
+    m_pFieldDescWin = VclPtr<OTableFieldDescWin>::Create( this );
 
     m_pFieldDescWin->SetHelpId(HID_TAB_DESIGN_DESCWIN);
 
@@ -183,7 +183,7 @@ OTableDesignView::OTableDesignView( vcl::Window* pParent,
     {
     }
 
-    m_pWin = new OTableBorderWindow(this);
+    m_pWin = VclPtr<OTableBorderWindow>::Create(this);
     m_pWin->Show();
 }
 
diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
index 58b1d31..616e667 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx
@@ -50,16 +50,16 @@ OTableFieldDescWin::OTableFieldDescWin( vcl::Window* pParent)
     , m_eChildFocus(NONE)
 {
     // Header
-    m_pHeader = new FixedText( this, WB_CENTER | WB_INFO ); //  | WB_3DLOOK
+    m_pHeader = VclPtr<FixedText>::Create( this, WB_CENTER | WB_INFO );
     m_pHeader->SetText( OUString(ModuleRes(STR_TAB_PROPERTIES)) );
     m_pHeader->Show();
 
     // HelpBar
-    m_pHelpBar = new OTableDesignHelpBar( this );
+    m_pHelpBar = VclPtr<OTableDesignHelpBar>::Create( this );
     m_pHelpBar->SetHelpId(HID_TAB_DESIGN_HELP_TEXT_FRAME);
     m_pHelpBar->Show();
 
-    m_pGenPage = new OFieldDescGenWin( this, m_pHelpBar );
+    m_pGenPage = VclPtr<OFieldDescGenWin>::Create( this, m_pHelpBar );
     getGenPage()->SetHelpId( HID_TABLE_DESIGN_TABPAGE_GENERAL );
     getGenPage()->Show();
 }
diff --git a/dbaccess/source/ui/uno/ColumnPeer.cxx b/dbaccess/source/ui/uno/ColumnPeer.cxx
index 723f103..7a32f0b 100644
--- a/dbaccess/source/ui/uno/ColumnPeer.cxx
+++ b/dbaccess/source/ui/uno/ColumnPeer.cxx
@@ -36,7 +36,7 @@ OColumnPeer::OColumnPeer(vcl::Window* _pParent,const Reference<XComponentContext
 {
     osl_atomic_increment( &m_refCount );
     {
-        OColumnControlWindow* pFieldControl = new OColumnControlWindow(_pParent, _rxContext);
+        VclPtrInstance<OColumnControlWindow> pFieldControl(_pParent, _rxContext);
         pFieldControl->SetComponentInterface(this);
         pFieldControl->Show();
     }
diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx
index 6cfda0b..f06fa97 100644
--- a/extensions/source/abpilot/abspilot.cxx
+++ b/extensions/source/abpilot/abspilot.cxx
@@ -408,24 +408,24 @@ namespace abp
     }
 
 
-    OWizardPage* OAddessBookSourcePilot::createPage(WizardState _nState)
+    VclPtr<TabPage> OAddessBookSourcePilot::createPage(WizardState _nState)
     {
         switch (_nState)
         {
             case STATE_SELECT_ABTYPE:
-                return new TypeSelectionPage( this );
+                return VclPtr<TypeSelectionPage>::Create( this );
 
             case STATE_INVOKE_ADMIN_DIALOG:
-                return new AdminDialogInvokationPage( this );
+                return VclPtr<AdminDialogInvokationPage>::Create( this );
 
             case STATE_TABLE_SELECTION:
-                return new TableSelectionPage( this );
+                return VclPtr<TableSelectionPage>::Create( this );
 
             case STATE_MANUAL_FIELD_MAPPING:
-                return new FieldMappingPage( this );
+                return VclPtr<FieldMappingPage>::Create( this );
 
             case STATE_FINAL_CONFIRM:
-                return new FinalPage( this );
+                return VclPtr<FinalPage>::Create( this );
 
             default:
                 OSL_FAIL("OAddessBookSourcePilot::createPage: invalid state!");
diff --git a/extensions/source/abpilot/abspilot.hxx b/extensions/source/abpilot/abspilot.hxx
index 5c67bc1..fdb284e 100644
--- a/extensions/source/abpilot/abspilot.hxx
+++ b/extensions/source/abpilot/abspilot.hxx
@@ -67,7 +67,7 @@ namespace abp
 
     protected:
         // OWizardMachine overridables
-        virtual ::svt::OWizardPage* createPage( WizardState _nState ) SAL_OVERRIDE;
+        virtual VclPtr<TabPage>     createPage( WizardState _nState ) SAL_OVERRIDE;
         virtual void                enterState( WizardState _nState ) SAL_OVERRIDE;
         virtual bool                prepareLeaveCurrentState( CommitPageReason _eReason ) SAL_OVERRIDE;
         virtual bool                onFinish() SAL_OVERRIDE;
diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx
index 8332ed0..adfb50b 100644
--- a/extensions/source/dbpilots/gridwizard.cxx
+++ b/extensions/source/dbpilots/gridwizard.cxx
@@ -227,17 +227,16 @@ namespace dbp
     }
 
 
-    OWizardPage* OGridWizard::createPage(WizardState _nState)
+    VclPtr<TabPage> OGridWizard::createPage(WizardState _nState)
     {
         switch (_nState)
         {
             case GW_STATE_DATASOURCE_SELECTION:
-                return new OTableSelectionPage(this);
+                return VclPtr<OTableSelectionPage>::Create(this);
             case GW_STATE_FIELDSELECTION:
-                return new OGridFieldsSelection(this);
+                return VclPtr<OGridFieldsSelection>::Create(this);
         }
-
-        return NULL;
+        return VclPtr<TabPage>();
     }
 
 
diff --git a/extensions/source/dbpilots/gridwizard.hxx b/extensions/source/dbpilots/gridwizard.hxx
index 42db668..9c66ae9 100644
--- a/extensions/source/dbpilots/gridwizard.hxx
+++ b/extensions/source/dbpilots/gridwizard.hxx
@@ -56,7 +56,7 @@ namespace dbp
 
     protected:
         // OWizardMachine overridables
-        virtual ::svt::OWizardPage* createPage( WizardState _nState ) SAL_OVERRIDE;
+        virtual VclPtr<TabPage>     createPage( WizardState _nState ) SAL_OVERRIDE;
         virtual WizardState         determineNextState( WizardState _nCurrentState ) const SAL_OVERRIDE;
         virtual void                enterState( WizardState _nState ) SAL_OVERRIDE;
         virtual bool                leaveState( WizardState _nState ) SAL_OVERRIDE;
diff --git a/extensions/source/dbpilots/groupboxwiz.cxx b/extensions/source/dbpilots/groupboxwiz.cxx
index 0eb66b7..fbcaa66 100644
--- a/extensions/source/dbpilots/groupboxwiz.cxx
+++ b/extensions/source/dbpilots/groupboxwiz.cxx
@@ -69,24 +69,24 @@ namespace dbp
     }
 
 
-    OWizardPage* OGroupBoxWizard::createPage(::svt::WizardTypes::WizardState _nState)
+    VclPtr<TabPage> OGroupBoxWizard::createPage(::svt::WizardTypes::WizardState _nState)
     {
         switch (_nState)
         {
             case GBW_STATE_OPTIONLIST:
-                return new ORadioSelectionPage(this);

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list