[Libreoffice-commits] core.git: Branch 'feature/vclptr' - basctl/source include/sfx2 include/svtools include/svx sc/source sd/source sfx2/source svx/source svx/workben sw/source

Noel Grandin noel at peralex.com
Fri Apr 17 07:38:55 PDT 2015


 basctl/source/basicide/tbxctl.cxx                                          |    2 
 basctl/source/basicide/tbxctl.hxx                                          |    2 
 include/sfx2/tbxctrl.hxx                                                   |    4 -
 include/svtools/popupwindowcontroller.hxx                                  |    3 -
 include/svx/ParaLineSpacingPopup.hxx                                       |    2 
 include/svx/clipboardctl.hxx                                               |    2 
 include/svx/fontworkgallery.hxx                                            |    2 
 include/svx/grafctrl.hxx                                                   |    2 
 include/svx/layctrl.hxx                                                    |    4 -
 include/svx/lboxctrl.hxx                                                   |    4 -
 include/svx/linectrl.hxx                                                   |    2 
 include/svx/subtoolboxcontrol.hxx                                          |    2 
 include/svx/tbcontrl.hxx                                                   |    6 +-
 include/svx/tbxalign.hxx                                                   |    2 
 include/svx/tbxcustomshapes.hxx                                            |    2 
 sc/source/ui/cctrl/tbinsert.cxx                                            |    2 
 sc/source/ui/inc/tbinsert.hxx                                              |    2 
 sd/source/ui/app/tbxww.cxx                                                 |    2 
 sd/source/ui/controller/slidelayoutcontroller.cxx                          |    2 
 sd/source/ui/controller/slidelayoutcontroller.hxx                          |    2 
 sd/source/ui/inc/tbx_ww.hxx                                                |    2 
 sfx2/source/toolbox/tbxitem.cxx                                            |    4 -
 svx/source/customshapes/tbxcustomshapes.cxx                                |    2 
 svx/source/form/tbxform.cxx                                                |    2 
 svx/source/inc/tbxform.hxx                                                 |    2 
 svx/source/mnuctrls/clipboardctl.cxx                                       |    2 
 svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx                      |    2 
 svx/source/svdraw/sdrpaintwindow.cxx                                       |    2 
 svx/source/svdraw/svdfmtf.cxx                                              |    2 
 svx/source/svdraw/svdibrow.cxx                                             |    4 -
 svx/source/svdraw/svdpntv.cxx                                              |    2 
 svx/source/tbxctrls/SvxColorChildWindow.cxx                                |    3 -
 svx/source/tbxctrls/bulletsnumbering.cxx                                   |    8 +--
 svx/source/tbxctrls/colrctrl.cxx                                           |    2 
 svx/source/tbxctrls/extrusioncontrols.cxx                                  |   16 +++---
 svx/source/tbxctrls/extrusioncontrols.hxx                                  |    8 +--
 svx/source/tbxctrls/fillctrl.cxx                                           |    4 -
 svx/source/tbxctrls/fontworkgallery.cxx                                    |   14 ++---
 svx/source/tbxctrls/grafctrl.cxx                                           |    6 +-
 svx/source/tbxctrls/layctrl.cxx                                            |   18 +++----
 svx/source/tbxctrls/lboxctrl.cxx                                           |    8 +--
 svx/source/tbxctrls/linectrl.cxx                                           |   10 ++--
 svx/source/tbxctrls/subtoolboxcontrol.cxx                                  |    2 
 svx/source/tbxctrls/tbcontrl.cxx                                           |   25 +++++-----
 svx/source/tbxctrls/tbunocontroller.cxx                                    |    3 -
 svx/source/tbxctrls/tbunosearchcontrollers.cxx                             |    6 +-
 svx/source/tbxctrls/tbxalign.cxx                                           |    2 
 svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx      |    4 -
 svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx |    2 
 svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx     |    2 
 svx/source/unodraw/UnoGraphicExporter.cxx                                  |    6 +-
 svx/workben/msview/msview.cxx                                              |    2 
 svx/workben/pixelctl.cxx                                                   |    2 
 sw/source/uibase/inc/tblctrl.hxx                                           |    2 
 sw/source/uibase/inc/tbxanchr.hxx                                          |    2 
 sw/source/uibase/inc/workctrl.hxx                                          |    6 +-
 sw/source/uibase/ribbar/tblctrl.cxx                                        |    2 
 sw/source/uibase/ribbar/tbxanchr.cxx                                       |    2 
 sw/source/uibase/ribbar/workctrl.cxx                                       |    6 +-
 59 files changed, 127 insertions(+), 123 deletions(-)

New commits:
commit 5df70781f3001d2f5be0343fc9daf04ab5c56719
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Apr 17 16:33:13 2015 +0200

    svx: convert new to ::Create.
    
    Change-Id: I52f589dabdedb538a4a5d0eadfa42b0d10de9b80

diff --git a/basctl/source/basicide/tbxctl.cxx b/basctl/source/basicide/tbxctl.cxx
index fac2961..328ea08 100644
--- a/basctl/source/basicide/tbxctl.cxx
+++ b/basctl/source/basicide/tbxctl.cxx
@@ -141,7 +141,7 @@ void TbxControls::Select( sal_uInt16 nModifier )
 |* rItemRect are the screen coordinates
 |*
 \************************************************************************/
-SfxPopupWindow* TbxControls::CreatePopupWindow()
+VclPtr<SfxPopupWindow> TbxControls::CreatePopupWindow()
 {
     if ( GetSlotId() == SID_CHOOSE_CONTROLS )
         createAndPositionSubToolBar( aSubToolBarResName );
diff --git a/basctl/source/basicide/tbxctl.hxx b/basctl/source/basicide/tbxctl.hxx
index 7e8a5dc..d9152a0 100644
--- a/basctl/source/basicide/tbxctl.hxx
+++ b/basctl/source/basicide/tbxctl.hxx
@@ -46,7 +46,7 @@ public:
     virtual ~TbxControls() {}
 
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 
     using                       SfxToolBoxControl::Select;
     void                        Select( sal_uInt16 nModifier ) SAL_OVERRIDE;
diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
index c7dab43..6adf811 100644
--- a/include/sfx2/tbxctrl.hxx
+++ b/include/sfx2/tbxctrl.hxx
@@ -201,7 +201,7 @@ protected:
     virtual void               DoubleClick();
     virtual void               Click();
     virtual SfxPopupWindowType GetPopupWindowType() const;
-    virtual SfxPopupWindow*    CreatePopupWindow();
+    virtual VclPtr<SfxPopupWindow>    CreatePopupWindow();
     virtual SfxPopupWindow*    CreatePopupWindowCascading();
     virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent );
 
@@ -330,7 +330,7 @@ public:
     virtual ~SfxRecentFilesToolBoxControl();
 
 protected:
-    virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 };
 
 class SfxReloadToolBoxControl_Impl : public SfxToolBoxControl
diff --git a/include/svtools/popupwindowcontroller.hxx b/include/svtools/popupwindowcontroller.hxx
index d505e2f..a455670 100644
--- a/include/svtools/popupwindowcontroller.hxx
+++ b/include/svtools/popupwindowcontroller.hxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/lang/XServiceInfo.hpp>
 
 #include <svtools/toolboxcontroller.hxx>
+#include <vcl/vclptr.hxx>
 
 namespace vcl { class Window; }
 
@@ -40,7 +41,7 @@ public:
                            const OUString& aCommandURL );
     virtual ~PopupWindowController();
 
-    virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) = 0;
+    virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) = 0;
 
     // XInterface
     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
diff --git a/include/svx/ParaLineSpacingPopup.hxx b/include/svx/ParaLineSpacingPopup.hxx
index ba8cebc..1460c74 100644
--- a/include/svx/ParaLineSpacingPopup.hxx
+++ b/include/svx/ParaLineSpacingPopup.hxx
@@ -39,7 +39,7 @@ public:
     virtual ~ParaLineSpacingPopup();
 
     virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 };
 
 } // namespace svx
diff --git a/include/svx/clipboardctl.hxx b/include/svx/clipboardctl.hxx
index 9faedb4..8c4d19c 100644
--- a/include/svx/clipboardctl.hxx
+++ b/include/svx/clipboardctl.hxx
@@ -46,7 +46,7 @@ public:
     virtual ~SvxClipBoardControl();
 
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     virtual void                StateChanged( sal_uInt16 nSID,
                                               SfxItemState eState,
                                               const SfxPoolItem* pState ) SAL_OVERRIDE;
diff --git a/include/svx/fontworkgallery.hxx b/include/svx/fontworkgallery.hxx
index 6f24ccb..a8314ec 100644
--- a/include/svx/fontworkgallery.hxx
+++ b/include/svx/fontworkgallery.hxx
@@ -57,7 +57,7 @@ public:
 
     virtual void                Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE;
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 };
 
 
diff --git a/include/svx/grafctrl.hxx b/include/svx/grafctrl.hxx
index 473133b..ba4124d 100644
--- a/include/svx/grafctrl.hxx
+++ b/include/svx/grafctrl.hxx
@@ -54,7 +54,7 @@ public:
 
     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 };
 
 
diff --git a/include/svx/layctrl.hxx b/include/svx/layctrl.hxx
index 9652aea..05eaf5d 100644
--- a/include/svx/layctrl.hxx
+++ b/include/svx/layctrl.hxx
@@ -31,7 +31,7 @@ private:
 
 public:
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     virtual SfxPopupWindow*     CreatePopupWindowCascading() SAL_OVERRIDE;
     virtual void                StateChanged( sal_uInt16 nSID,
                                               SfxItemState eState,
@@ -50,7 +50,7 @@ class SVX_DLLPUBLIC SvxColumnsToolBoxControl : public SfxToolBoxControl
     bool    bEnabled;
 public:
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     virtual SfxPopupWindow*     CreatePopupWindowCascading() SAL_OVERRIDE;
 
     SFX_DECL_TOOLBOX_CONTROL();
diff --git a/include/svx/lboxctrl.hxx b/include/svx/lboxctrl.hxx
index 3fed044..fe3062d1 100644
--- a/include/svx/lboxctrl.hxx
+++ b/include/svx/lboxctrl.hxx
@@ -46,7 +46,7 @@ public:
     virtual ~SvxListBoxControl();
 
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     virtual void                StateChanged( sal_uInt16 nSID,
                                               SfxItemState eState,
                                               const SfxPoolItem* pState ) SAL_OVERRIDE;
@@ -69,7 +69,7 @@ public:
                                SfxItemState eState,
                                const SfxPoolItem* pState ) SAL_OVERRIDE;
 
-    virtual SfxPopupWindow*  CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 };
 
 #endif
diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx
index b9daf62..620ac3d 100644
--- a/include/svx/linectrl.hxx
+++ b/include/svx/linectrl.hxx
@@ -141,7 +141,7 @@ public:
     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
                                               const SfxPoolItem* pState ) SAL_OVERRIDE;
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 };
 
 
diff --git a/include/svx/subtoolboxcontrol.hxx b/include/svx/subtoolboxcontrol.hxx
index e7f2904..7921a27 100644
--- a/include/svx/subtoolboxcontrol.hxx
+++ b/include/svx/subtoolboxcontrol.hxx
@@ -36,7 +36,7 @@ public:
     virtual ~SvxSubToolBoxControl();
 
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 };
 
 
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 28358d2..42c7945 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -242,7 +242,7 @@ public:
     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
                               const SfxPoolItem* pState) SAL_OVERRIDE;
     virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE;
 };
 
@@ -253,7 +253,7 @@ public:
     SvxFrameToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
 
     virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
                               const SfxPoolItem* pState) SAL_OVERRIDE;
 };
@@ -265,7 +265,7 @@ public:
     SvxFrameLineStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
 
     virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
                               const SfxPoolItem* pState) SAL_OVERRIDE;
 };
diff --git a/include/svx/tbxalign.hxx b/include/svx/tbxalign.hxx
index 00a98d1..71322ee 100644
--- a/include/svx/tbxalign.hxx
+++ b/include/svx/tbxalign.hxx
@@ -32,7 +32,7 @@ public:
     virtual void SAL_CALL updateImage() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 
             SFX_DECL_TOOLBOX_CONTROL();
 
diff --git a/include/svx/tbxcustomshapes.hxx b/include/svx/tbxcustomshapes.hxx
index c4ebc1b..2be1ac8 100644
--- a/include/svx/tbxcustomshapes.hxx
+++ b/include/svx/tbxcustomshapes.hxx
@@ -35,7 +35,7 @@ public:
     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
                                               const SfxPoolItem* pState ) SAL_OVERRIDE;
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 
             SFX_DECL_TOOLBOX_CONTROL();
 
diff --git a/sc/source/ui/cctrl/tbinsert.cxx b/sc/source/ui/cctrl/tbinsert.cxx
index 32b06bbb..8b3469a 100644
--- a/sc/source/ui/cctrl/tbinsert.cxx
+++ b/sc/source/ui/cctrl/tbinsert.cxx
@@ -72,7 +72,7 @@ void ScTbxInsertCtrl::StateChanged( sal_uInt16 /* nSID */, SfxItemState eState,
     }
 }
 
-SfxPopupWindow* ScTbxInsertCtrl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> ScTbxInsertCtrl::CreatePopupWindow()
 {
     sal_uInt16 nSlotId = GetSlotId();
     if (nSlotId == SID_TBXCTL_INSERT)
diff --git a/sc/source/ui/inc/tbinsert.hxx b/sc/source/ui/inc/tbinsert.hxx
index d8880ad..dda7018 100644
--- a/sc/source/ui/inc/tbinsert.hxx
+++ b/sc/source/ui/inc/tbinsert.hxx
@@ -36,7 +36,7 @@ public:
     virtual ~ScTbxInsertCtrl();
 
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     virtual void                StateChanged( sal_uInt16 nSID,
                                               SfxItemState eState,
                                               const SfxPoolItem* pState ) SAL_OVERRIDE;
diff --git a/sd/source/ui/app/tbxww.cxx b/sd/source/ui/app/tbxww.cxx
index cbf4015..2aed6b8 100644
--- a/sd/source/ui/app/tbxww.cxx
+++ b/sd/source/ui/app/tbxww.cxx
@@ -62,7 +62,7 @@ SfxPopupWindowType SdTbxControl::GetPopupWindowType() const
  * rItemRect are screen coordinates
  */
 
-SfxPopupWindow* SdTbxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SdTbxControl::CreatePopupWindow()
 {
     SfxPopupWindow *pWin = NULL;
     OUString aToolBarResStr;
diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx
index 2b6b00e..1a1fac9 100644
--- a/sd/source/ui/controller/slidelayoutcontroller.cxx
+++ b/sd/source/ui/controller/slidelayoutcontroller.cxx
@@ -351,7 +351,7 @@ void SAL_CALL SlideLayoutController::initialize( const css::uno::Sequence< css::
     }
 }
 
-::vcl::Window* SlideLayoutController::createPopupWindow( ::vcl::Window* pParent )
+VclPtr<::vcl::Window> SlideLayoutController::createPopupWindow( ::vcl::Window* pParent )
 {
     return new sd::LayoutToolbarMenu( *this, m_xFrame, pParent, mbInsertPage );
 }
diff --git a/sd/source/ui/controller/slidelayoutcontroller.hxx b/sd/source/ui/controller/slidelayoutcontroller.hxx
index 0104119..d97656c 100644
--- a/sd/source/ui/controller/slidelayoutcontroller.hxx
+++ b/sd/source/ui/controller/slidelayoutcontroller.hxx
@@ -32,7 +32,7 @@ public:
                            const OUString& sCommandURL,
                            bool bInsertPage );
 
-    virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
 
     // XInitialization
     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
diff --git a/sd/source/ui/inc/tbx_ww.hxx b/sd/source/ui/inc/tbx_ww.hxx
index fb19bb3..9754107 100644
--- a/sd/source/ui/inc/tbx_ww.hxx
+++ b/sd/source/ui/inc/tbx_ww.hxx
@@ -35,7 +35,7 @@ public:
             virtual ~SdTbxControl() {}
 
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
                                 const SfxPoolItem* pState ) SAL_OVERRIDE;
 };
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 4fc75e1..956651c 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -977,7 +977,7 @@ SfxPopupWindowType SfxToolBoxControl::GetPopupWindowType() const
 
 
 
-SfxPopupWindow* SfxToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SfxToolBoxControl::CreatePopupWindow()
 {
     return 0;
 }
@@ -1399,7 +1399,7 @@ SfxRecentFilesToolBoxControl::~SfxRecentFilesToolBoxControl()
 {
 }
 
-SfxPopupWindow* SfxRecentFilesToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SfxRecentFilesToolBoxControl::CreatePopupWindow()
 {
     ToolBox& rBox = GetToolBox();
     sal_uInt16 nItemId = GetId();
diff --git a/svx/source/customshapes/tbxcustomshapes.cxx b/svx/source/customshapes/tbxcustomshapes.cxx
index b287aac..f80af1e 100644
--- a/svx/source/customshapes/tbxcustomshapes.cxx
+++ b/svx/source/customshapes/tbxcustomshapes.cxx
@@ -103,7 +103,7 @@ SfxPopupWindowType SvxTbxCtlCustomShapes::GetPopupWindowType() const
 // Here is the window created
 // The location of the Toolbox is queried through GetToolBox()
 // rItemRect are the screen coordinates
-SfxPopupWindow* SvxTbxCtlCustomShapes::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxTbxCtlCustomShapes::CreatePopupWindow()
 {
     createAndPositionSubToolBar( m_aSubTbxResName );
     return NULL;
diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx
index 98e4ea2..64baa4f 100644
--- a/svx/source/form/tbxform.cxx
+++ b/svx/source/form/tbxform.cxx
@@ -197,7 +197,7 @@ SfxPopupWindowType SvxFmTbxCtlConfig::GetPopupWindowType() const
 }
 
 
-SfxPopupWindow* SvxFmTbxCtlConfig::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxFmTbxCtlConfig::CreatePopupWindow()
 {
     if ( GetSlotId() == SID_FM_CONFIG )
     {
diff --git a/svx/source/inc/tbxform.hxx b/svx/source/inc/tbxform.hxx
index a1877d8..cc2ad67 100644
--- a/svx/source/inc/tbxform.hxx
+++ b/svx/source/inc/tbxform.hxx
@@ -58,7 +58,7 @@ public:
     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
                                               const SfxPoolItem* pState ) SAL_OVERRIDE;
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 };
 
 
diff --git a/svx/source/mnuctrls/clipboardctl.cxx b/svx/source/mnuctrls/clipboardctl.cxx
index e0ec272..6d183d8 100644
--- a/svx/source/mnuctrls/clipboardctl.cxx
+++ b/svx/source/mnuctrls/clipboardctl.cxx
@@ -61,7 +61,7 @@ SvxClipBoardControl::~SvxClipBoardControl()
 }
 
 
-SfxPopupWindow* SvxClipBoardControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxClipBoardControl::CreatePopupWindow()
 {
     const SvxClipboardFmtItem* pFmtItem = PTR_CAST( SvxClipboardFmtItem, pClipboardFmtItem );
     if ( pFmtItem )
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
index 5b13291..ffd2639 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
@@ -42,7 +42,7 @@ SfxPopupWindowType ParaLineSpacingPopup::GetPopupWindowType() const
     return SfxPopupWindowType::ONTIMEOUT;
 }
 
-SfxPopupWindow* ParaLineSpacingPopup::CreatePopupWindow()
+VclPtr<SfxPopupWindow> ParaLineSpacingPopup::CreatePopupWindow()
 {
     ParaLineSpacingControl* pControl = new ParaLineSpacingControl(GetSlotId());
 
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index d9cfce3..0440ba1 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -114,7 +114,7 @@ void CandidateMgr::PaintTransparentChildren(vcl::Window & rWindow, Rectangle con
 
 SdrPreRenderDevice::SdrPreRenderDevice(OutputDevice& rOriginal)
 :   mrOutputDevice(rOriginal),
-    mpPreRenderDevice(new VirtualDevice())
+    mpPreRenderDevice(VclPtr<VirtualDevice>::Create())
 {
 }
 
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index f9bdc1f..fb7843f 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -78,7 +78,7 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(
     SdrLayerID nLay,
     const Rectangle& rRect)
 :   maTmpList(),
-    mpVD(new VirtualDevice()),
+    mpVD(VclPtr<VirtualDevice>::Create()),
     maScaleRect(rRect),
     mnMapScalingOfs(0),
     mpLineAttr(0),
diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx
index 51130f0..261d119 100644
--- a/svx/source/svdraw/svdibrow.cxx
+++ b/svx/source/svdraw/svdibrow.cxx
@@ -495,7 +495,7 @@ bool _SdrItemBrowserControl::BegChangeEntry(sal_uIntPtr nPos)
     ImpItemListRow* pEntry=ImpGetEntry(nPos);
     if (pEntry!=NULL && !pEntry->bComment) {
         SetMode(MYBROWSEMODE & ~BROWSER_KEEPHIGHLIGHT);
-        pEditControl=new ImpItemEdit(&GetDataWindow(),this,0);
+        pEditControl=VclPtr<ImpItemEdit>::Create(&GetDataWindow(),this,0);
         Rectangle aRect(GetFieldRectPixel(nPos, ITEMBROWSER_VALUECOL_ID, false));
         aRect.Left()+=2; // little offset for the Edit, so it's exact to the pixel
         aRect.Right()--;
@@ -1046,7 +1046,7 @@ void _SdrItemBrowserControl::SetAttributes(const SfxItemSet* pSet, const SfxItem
 
 _SdrItemBrowserWindow::_SdrItemBrowserWindow(vcl::Window* pParent, WinBits nBits):
     FloatingWindow(pParent,nBits),
-    aBrowse(new _SdrItemBrowserControl(this))
+    aBrowse(VclPtr<_SdrItemBrowserControl>::Create(this))
 {
     SetOutputSizePixel(aBrowse->GetSizePixel());
     SetText(OUString("Joe's ItemBrowser"));
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index f058b4e..911527d 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -1125,7 +1125,7 @@ void SdrPaintView::ShowItemBrowser(bool bShow)
 {
     if (bShow) {
         if (pItemBrowser==nullptr) {
-            pItemBrowser=new SdrItemBrowser(*static_cast<SdrView*>(this));
+            pItemBrowser=VclPtr<SdrItemBrowser>::Create(*static_cast<SdrView*>(this));
         }
         pItemBrowser->Show();
         pItemBrowser->GrabFocus();
diff --git a/svx/source/tbxctrls/SvxColorChildWindow.cxx b/svx/source/tbxctrls/SvxColorChildWindow.cxx
index a541eb2..a4ad23f 100644
--- a/svx/source/tbxctrls/SvxColorChildWindow.cxx
+++ b/svx/source/tbxctrls/SvxColorChildWindow.cxx
@@ -33,8 +33,9 @@ SvxColorChildWindow::SvxColorChildWindow( vcl::Window* _pParent,
                                           SfxChildWinInfo* pInfo ) :
     SfxChildWindow( _pParent, nId )
 {
-    SvxColorDockingWindow* pWin = new SvxColorDockingWindow( pBindings, this,
+    VclPtr<SvxColorDockingWindow> pWin = VclPtr<SvxColorDockingWindow>::Create( pBindings, this,
                                         _pParent );
+
     pWindow = pWin;
 
     eChildAlignment = SfxChildAlignment::BOTTOM;
diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx
index e11ed84..68ab4fe 100644
--- a/svx/source/tbxctrls/bulletsnumbering.cxx
+++ b/svx/source/tbxctrls/bulletsnumbering.cxx
@@ -60,7 +60,7 @@ class NumberingToolBoxControl : public svt::PopupWindowController
 
 public:
     NumberingToolBoxControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
-    virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
     bool IsInImpressDraw();
 
     // XStatusListener
@@ -89,7 +89,7 @@ NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController,
     mrController( rController )
 {
     WinBits nBits = WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NO_DIRECTSELECT;
-    mpValueSet = new SvxNumValueSet( this, nBits );
+    mpValueSet = VclPtr<SvxNumValueSet>::Create( this, nBits );
     mpValueSet->init( mbBulletItem ? NUM_PAGETYPE_BULLET : NUM_PAGETYPE_SINGLENUM );
 
     if ( !mbBulletItem )
@@ -204,9 +204,9 @@ NumberingToolBoxControl::NumberingToolBoxControl( const css::uno::Reference< css
 {
 }
 
-vcl::Window* NumberingToolBoxControl::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> NumberingToolBoxControl::createPopupWindow( vcl::Window* pParent )
 {
-    return new NumberingPopup( *this, m_xFrame, pParent, mbBulletItem );
+    return VclPtr<NumberingPopup>::Create( *this, m_xFrame, pParent, mbBulletItem );
 }
 
 bool NumberingToolBoxControl::IsInImpressDraw()
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx
index 103aa77..c3a3402 100644
--- a/svx/source/tbxctrls/colrctrl.cxx
+++ b/svx/source/tbxctrls/colrctrl.cxx
@@ -186,7 +186,7 @@ SvxColorDockingWindow::SvxColorDockingWindow
 
     SfxDockingWindow( _pBindings, pCW, _pParent, WB_MOVEABLE|WB_CLOSEABLE|WB_SIZEABLE|WB_DOCKABLE ),
     pColorList      (),
-    aColorSet       ( new SvxColorValueSet_docking(this) ),
+    aColorSet       ( VclPtr<SvxColorValueSet_docking>::Create(this) ),
     nLeftSlot       ( SID_ATTR_FILL_COLOR ),
     nRightSlot      ( SID_ATTR_LINE_COLOR ),
     nCols           ( 20 ),
diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx
index 1417254..b9d988a 100644
--- a/svx/source/tbxctrls/extrusioncontrols.cxx
+++ b/svx/source/tbxctrls/extrusioncontrols.cxx
@@ -244,9 +244,9 @@ ExtrusionDirectionControl::ExtrusionDirectionControl(
 
 
 
-vcl::Window* ExtrusionDirectionControl::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> ExtrusionDirectionControl::createPopupWindow( vcl::Window* pParent )
 {
-    return new ExtrusionDirectionWindow( *this, m_xFrame, pParent );
+    return VclPtr<ExtrusionDirectionWindow>::Create( *this, m_xFrame, pParent );
 }
 
 // XInitialization
@@ -490,9 +490,9 @@ ExtrusionDepthController::ExtrusionDepthController(
 
 
 
-vcl::Window* ExtrusionDepthController::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> ExtrusionDepthController::createPopupWindow( vcl::Window* pParent )
 {
-    return new ExtrusionDepthWindow( *this, m_xFrame, pParent );
+    return VclPtr<ExtrusionDepthWindow>::Create( *this, m_xFrame, pParent );
 }
 
 // XInitialization
@@ -757,9 +757,9 @@ ExtrusionLightingControl::ExtrusionLightingControl(
 
 
 
-vcl::Window* ExtrusionLightingControl::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> ExtrusionLightingControl::createPopupWindow( vcl::Window* pParent )
 {
-    return new ExtrusionLightingWindow( *this, m_xFrame, pParent );
+    return VclPtr<ExtrusionLightingWindow>::Create( *this, m_xFrame, pParent );
 }
 
 // XInitialization
@@ -903,9 +903,9 @@ ExtrusionSurfaceControl::ExtrusionSurfaceControl(
 
 
 
-vcl::Window* ExtrusionSurfaceControl::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> ExtrusionSurfaceControl::createPopupWindow( vcl::Window* pParent )
 {
-    return new ExtrusionSurfaceWindow( *this, m_xFrame, pParent );
+    return VclPtr<ExtrusionSurfaceWindow>::Create( *this, m_xFrame, pParent );
 }
 
 // XInitialization
diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx
index 210d64d..d94de53 100644
--- a/svx/source/tbxctrls/extrusioncontrols.hxx
+++ b/svx/source/tbxctrls/extrusioncontrols.hxx
@@ -73,7 +73,7 @@ class ExtrusionDirectionControl : public svt::PopupWindowController
 public:
     ExtrusionDirectionControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
 
-    virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
 
     // XInitialization
     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
@@ -120,7 +120,7 @@ class ExtrusionDepthController : public svt::PopupWindowController
 public:
     ExtrusionDepthController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
 
-    virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
 
     // XInitialization
     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
@@ -177,7 +177,7 @@ class ExtrusionLightingControl : public svt::PopupWindowController
 public:
     ExtrusionLightingControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
 
-    virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
 
     // XInitialization
     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
@@ -221,7 +221,7 @@ class ExtrusionSurfaceControl : public svt::PopupWindowController
 public:
     ExtrusionSurfaceControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
 
-    virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
 
     // XInitialization
     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index 54c9604..4386b78 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -535,8 +535,8 @@ VclPtr<vcl::Window> SvxFillToolBoxControl::CreateItemWindow(vcl::Window *pParent
 
 FillControl::FillControl(vcl::Window* pParent,WinBits nStyle)
 :   Window(pParent,nStyle | WB_DIALOGCONTROL),
-    mpLbFillType(new SvxFillTypeBox(this)),
-    mpLbFillAttr(new SvxFillAttrBox(this)),
+    mpLbFillType(VclPtr<SvxFillTypeBox>::Create(this)),
+    mpLbFillAttr(VclPtr<SvxFillAttrBox>::Create(this)),
     maLogicalFillSize(40,80),
     maLogicalAttrSize(50,80),
     mnLastFillTypeControlSelectEntryPos(mpLbFillType->GetSelectEntryPos()),
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index 2dfc0ad..2cd3fa3 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -283,7 +283,7 @@ SfxPopupWindowType FontWorkShapeTypeControl::GetPopupWindowType() const
 
 
 
-SfxPopupWindow* FontWorkShapeTypeControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> FontWorkShapeTypeControl::CreatePopupWindow()
 {
     OUString aSubTbxResName( "private:resource/toolbar/fontworkshapetype" );
     createAndPositionSubToolBar( aSubTbxResName );
@@ -396,7 +396,7 @@ class FontworkAlignmentControl : public svt::PopupWindowController
 public:
     FontworkAlignmentControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
 
-    virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
 
     // XInitialization
     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
@@ -419,9 +419,9 @@ FontworkAlignmentControl::FontworkAlignmentControl( const Reference< XComponentC
 
 
 
-vcl::Window* FontworkAlignmentControl::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> FontworkAlignmentControl::createPopupWindow( vcl::Window* pParent )
 {
-    return new FontworkAlignmentWindow( *this, m_xFrame, pParent );
+    return VclPtr<FontworkAlignmentWindow>::Create( *this, m_xFrame, pParent );
 }
 
 // XInitialization
@@ -636,7 +636,7 @@ class FontworkCharacterSpacingControl : public svt::PopupWindowController
 public:
     FontworkCharacterSpacingControl( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
 
-    virtual vcl::Window* createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
+    virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
 
     // XInitialization
     virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
@@ -657,9 +657,9 @@ FontworkCharacterSpacingControl::FontworkCharacterSpacingControl( const Referenc
 
 
 
-vcl::Window* FontworkCharacterSpacingControl::createPopupWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> FontworkCharacterSpacingControl::createPopupWindow( vcl::Window* pParent )
 {
-    return new FontworkCharacterSpacingWindow( *this, m_xFrame, pParent );
+    return VclPtr<FontworkCharacterSpacingWindow>::Create( *this, m_xFrame, pParent );
 }
 
 // XInitialization
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index c73aedd..26aebde 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -259,8 +259,8 @@ ImplGrafControl::ImplGrafControl(
     const OUString& rCmd,
     const Reference< XFrame >& rFrame
 )   : Control( pParent, WB_TABSTOP )
-    , maImage( new FixedImage(this) )
-    , maField( new ImplGrafMetricField(this, rCmd, rFrame) )
+    , maImage( VclPtr<FixedImage>::Create(this) )
+    , maField( VclPtr<ImplGrafMetricField>::Create(this, rCmd, rFrame) )
 {
     ResId   aResId( ImplGetRID( rCmd ), DIALOG_MGR() ) ;
     Image   aImage( aResId );
@@ -446,7 +446,7 @@ SfxPopupWindowType SvxGrafFilterToolBoxControl::GetPopupWindowType() const
     return SfxPopupWindowType::ONCLICK;
 }
 
-SfxPopupWindow* SvxGrafFilterToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxGrafFilterToolBoxControl::CreatePopupWindow()
 {
     OUString aSubTbxResName( "private:resource/toolbar/graffilterbar" );
     createAndPositionSubToolBar( aSubTbxResName );
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index 7bb1cd2..a5ec5eb 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -110,7 +110,7 @@ IMPL_LINK_NOARG(TableWindow, SelectHdl)
 TableWindow::TableWindow( sal_uInt16 nSlotId, const OUString& rCmd, const OUString& rText,
                           ToolBox& rParentTbx, const Reference< XFrame >& rFrame )
     : SfxPopupWindow( nSlotId, rFrame, WinBits( WB_STDPOPUP ) )
-    , aTableButton( new PushButton(this) )
+    , aTableButton( VclPtr<PushButton>::Create(this) )
     , nCol( 0 )
     , nLine( 0 )
     , bInitialKeyInput(false)
@@ -168,7 +168,7 @@ void TableWindow::dispose()
 
 VclPtr<SfxPopupWindow> TableWindow::Clone() const
 {
-    return new TableWindow( GetId(), maCommand, GetText(), rTbx, mxFrame );
+    return VclPtr<TableWindow>::Create( GetId(), maCommand, GetText(), rTbx, mxFrame );
 }
 
 
@@ -474,7 +474,7 @@ ColumnsWindow::ColumnsWindow( sal_uInt16 nId, const OUString& rCmd, const OUStri
 
 VclPtr<SfxPopupWindow> ColumnsWindow::Clone() const
 {
-    return new ColumnsWindow( GetId(), maCommand, GetText(), rTbx, mxFrame );
+    return VclPtr<ColumnsWindow>::Create( GetId(), maCommand, GetText(), rTbx, mxFrame );
 }
 
 
@@ -728,12 +728,12 @@ SfxPopupWindowType SvxTableToolBoxControl::GetPopupWindowType() const
 
 
 
-SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxTableToolBoxControl::CreatePopupWindow()
 {
     if ( bEnabled )
     {
         ToolBox& rTbx = GetToolBox();
-        TableWindow* pWin = new TableWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), rTbx, m_xFrame );
+        VclPtr<TableWindow> pWin = VclPtr<TableWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), rTbx, m_xFrame );
         pWin->StartPopupMode( &rTbx, FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE );
         SetPopupWindow( pWin );
         return pWin;
@@ -746,7 +746,7 @@ SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindow()
 SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindowCascading()
 {
     if ( bEnabled )
-        return new TableWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
+        return VclPtr<TableWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
     return 0;
 }
 
@@ -793,12 +793,12 @@ SfxPopupWindowType SvxColumnsToolBoxControl::GetPopupWindowType() const
 
 
 
-SfxPopupWindow* SvxColumnsToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxColumnsToolBoxControl::CreatePopupWindow()
 {
     ColumnsWindow* pWin = 0;
     if(bEnabled)
     {
-            pWin = new ColumnsWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
+            pWin = VclPtr<ColumnsWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
             pWin->StartPopupMode( &GetToolBox(),
                                   FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE );
             SetPopupWindow( pWin );
@@ -813,7 +813,7 @@ SfxPopupWindow* SvxColumnsToolBoxControl::CreatePopupWindowCascading()
     ColumnsWindow* pWin = 0;
     if(bEnabled)
     {
-        pWin = new ColumnsWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
+        pWin = VclPtr<ColumnsWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
     }
     return pWin;
 }
diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx
index 1269b46..a517946 100644
--- a/svx/source/tbxctrls/lboxctrl.cxx
+++ b/svx/source/tbxctrls/lboxctrl.cxx
@@ -111,7 +111,7 @@ void SvxPopupWindowListBox::dispose()
 
 VclPtr<SfxPopupWindow> SvxPopupWindowListBox::Clone() const
 {
-    return new SvxPopupWindowListBox( GetId(), maCommandURL, nTbxId, rToolBox );
+    return VclPtr<SvxPopupWindowListBox>::Create( GetId(), maCommandURL, nTbxId, rToolBox );
 }
 
 void SvxPopupWindowListBox::PopupModeEnd()
@@ -155,7 +155,7 @@ SvxListBoxControl::SvxListBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBo
 SvxListBoxControl::~SvxListBoxControl()
 {}
 
-SfxPopupWindow* SvxListBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxListBoxControl::CreatePopupWindow()
 {
     OSL_FAIL( "not implemented" );
     return 0;
@@ -281,7 +281,7 @@ void SvxUndoRedoControl::StateChanged(
     }
 }
 
-SfxPopupWindow* SvxUndoRedoControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxUndoRedoControl::CreatePopupWindow()
 {
     DBG_ASSERT(( SID_UNDO == GetSlotId() || SID_REDO == GetSlotId() ), "mismatching ids" );
 
@@ -292,7 +292,7 @@ SfxPopupWindow* SvxUndoRedoControl::CreatePopupWindow()
 
     ToolBox& rBox = GetToolBox();
 
-    pPopupWin = new SvxPopupWindowListBox( GetSlotId(), m_aCommandURL, GetId(), rBox );
+    pPopupWin = VclPtr<SvxPopupWindowListBox>::Create( GetSlotId(), m_aCommandURL, GetId(), rBox );
     pPopupWin->SetPopupModeEndHdl( LINK( this, SvxUndoRedoControl,
                                             PopupModeEndHdl ) );
     ListBox &rListBox = pPopupWin->GetListBox();
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index c7e4e17..82be0ad 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -256,7 +256,7 @@ SvxLineEndWindow::SvxLineEndWindow(
     SfxPopupWindow( nSlotId,
                     rFrame,
                     WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
-    aLineEndSet     ( new ValueSet(this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT )) ),
+    aLineEndSet     ( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT )) ),
     nCols           ( 2 ),
     nLines          ( 12 ),
     nLineEndWidth   ( 400 ),
@@ -277,7 +277,7 @@ SvxLineEndWindow::SvxLineEndWindow(
                     rFrame,
                     pParentWindow,
                     WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
-    aLineEndSet     ( new ValueSet(this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) )),
+    aLineEndSet     ( VclPtr<ValueSet>::Create(this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) )),
     nCols           ( 2 ),
     nLines          ( 12 ),
     nLineEndWidth   ( 400 ),
@@ -322,7 +322,7 @@ void SvxLineEndWindow::implInit()
 
 VclPtr<SfxPopupWindow> SvxLineEndWindow::Clone() const
 {
-    return new SvxLineEndWindow( GetId(), mxFrame, GetText() );
+    return VclPtr<SvxLineEndWindow>::Create( GetId(), mxFrame, GetText() );
 }
 
 
@@ -629,10 +629,10 @@ SfxPopupWindowType SvxLineEndToolBoxControl::GetPopupWindowType() const
 
 
 
-SfxPopupWindow* SvxLineEndToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxLineEndToolBoxControl::CreatePopupWindow()
 {
     SvxLineEndWindow* pLineEndWin =
-        new SvxLineEndWindow( GetId(), m_xFrame, &GetToolBox(), SVX_RESSTR( RID_SVXSTR_LINEEND ) );
+        VclPtr<SvxLineEndWindow>::Create( GetId(), m_xFrame, &GetToolBox(), SVX_RESSTR( RID_SVXSTR_LINEEND ) );
     pLineEndWin->StartPopupMode( &GetToolBox(),
                                  FLOATWIN_POPUPMODE_GRABFOCUS |
                                  FLOATWIN_POPUPMODE_ALLOWTEAROFF |
diff --git a/svx/source/tbxctrls/subtoolboxcontrol.cxx b/svx/source/tbxctrls/subtoolboxcontrol.cxx
index c04c79b..606deba 100644
--- a/svx/source/tbxctrls/subtoolboxcontrol.cxx
+++ b/svx/source/tbxctrls/subtoolboxcontrol.cxx
@@ -37,7 +37,7 @@ SvxSubToolBoxControl::~SvxSubToolBoxControl()
 {
 }
 
-SfxPopupWindow* SvxSubToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxSubToolBoxControl::CreatePopupWindow()
 {
     const sal_Char* pResource = 0;
     switch( GetSlotId() )
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 770eaef..0e94807 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -721,7 +721,7 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
                     {
                         if(m_pButtons[nId] == nullptr)
                         {
-                            m_pButtons[nId] = new MenuButton(static_cast<vcl::Window*>(pDevice), WB_FLATBUTTON | WB_NOPOINTERFOCUS);
+                            m_pButtons[nId] = VclPtr<MenuButton>::Create(static_cast<vcl::Window*>(pDevice), WB_FLATBUTTON | WB_NOPOINTERFOCUS);
                             m_pButtons[nId]->SetSizePixel(Size(20, aRect.GetSize().Height()));
                             m_pButtons[nId]->SetPopupMenu(&m_aMenu);
                         }
@@ -1264,7 +1264,7 @@ void SvxColorWindow_Impl::KeyInput( const KeyEvent& rKEvt )
 
 VclPtr<SfxPopupWindow> SvxColorWindow_Impl::Clone() const
 {
-    return new SvxColorWindow_Impl( maCommand, mrPaletteManager, mrBorderColorStatus, theSlotId, GetFrame(), GetText(), GetParent() );
+    return VclPtr<SvxColorWindow_Impl>::Create( maCommand, mrPaletteManager, mrBorderColorStatus, theSlotId, GetFrame(), GetText(), GetParent() );
 }
 
 IMPL_LINK(SvxColorWindow_Impl, SelectHdl, SvxColorValueSet*, pColorSet)
@@ -1474,7 +1474,7 @@ Color BorderColorStatus::GetColor()
 
 SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow ) :
     SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
-    aFrameSet   ( new SvxFrmValueSet_Impl(this, WinBits( WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT )) ),
+    aFrameSet   ( VclPtr<SvxFrmValueSet_Impl>::Create(this, WinBits( WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT )) ),
     bParagraphMode(false)
 {
     BindListener();
@@ -1537,7 +1537,7 @@ void SvxFrameWindow_Impl::dispose()
 VclPtr<SfxPopupWindow> SvxFrameWindow_Impl::Clone() const
 {
     //! HACK: How do I get the Paragraph mode?
-    return new SvxFrameWindow_Impl( GetId(), GetFrame(), GetParent() );
+    return VclPtr<SvxFrameWindow_Impl>::Create( GetId(), GetFrame(), GetParent() );
 }
 
 vcl::Window* SvxFrameWindow_Impl::GetPreferredKeyInputWindow()
@@ -1752,7 +1752,7 @@ static Color lcl_mediumColor( Color aMain, Color /*aDefault*/ )
 SvxLineWindow_Impl::SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow ) :
 
     SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION | WB_AUTOSIZE ) ),
-    m_aLineStyleLb( new LineListBox(this) )
+    m_aLineStyleLb( VclPtr<LineListBox>::Create(this) )
 {
     try
     {
@@ -1807,7 +1807,7 @@ SvxLineWindow_Impl::SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame
 
 VclPtr<SfxPopupWindow> SvxLineWindow_Impl::Clone() const
 {
-    return new SvxLineWindow_Impl( GetId(), GetFrame(), GetParent() );
+    return VclPtr<SvxLineWindow_Impl>::Create( GetId(), GetFrame(), GetParent() );
 }
 
 IMPL_LINK_NOARG(SvxLineWindow_Impl, SelectHdl)
@@ -2528,10 +2528,11 @@ SfxPopupWindowType SvxColorToolBoxControl::GetPopupWindowType() const
     return SfxPopupWindowType::ONTIMEOUT;
 }
 
-SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow()
 {
     SvxColorWindow_Impl* pColorWin =
-        new SvxColorWindow_Impl(
+        VclPtr<SvxColorWindow_Impl>::Create(
+
                             m_aCommandURL,
                             mPaletteManager,
                             maBorderColorStatus,
@@ -2706,9 +2707,9 @@ SfxPopupWindowType SvxFrameToolBoxControl::GetPopupWindowType() const
     return SfxPopupWindowType::ONCLICK;
 }
 
-SfxPopupWindow* SvxFrameToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxFrameToolBoxControl::CreatePopupWindow()
 {
-    SvxFrameWindow_Impl* pFrameWin = new SvxFrameWindow_Impl(
+    VclPtr<SvxFrameWindow_Impl> pFrameWin = VclPtr<SvxFrameWindow_Impl>::Create(
                                         GetSlotId(), m_xFrame, &GetToolBox() );
 
     pFrameWin->StartPopupMode( &GetToolBox(),
@@ -2748,9 +2749,9 @@ SfxPopupWindowType SvxFrameLineStyleToolBoxControl::GetPopupWindowType() const
     return SfxPopupWindowType::ONCLICK;
 }
 
-SfxPopupWindow* SvxFrameLineStyleToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxFrameLineStyleToolBoxControl::CreatePopupWindow()
 {
-    SvxLineWindow_Impl* pLineWin = new SvxLineWindow_Impl( GetSlotId(), m_xFrame, &GetToolBox() );
+    VclPtr<SvxLineWindow_Impl> pLineWin = VclPtr<SvxLineWindow_Impl>::Create( GetSlotId(), m_xFrame, &GetToolBox() );
     pLineWin->StartPopupMode( &GetToolBox(),
                               FLOATWIN_POPUPMODE_GRABFOCUS |
                               FLOATWIN_POPUPMODE_ALLOWTEAROFF |
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
index 27611b0..21b2e98 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -409,7 +409,8 @@ uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createItemWind
     if ( pParent )
     {
         SolarMutexGuard aSolarMutexGuard;
-        m_pBox = new SvxFontSizeBox_Impl(
+        m_pBox = VclPtr<SvxFontSizeBox_Impl>::Create(
+
                         pParent,
                         uno::Reference< frame::XDispatchProvider >( m_xFrame, uno::UNO_QUERY ),
                         m_xFrame,
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index d10d5b5..a5f8b17 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -457,7 +457,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::cre
     if ( pParent )
     {
         ToolBox* pToolbar = static_cast<ToolBox*>(pParent);
-        m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xContext  );
+        m_pFindTextFieldControl = VclPtr<FindTextFieldControl>::Create( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xContext  );
 
         Size aSize(250, m_pFindTextFieldControl->GetTextHeight() + 200);
         m_pFindTextFieldControl->SetSizePixel( aSize );
@@ -680,7 +680,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL MatchCaseToolboxController::cr
     if ( pParent )
     {
         ToolBox* pToolbar = static_cast<ToolBox*>(pParent);
-        m_pMatchCaseControl = new CheckBox( pToolbar, 0 );
+        m_pMatchCaseControl = VclPtr<CheckBox>::Create( pToolbar, 0 );
         m_pMatchCaseControl->SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_MATCHCASE ) );
         Size aSize( m_pMatchCaseControl->GetOptimalSize() );
         m_pMatchCaseControl->SetSizePixel( aSize );
@@ -948,7 +948,7 @@ void SAL_CALL SearchLabelToolboxController::statusChanged( const css::frame::Fea
 
 css::uno::Reference< css::awt::XWindow > SAL_CALL SearchLabelToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException, std::exception )
 {
-    vcl::Window *pSL= new FixedText(VCLUnoHelper::GetWindow( Parent ));
+    VclPtr<vcl::Window> pSL = VclPtr<FixedText>::Create(VCLUnoHelper::GetWindow( Parent ));
     pSL->SetSizePixel(Size(250, 25));
     return VCLUnoHelper::GetInterface(pSL);
 }
diff --git a/svx/source/tbxctrls/tbxalign.cxx b/svx/source/tbxctrls/tbxalign.cxx
index 41571ee..a4fdb26 100644
--- a/svx/source/tbxctrls/tbxalign.cxx
+++ b/svx/source/tbxctrls/tbxalign.cxx
@@ -61,7 +61,7 @@ SfxPopupWindowType SvxTbxCtlAlign::GetPopupWindowType() const
  * rItemRect sind die Screen-Koordinaten
  */
 
-SfxPopupWindow* SvxTbxCtlAlign::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SvxTbxCtlAlign::CreatePopupWindow()
 {
     SolarMutexGuard aGuard;
     if ( GetSlotId() == SID_OBJECT_ALIGN )
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
index 0d0fe95..dbe3620 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
@@ -462,10 +462,10 @@ ChineseDictionaryDialog::ChineseDictionaryDialog( vcl::Window* pParent )
 
     get(mpToSimplifiedContainer, "tradtosimpleview");
     mpToSimplifiedContainer->set_height_request(mpToSimplifiedContainer->GetTextHeight() * 8);
-    m_pCT_DictionaryToSimplified = new DictionaryList(*mpToSimplifiedContainer, 0);
+    m_pCT_DictionaryToSimplified = VclPtr<DictionaryList>::Create(*mpToSimplifiedContainer, 0);
     get(mpToTraditionalContainer, "simpletotradview");
     mpToTraditionalContainer->set_height_request(mpToTraditionalContainer->GetTextHeight() * 8);
-    m_pCT_DictionaryToTraditional = new DictionaryList(*mpToTraditionalContainer, 0);
+    m_pCT_DictionaryToTraditional = VclPtr<DictionaryList>::Create(*mpToTraditionalContainer, 0);
 
     SvtLinguConfig  aLngCfg;
     bool bValue;
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
index 5a2f76e..58f8a1f 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
@@ -136,7 +136,7 @@ sal_Int16 SAL_CALL ChineseTranslation_UnoDialog::execute() throw(uno::RuntimeExc
                     pParent = pImplementation->GetWindow();
             }
             uno::Reference< XComponent > xComp( this );
-            m_pDialog = new ChineseTranslationDialog( pParent );
+            m_pDialog = VclPtr<ChineseTranslationDialog>::Create( pParent );
         }
         if( !m_pDialog )
             return nRet;
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
index 1c301c5..faa6375 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
@@ -107,7 +107,7 @@ IMPL_LINK_NOARG(ChineseTranslationDialog, DictionaryHdl)
 {
     if( !m_pDictionaryDialog )
     {
-        m_pDictionaryDialog = new ChineseDictionaryDialog(this);
+        m_pDictionaryDialog = VclPtr<ChineseDictionaryDialog>::Create(this);
     }
     if( m_pDictionaryDialog )
     {
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index b61c625..afe0c72 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -160,7 +160,7 @@ namespace {
         virtual sal_Bool SAL_CALL supportsMimeType( const OUString& MimeTypeName ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
         virtual Sequence< OUString > SAL_CALL getSupportedMimeTypeNames(  ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
 
-        VirtualDevice* CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWidthPixel, sal_uIntPtr nHeightPixel ) const;
+        VclPtr<VirtualDevice> CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWidthPixel, sal_uIntPtr nHeightPixel ) const;
 
         DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
 
@@ -395,9 +395,9 @@ IMPL_LINK(GraphicExporter, CalcFieldValueHdl, EditFieldInfo*, pInfo)
 
     @return the returned VirtualDevice is owned by the caller
 */
-VirtualDevice* GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWidthPixel, sal_uIntPtr nHeightPixel ) const
+VclPtr<VirtualDevice> GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWidthPixel, sal_uIntPtr nHeightPixel ) const
 {
-    VirtualDevice*  pVDev = new VirtualDevice();
+    VclPtr<VirtualDevice>  pVDev = VclPtr<VirtualDevice>::Create();
     MapMode         aMM( MAP_100TH_MM );
 
     Point aPoint( 0, 0 );
diff --git a/svx/workben/msview/msview.cxx b/svx/workben/msview/msview.cxx
index 9a05f38..bc68c0d 100644
--- a/svx/workben/msview/msview.cxx
+++ b/svx/workben/msview/msview.cxx
@@ -902,7 +902,7 @@ MSViewerWorkWindow::MSViewerWorkWindow() :
         mpListBox[nPane]->SetExpandingHdl( LINK( this, MSViewerWorkWindow, implExpandingHdl ) );
         mpListBox[nPane]->SetCollapsingHdl( LINK( this, MSViewerWorkWindow, implCollapsingHdl ) );
 
-        mpEdit[nPane] = new MultiLineEdit(this, WB_3DLOOK | WB_BORDER | WB_LEFT | WB_TOP | WB_READONLY | WB_HSCROLL | WB_VSCROLL );
+        mpEdit[nPane] = VclPtr<MultiLineEdit>::Create(this, WB_3DLOOK | WB_BORDER | WB_LEFT | WB_TOP | WB_READONLY | WB_HSCROLL | WB_VSCROLL );
         mpEdit[nPane]->SetReadOnly( TRUE );
         mpEdit[nPane]->SetReadOnly( TRUE );
         mpEdit[nPane]->SetControlFont( aFont );
diff --git a/svx/workben/pixelctl.cxx b/svx/workben/pixelctl.cxx
index 2ff8ca8..591e001 100644
--- a/svx/workben/pixelctl.cxx
+++ b/svx/workben/pixelctl.cxx
@@ -107,7 +107,7 @@ void Main()
 
 MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) :
     WorkWindow( pParent, nWinStyle ),
-    maPixelCtl( new SvxPixelCtl(this) )
+    maPixelCtl( VclPtr<SvxPixelCtl>::Create(this) )
 {
     maPixelCtl->SetPosSizePixel( Point( 10, 10 ), Size( 200, 200 ) );
     maPixelCtl->Show();
diff --git a/sw/source/uibase/inc/tblctrl.hxx b/sw/source/uibase/inc/tblctrl.hxx
index 33dad5f..659591b 100644
--- a/sw/source/uibase/inc/tblctrl.hxx
+++ b/sw/source/uibase/inc/tblctrl.hxx
@@ -31,7 +31,7 @@ public:
     virtual ~SwTableOptimizeCtrl();
 
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 
 };
 
diff --git a/sw/source/uibase/inc/tbxanchr.hxx b/sw/source/uibase/inc/tbxanchr.hxx
index 64aebb7..fcc6db5 100644
--- a/sw/source/uibase/inc/tbxanchr.hxx
+++ b/sw/source/uibase/inc/tbxanchr.hxx
@@ -29,7 +29,7 @@ public:
 
     virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
     virtual void Click() SAL_OVERRIDE;
-    virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
 
     SFX_DECL_TOOLBOX_CONTROL();
 
diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx
index 6586553..85c4528 100644
--- a/sw/source/uibase/inc/workctrl.hxx
+++ b/sw/source/uibase/inc/workctrl.hxx
@@ -65,7 +65,7 @@ public:
     virtual ~SwTbxInsertCtrl();
 
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     virtual void                StateChanged( sal_uInt16 nSID,
                                               SfxItemState eState,
                                               const SfxPoolItem* pState ) SAL_OVERRIDE;
@@ -85,7 +85,7 @@ public:
     virtual ~SwTbxAutoTextCtrl();
 
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     virtual void                StateChanged( sal_uInt16 nSID,
                                               SfxItemState eState,
                                               const SfxPoolItem* pState ) SAL_OVERRIDE;
@@ -102,7 +102,7 @@ public:
     virtual ~SwTbxFieldCtrl();
 
     virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
+    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE;
     virtual void                StateChanged( sal_uInt16 nSID,
                                               SfxItemState eState,
                                               const SfxPoolItem* pState ) SAL_OVERRIDE;
diff --git a/sw/source/uibase/ribbar/tblctrl.cxx b/sw/source/uibase/ribbar/tblctrl.cxx
index b56e892..bcdc852 100644
--- a/sw/source/uibase/ribbar/tblctrl.cxx
+++ b/sw/source/uibase/ribbar/tblctrl.cxx
@@ -41,7 +41,7 @@ SwTableOptimizeCtrl::~SwTableOptimizeCtrl()
 {
 }
 
-SfxPopupWindow* SwTableOptimizeCtrl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SwTableOptimizeCtrl::CreatePopupWindow()
 {
     createAndPositionSubToolBar("private:resource/toolbar/optimizetablebar");
     return NULL;
diff --git a/sw/source/uibase/ribbar/tbxanchr.cxx b/sw/source/uibase/ribbar/tbxanchr.cxx
index 1b747b1..b25dd8a 100644
--- a/sw/source/uibase/ribbar/tbxanchr.cxx
+++ b/sw/source/uibase/ribbar/tbxanchr.cxx
@@ -62,7 +62,7 @@ void  SwTbxAnchor::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const
 
 }
 
-SfxPopupWindow* SwTbxAnchor::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SwTbxAnchor::CreatePopupWindow()
 {
     SwTbxAnchor::Click();
     return 0;
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index 869ac2a..ed6208c 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -122,7 +122,7 @@ void SwTbxInsertCtrl::StateChanged( sal_uInt16 /*nSID*/,
 
 }
 
-SfxPopupWindow* SwTbxInsertCtrl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SwTbxInsertCtrl::CreatePopupWindow()
 {
     if(GetSlotId() == FN_INSERT_CTRL)
     {
@@ -176,7 +176,7 @@ SwTbxAutoTextCtrl::~SwTbxAutoTextCtrl()
     DelPopup();
 }
 
-SfxPopupWindow* SwTbxAutoTextCtrl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SwTbxAutoTextCtrl::CreatePopupWindow()
 {
     SwView* pView = ::GetActiveView();
     if(pView && !pView->GetDocShell()->IsReadOnly() &&
@@ -288,7 +288,7 @@ SwTbxFieldCtrl::~SwTbxFieldCtrl()
 {
 }
 
-SfxPopupWindow* SwTbxFieldCtrl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SwTbxFieldCtrl::CreatePopupWindow()
 {
     SwView* pView = ::GetActiveView();
     if(pView && !pView->GetDocShell()->IsReadOnly() &&


More information about the Libreoffice-commits mailing list