[Libreoffice-commits] core.git: Branch 'feature/vclref' - avmedia/source basctl/source basic/source chart2/source compilerplugins/clang cui/source dbaccess/source desktop/source editeng/source extensions/source filter/source forms/source fpicker/source framework/source reportdesign/source sc/source sd/source sfx2/source svtools/source svx/source svx/workben sw/qa sw/source uui/source vcl/generic vcl/source vcl/unx vcl/workben writerperfect/source xmlsecurity/source

Noel Grandin noel at peralex.com
Wed Feb 11 04:45:21 PST 2015


 avmedia/source/viewer/mediawindow.cxx                        |    4 
 basctl/source/basicide/baside2.cxx                           |   10 
 basctl/source/basicide/baside2b.cxx                          |   10 
 basctl/source/basicide/baside3.cxx                           |    8 
 basctl/source/basicide/basides1.cxx                          |    8 
 basctl/source/basicide/basobj2.cxx                           |    8 
 basctl/source/basicide/basobj3.cxx                           |    8 
 basctl/source/basicide/bastypes.cxx                          |   18 -
 basctl/source/basicide/moduldl2.cxx                          |   16 
 basctl/source/basicide/moduldlg.cxx                          |   18 -
 basctl/source/dlged/managelang.cxx                           |   10 
 basic/source/runtime/iosys.cxx                               |    6 
 chart2/source/controller/dialogs/res_DataLabel.cxx           |    8 
 chart2/source/controller/main/ChartController.cxx            |    8 
 chart2/source/controller/main/ChartController_EditData.cxx   |    6 
 chart2/source/controller/main/ChartController_Insert.cxx     |   60 +--
 chart2/source/controller/main/ChartController_Properties.cxx |   16 
 compilerplugins/clang/vclwidgets.cxx                         |   34 +
 cui/source/customize/cfg.cxx                                 |   24 -
 cui/source/dialogs/SpellDialog.cxx                           |    6 
 cui/source/dialogs/about.cxx                                 |    6 
 cui/source/dialogs/colorpicker.cxx                           |    6 
 cui/source/dialogs/cuigaldlg.cxx                             |    4 
 cui/source/dialogs/hangulhanjadlg.cxx                        |   14 
 cui/source/dialogs/hldocntp.cxx                              |    8 
 cui/source/dialogs/hltpbase.cxx                              |    8 
 cui/source/dialogs/linkdlg.cxx                               |    8 
 cui/source/dialogs/passwdomdlg.cxx                           |   10 
 cui/source/dialogs/scriptdlg.cxx                             |   30 -
 cui/source/options/dbregister.cxx                            |   14 
 cui/source/options/doclinkdialog.cxx                         |   12 
 cui/source/options/optchart.cxx                              |    6 
 cui/source/options/optcolor.cxx                              |   24 -
 cui/source/options/optdict.cxx                               |    8 
 cui/source/options/optgdlg.cxx                               |    4 
 cui/source/options/optinet2.cxx                              |   12 
 cui/source/options/optjava.cxx                               |   16 
 cui/source/options/optlingu.cxx                              |   18 -
 cui/source/options/optopencl.cxx                             |    6 
 cui/source/options/personalization.cxx                       |    6 
 cui/source/tabpages/autocdlg.cxx                             |    8 
 cui/source/tabpages/grfpage.cxx                              |   18 -
 cui/source/tabpages/tpbitmap.cxx                             |   10 
 cui/source/tabpages/tpcolor.cxx                              |   20 -
 cui/source/tabpages/tpgradnt.cxx                             |   10 
 cui/source/tabpages/tphatch.cxx                              |   10 
 cui/source/tabpages/tplnedef.cxx                             |   18 -
 cui/source/tabpages/tplneend.cxx                             |   26 -
 dbaccess/source/ext/macromigration/macromigrationdialog.cxx  |    4 
 dbaccess/source/ui/app/AppControllerDnD.cxx                  |   22 -
 dbaccess/source/ui/app/AppControllerGen.cxx                  |   14 
 dbaccess/source/ui/browser/brwctrlr.cxx                      |   22 -
 dbaccess/source/ui/browser/sbagrid.cxx                       |   12 
 dbaccess/source/ui/dlg/CollectionView.cxx                    |    4 
 dbaccess/source/ui/dlg/ConnectionHelper.cxx                  |   18 -
 dbaccess/source/ui/dlg/ConnectionPage.cxx                    |    4 
 dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx            |    8 
 dbaccess/source/ui/dlg/UserAdmin.cxx                         |   26 -
 dbaccess/source/ui/dlg/adminpages.cxx                        |   16 
 dbaccess/source/ui/dlg/detailpages.cxx                       |    8 
 dbaccess/source/ui/dlg/directsql.cxx                         |    4 
 dbaccess/source/ui/dlg/generalpage.cxx                       |    4 
 dbaccess/source/ui/dlg/indexdialog.cxx                       |   22 -
 dbaccess/source/ui/dlg/sqlmessage.cxx                        |    4 
 dbaccess/source/ui/dlg/tablespage.cxx                        |    4 
 dbaccess/source/ui/misc/DExport.cxx                          |   24 -
 dbaccess/source/ui/misc/RowSetDrop.cxx                       |    4 
 dbaccess/source/ui/misc/UITools.cxx                          |   30 -
 dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx         |    4 
 dbaccess/source/ui/querydesign/QueryDesignView.cxx           |    4 
 dbaccess/source/ui/querydesign/QueryTableView.cxx            |   14 
 dbaccess/source/ui/querydesign/querycontroller.cxx           |   34 -
 dbaccess/source/ui/relationdesign/RelationController.cxx     |   10 
 dbaccess/source/ui/relationdesign/RelationTableView.cxx      |   30 -
 dbaccess/source/ui/tabledesign/TableController.cxx           |   56 +--
 dbaccess/source/ui/uno/dbinteraction.cxx                     |   16 
 desktop/source/app/app.cxx                                   |   10 
 desktop/source/app/lockfile2.cxx                             |   12 
 desktop/source/deployment/gui/dp_gui_dialog2.cxx             |   42 +-
 desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx   |   14 
 desktop/source/pkgchk/unopkg/unopkg_misc.cxx                 |    8 
 editeng/source/misc/splwrap.cxx                              |    4 
 extensions/source/abpilot/typeselectionpage.cxx              |    4 
 extensions/source/bibliography/bibview.cxx                   |    8 
 extensions/source/propctrlr/browserlistbox.cxx               |    7 
 extensions/source/propctrlr/commoncontrol.cxx                |    6 
 extensions/source/propctrlr/formcomponenthandler.cxx         |   26 -
 extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx |   10 
 extensions/source/scanner/sanedlg.cxx                        |   26 -
 extensions/source/scanner/scanunx.cxx                        |    6 
 filter/source/graphic/GraphicExportDialog.cxx                |    6 
 filter/source/graphicfilter/eps/eps.cxx                      |    4 
 filter/source/pdf/impdialog.cxx                              |   24 -
 filter/source/pdf/pdfinteract.cxx                            |    4 
 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx         |   28 -
 filter/source/xsltdialog/xmlfiltertabdialog.cxx              |    4 
 forms/source/runtime/formoperations.cxx                      |    4 
 fpicker/source/office/PlacesListBox.cxx                      |    8 
 fpicker/source/office/iodlg.cxx                              |   26 -
 framework/source/services/autorecovery.cxx                   |    8 
 reportdesign/source/ui/misc/UITools.cxx                      |   16 
 reportdesign/source/ui/report/ReportController.cxx           |   20 -
 sc/source/core/data/documen8.cxx                             |    4 
 sc/source/core/data/dpobject.cxx                             |    4 
 sc/source/core/data/validat.cxx                              |   12 
 sc/source/filter/oox/workbookhelper.cxx                      |   10 
 sc/source/ui/condformat/colorformat.cxx                      |    4 
 sc/source/ui/dbgui/dbnamdlg.cxx                              |    4 
 sc/source/ui/docshell/arealink.cxx                           |    6 
 sc/source/ui/docshell/dbdocfun.cxx                           |   24 -
 sc/source/ui/docshell/dbdocimp.cxx                           |    4 
 sc/source/ui/docshell/docfunc.cxx                            |    8 
 sc/source/ui/docshell/docsh.cxx                              |   36 +-
 sc/source/ui/docshell/docsh3.cxx                             |   14 
 sc/source/ui/docshell/docsh4.cxx                             |   68 +--
 sc/source/ui/docshell/docsh5.cxx                             |   22 -
 sc/source/ui/docshell/docsh6.cxx                             |    4 
 sc/source/ui/docshell/documentlinkmgr.cxx                    |    4 
 sc/source/ui/docshell/externalrefmgr.cxx                     |    6 
 sc/source/ui/docshell/impex.cxx                              |   10 
 sc/source/ui/drawfunc/fuins1.cxx                             |    4 
 sc/source/ui/drawfunc/graphsh.cxx                            |    6 
 sc/source/ui/miscdlgs/optsolver.cxx                          |   22 -
 sc/source/ui/miscdlgs/retypepassdlg.cxx                      |    8 
 sc/source/ui/miscdlgs/solveroptions.cxx                      |   20 -
 sc/source/ui/optdlg/tpformula.cxx                            |    6 
 sc/source/ui/view/cellsh1.cxx                                |   16 
 sc/source/ui/view/cellsh2.cxx                                |    8 
 sc/source/ui/view/cellsh3.cxx                                |    6 
 sc/source/ui/view/dbfunc.cxx                                 |    6 
 sc/source/ui/view/spelleng.cxx                               |    6 
 sc/source/ui/view/tabview2.cxx                               |    4 
 sc/source/ui/view/viewfun2.cxx                               |   12 
 sc/source/ui/view/viewfun3.cxx                               |   10 
 sc/source/ui/view/viewfun4.cxx                               |    8 
 sd/source/core/drawdoc3.cxx                                  |    4 
 sd/source/filter/grf/sdgrffilter.cxx                         |    4 
 sd/source/filter/html/htmlex.cxx                             |    6 
 sd/source/filter/html/pubdlg.cxx                             |   12 
 sd/source/ui/animations/CustomAnimationDialog.cxx            |    6 
 sd/source/ui/animations/SlideTransitionPane.cxx              |    6 
 sd/source/ui/annotations/annotationmanager.cxx               |    7 
 sd/source/ui/dlg/LayerTabBar.cxx                             |    6 
 sd/source/ui/dlg/PhotoAlbumDialog.cxx                        |    8 
 sd/source/ui/dlg/animobjs.cxx                                |    4 
 sd/source/ui/dlg/brkdlg.cxx                                  |    4 
 sd/source/ui/dlg/custsdlg.cxx                                |   12 
 sd/source/ui/dlg/sdtreelb.cxx                                |    4 
 sd/source/ui/dlg/tpoption.cxx                                |   11 
 sd/source/ui/func/fuinsert.cxx                               |    4 
 sd/source/ui/func/fuinsfil.cxx                               |   12 
 sd/source/ui/func/fulinend.cxx                               |    6 
 sd/source/ui/func/fupage.cxx                                 |    8 
 sd/source/ui/slidesorter/controller/SlsClipboard.cxx         |    6 
 sd/source/ui/view/DocumentRenderer.cxx                       |    6 
 sd/source/ui/view/Outliner.cxx                               |   22 -
 sd/source/ui/view/ViewShellBase.cxx                          |    6 
 sd/source/ui/view/drviews2.cxx                               |   18 -
 sd/source/ui/view/drviews6.cxx                               |    4 
 sd/source/ui/view/drviews9.cxx                               |   10 
 sd/source/ui/view/drviewsi.cxx                               |    6 
 sfx2/source/appl/appopen.cxx                                 |   12 
 sfx2/source/appl/appserv.cxx                                 |   12 
 sfx2/source/appl/impldde.cxx                                 |    6 
 sfx2/source/appl/newhelp.cxx                                 |   24 -
 sfx2/source/appl/opengrf.cxx                                 |    4 
 sfx2/source/appl/openuriexternally.cxx                       |    8 
 sfx2/source/appl/sfxhelp.cxx                                 |    4 
 sfx2/source/bastyp/fltfnc.cxx                                |    4 
 sfx2/source/dialog/mailmodel.cxx                             |    4 
 sfx2/source/dialog/mgetempl.cxx                              |   12 
 sfx2/source/dialog/passwd.cxx                                |    4 
 sfx2/source/dialog/recfloat.cxx                              |    6 
 sfx2/source/dialog/securitypage.cxx                          |   16 
 sfx2/source/dialog/templdlg.cxx                              |   10 
 sfx2/source/doc/QuerySaveDocument.cxx                        |    6 
 sfx2/source/doc/docinsert.cxx                                |    8 
 sfx2/source/doc/guisaveas.cxx                                |   10 
 sfx2/source/doc/objcont.cxx                                  |    4 
 sfx2/source/doc/objserv.cxx                                  |   16 
 sfx2/source/doc/objstor.cxx                                  |    4 
 sfx2/source/doc/templatedlg.cxx                              |   62 +--
 sfx2/source/view/viewfrm.cxx                                 |   18 -
 sfx2/source/view/viewsh.cxx                                  |   12 
 svtools/source/contnr/fileview.cxx                           |   10 
 svtools/source/java/javainteractionhandler.cxx               |   28 -
 svx/source/dialog/_contdlg.cxx                               |   18 -
 svx/source/dialog/docrecovery.cxx                            |    4 
 svx/source/dialog/imapdlg.cxx                                |    8 
 svx/source/form/databaselocationinput.cxx                    |    4 
 svx/source/form/datanavi.cxx                                 |  192 +++++------
 svx/source/form/fmshell.cxx                                  |    6 
 svx/source/tbxctrls/grafctrl.cxx                             |   12 
 svx/source/toolbars/extrusionbar.cxx                         |    6 
 svx/source/toolbars/fontworkbar.cxx                          |   10 
 svx/workben/pixelctl.cxx                                     |    6 
 sw/qa/tiledrendering/tiledrendering.cxx                      |    4 
 sw/source/core/doc/DocumentRedlineManager.cxx                |    4 
 sw/source/ui/config/mailconfigpage.cxx                       |    4 
 sw/source/ui/config/optcomp.cxx                              |    6 
 sw/source/ui/dbui/mmoutputpage.cxx                           |   46 +-
 sw/source/ui/dialog/uiregionsw.cxx                           |   32 -
 sw/source/ui/envelp/label1.cxx                               |   22 -
 sw/source/ui/envelp/labfmt.cxx                               |   10 
 sw/source/ui/fmtui/tmpdlg.cxx                                |   12 
 sw/source/ui/frmdlg/cption.cxx                               |   22 -
 sw/source/ui/index/cnttab.cxx                                |    4 
 sw/source/ui/index/swuiidxmrk.cxx                            |   14 
 sw/source/ui/misc/glosbib.cxx                                |    4 
 sw/source/ui/misc/glossary.cxx                               |    8 
 sw/source/ui/misc/num.cxx                                    |   12 
 sw/source/uibase/app/docsh2.cxx                              |    6 
 sw/source/uibase/dochdl/swdtflvr.cxx                         |    4 
 sw/source/uibase/lingu/olmenu.cxx                            |    6 
 sw/source/uibase/shells/grfsh.cxx                            |    8 
 sw/source/uibase/shells/tabsh.cxx                            |    6 
 sw/source/uibase/shells/textsh1.cxx                          |   22 -
 sw/source/uibase/uiview/view2.cxx                            |   50 +-
 sw/source/uibase/uiview/viewdraw.cxx                         |    6 
 sw/source/uibase/uiview/viewling.cxx                         |    4 
 sw/source/uibase/uiview/viewprt.cxx                          |   12 
 sw/source/uibase/utlui/gloslst.cxx                           |   10 
 uui/source/iahndl.cxx                                        |   24 -
 uui/source/masterpasscrtdlg.cxx                              |    4 
 uui/source/masterpassworddlg.cxx                             |    4 
 uui/source/nameclashdlg.cxx                                  |    4 
 uui/source/passworddlg.cxx                                   |    8 
 vcl/generic/print/genprnpsp.cxx                              |    4 
 vcl/generic/print/prtsetup.cxx                               |    6 
 vcl/source/app/dbggui.cxx                                    |   14 
 vcl/source/app/stdtext.cxx                                   |    4 
 vcl/source/app/svdata.cxx                                    |    4 
 vcl/source/control/edit.cxx                                  |    8 
 vcl/source/gdi/print3.cxx                                    |   20 -
 vcl/source/window/dialog.cxx                                 |   16 
 vcl/source/window/menubarwindow.cxx                          |   10 
 vcl/unx/generic/printer/cupsmgr.cxx                          |    8 
 vcl/unx/x11/x11sys.cxx                                       |   12 
 vcl/workben/outdevgrind.cxx                                  |    4 
 vcl/workben/svdem.cxx                                        |    6 
 vcl/workben/svpclient.cxx                                    |    6 
 vcl/workben/svptest.cxx                                      |    7 
 vcl/workben/vcldemo.cxx                                      |    6 
 writerperfect/source/writer/WordPerfectImportFilter.cxx      |   16 
 xmlsecurity/source/component/documentdigitalsignatures.cxx   |   32 -
 xmlsecurity/source/dialogs/certificatechooser.cxx            |    4 
 xmlsecurity/source/dialogs/certificateviewer.cxx             |    4 
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx       |   14 
 xmlsecurity/source/dialogs/macrosecurity.cxx                 |    4 
 249 files changed, 1578 insertions(+), 1554 deletions(-)

New commits:
commit 5072bca347578d9662792d3c113a4ed09f854f9b
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Feb 11 14:42:23 2015 +0200

    vclwidgets: wrap all vcl::Window subclasses allocated on stack in VclPtr
    
    Change-Id: Ia8b0d84bbf69f9d8f85505d019acdded14e25133

diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx
index 22326a6..6956b8c 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -327,9 +327,9 @@ bool MediaWindow::executeMediaURLDialog(vcl::Window* /* pParent */,
 
 void MediaWindow::executeFormatErrorBox( vcl::Window* pParent )
 {
-    MessageDialog aErrBox( pParent, AVMEDIA_RESID( AVMEDIA_STR_ERR_URL ) );
+    VclPtr<MessageDialog> aErrBox(new MessageDialog( pParent, AVMEDIA_RESID( AVMEDIA_STR_ERR_URL ) ) );
 
-    aErrBox.Execute();
+    aErrBox->Execute();
 }
 
 
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 7cb3a39..896d9cf 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -619,8 +619,8 @@ void ModulWindow::BasicToggleBreakPointEnabled()
 void ModulWindow::ManageBreakPoints()
 {
     BreakPointWindow& rBrkWin = GetBreakPointWindow();
-    BreakPointDialog aBrkDlg( &rBrkWin, GetBreakPoints() );
-    aBrkDlg.Execute();
+    VclPtr<BreakPointDialog> aBrkDlg(new BreakPointDialog( &rBrkWin, GetBreakPoints() ));
+    aBrkDlg->Execute();
     rBrkWin.Invalidate();
 }
 
@@ -1043,9 +1043,9 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq)
             break;
         case SID_GOTOLINE:
         {
-            GotoLineDialog aGotoDlg(this);
-            if (aGotoDlg.Execute())
-                if (sal_Int32 const nLine = aGotoDlg.GetLineNumber())
+            VclPtr<GotoLineDialog> aGotoDlg(new GotoLineDialog(this));
+            if (aGotoDlg->Execute())
+                if (sal_Int32 const nLine = aGotoDlg->GetLineNumber())
                 {
                     TextSelection const aSel(TextPaM(nLine - 1, 0), TextPaM(nLine - 1, 0));
                     GetEditView()->SetSelection(aSel);
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 1f67922..4783a1b 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1497,9 +1497,9 @@ void BreakPointWindow::Command( const CommandEvent& rCEvt )
                 break;
                 case RID_BRKPROPS:
                 {
-                    BreakPointDialog aBrkDlg( this, GetBreakPoints() );
-                    aBrkDlg.SetCurrentBreakPoint( pBrk );
-                    aBrkDlg.Execute();
+                    VclPtr<BreakPointDialog> aBrkDlg(new BreakPointDialog( this, GetBreakPoints() ));
+                    aBrkDlg->SetCurrentBreakPoint( pBrk );
+                    aBrkDlg->Execute();
                     Invalidate();
                 }
                 break;
@@ -1512,8 +1512,8 @@ void BreakPointWindow::Command( const CommandEvent& rCEvt )
             {
                 case RID_BRKDLG:
                 {
-                    BreakPointDialog aBrkDlg( this, GetBreakPoints() );
-                    aBrkDlg.Execute();
+                    VclPtr<BreakPointDialog> aBrkDlg(new BreakPointDialog( this, GetBreakPoints() ));
+                    aBrkDlg->Execute();
                     Invalidate();
                 }
                 break;
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 973e58d..1faacbf 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -1024,8 +1024,8 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script
                 OUString aQueryBoxText(IDE_RESSTR(RID_STR_DLGIMP_CLASH_TEXT));
                 aQueryBoxText = aQueryBoxText.replaceAll("$(ARG1)", aXmlDlgName);
 
-                NameClashQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
-                sal_uInt16 nRet = aQueryBox.Execute();
+                VclPtr<NameClashQueryBox> aQueryBox(new NameClashQueryBox( pWin, aQueryBoxTitle, aQueryBoxText ));
+                sal_uInt16 nRet = aQueryBox->Execute();
                 if( RET_YES == nRet )
                 {
                     // RET_YES == Rename, see NameClashQueryBox::NameClashQueryBox
@@ -1086,8 +1086,8 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script
             {
                 OUString aQueryBoxTitle(IDE_RESSTR(RID_STR_DLGIMP_MISMATCH_TITLE));
                 OUString aQueryBoxText(IDE_RESSTR(RID_STR_DLGIMP_MISMATCH_TEXT));
-                LanguageMismatchQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
-                sal_uInt16 nRet = aQueryBox.Execute();
+                VclPtr<LanguageMismatchQueryBox> aQueryBox(new LanguageMismatchQueryBox( pWin, aQueryBoxTitle, aQueryBoxText ));
+                sal_uInt16 nRet = aQueryBox->Execute();
                 if( RET_YES == nRet )
                 {
                     // RET_YES == Add, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index ff1fa98..d908ad4 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -136,8 +136,8 @@ void Shell::ExecuteCurrent( SfxRequest& rReq )
                             SfxViewFrame* pViewFrame = GetViewFrame();
                             SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SEARCH_DLG ) : NULL;
                             vcl::Window* pParent = pChildWin ? pChildWin->GetWindow() : NULL;
-                            QueryBox aQuery(pParent, WB_YES_NO|WB_DEF_YES, IDE_RESSTR(RID_STR_SEARCHFROMSTART));
-                            if ( aQuery.Execute() == RET_YES )
+                            VclPtr<QueryBox> aQuery(new QueryBox(pParent, WB_YES_NO|WB_DEF_YES, IDE_RESSTR(RID_STR_SEARCHFROMSTART)));
+                            if ( aQuery->Execute() == RET_YES )
                             {
                                 it = aWindowTable.begin();
                                 if ( it != aWindowTable.end() )
@@ -676,8 +676,8 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
 
         case SID_BASICIDE_MANAGE_LANG:
         {
-            ManageLanguageDialog aDlg(pCurWin, m_pCurLocalizationMgr);
-            aDlg.Execute();
+            VclPtr<ManageLanguageDialog> aDlg(new ManageLanguageDialog(pCurWin, m_pCurLocalizationMgr));
+            aDlg->Execute();
             rReq.Done();
         }
         break;
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index 9834875..bd4a67b 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -149,16 +149,16 @@ bool RenameModule (
 
     if ( rDocument.hasModule( rLibName, rNewName ) )
     {
-        MessageDialog aError(pErrorParent, IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2));
-        aError.Execute();
+        VclPtr<MessageDialog> aError(new MessageDialog(pErrorParent, IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2)));
+        aError->Execute();
         return false;
     }
 
     // #i74440
     if ( rNewName.isEmpty() )
     {
-        MessageDialog aError(pErrorParent, IDE_RESSTR(RID_STR_BADSBXNAME));
-        aError.Execute();
+        VclPtr<MessageDialog> aError(new MessageDialog(pErrorParent, IDE_RESSTR(RID_STR_BADSBXNAME)));
+        aError->Execute();
         return false;
     }
 
diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx
index 141ddae..60729c6 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -155,16 +155,16 @@ bool RenameDialog (
 
     if ( rDocument.hasDialog( rLibName, rNewName ) )
     {
-        MessageDialog aError(pErrorParent, IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2));
-        aError.Execute();
+        VclPtr<MessageDialog> aError(new MessageDialog(pErrorParent, IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2)));
+        aError->Execute();
         return false;
     }
 
     // #i74440
     if ( rNewName.isEmpty() )
     {
-        MessageDialog aError(pErrorParent, IDE_RESSTR(RID_STR_BADSBXNAME));
-        aError.Execute();
+        VclPtr<MessageDialog> aError(new MessageDialog(pErrorParent, IDE_RESSTR(RID_STR_BADSBXNAME)));
+        aError->Execute();
         return false;
     }
 
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 2bdb192..b4c67b8 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -790,8 +790,8 @@ bool QueryDel( const OUString& rName, const ResId& rId, vcl::Window* pParent )
     aNameBuf.append('\'');
     aNameBuf.insert(0, '\'');
     aQuery = aQuery.replaceAll("XX", aNameBuf.makeStringAndClear());
-    MessageDialog aQueryBox(pParent, aQuery, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
-    return ( aQueryBox.Execute() == RET_YES );
+    VclPtr<MessageDialog> aQueryBox(new MessageDialog(pParent, aQuery, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO));
+    return ( aQueryBox->Execute() == RET_YES );
 }
 
 bool QueryDelMacro( const OUString& rName, vcl::Window* pParent )
@@ -827,19 +827,19 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer,
     do
     {
         // password dialog
-        SfxPasswordDialog aDlg(Application::GetDefDialogParent());
-        aDlg.SetMinLen( 1 );
+        VclPtr<SfxPasswordDialog> aDlg(new SfxPasswordDialog(Application::GetDefDialogParent()));
+        aDlg->SetMinLen( 1 );
 
         // set new title
         if ( bNewTitle )
         {
             OUString aTitle(IDE_RESSTR(RID_STR_ENTERPASSWORD));
             aTitle = aTitle.replaceAll("XX", rLibName);
-            aDlg.SetText( aTitle );
+            aDlg->SetText( aTitle );
         }
 
         // execute dialog
-        nRet = aDlg.Execute();
+        nRet = aDlg->Execute();
 
         // verify password
         if ( nRet == RET_OK )
@@ -849,14 +849,14 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer,
                 Reference< script::XLibraryContainerPassword > xPasswd( xLibContainer, UNO_QUERY );
                 if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( rLibName ) && !xPasswd->isLibraryPasswordVerified( rLibName ) )
                 {
-                    rPassword = aDlg.GetPassword();
+                    rPassword = aDlg->GetPassword();
                     //                    OUString aOUPassword( rPassword );
                     bOK = xPasswd->verifyLibraryPassword( rLibName, rPassword );
 
                     if ( !bOK )
                     {
-                        MessageDialog aErrorBox(Application::GetDefDialogParent(), IDE_RESSTR(RID_STR_WRONGPASSWORD));
-                        aErrorBox.Execute();
+                        VclPtr<MessageDialog> aErrorBox(new MessageDialog(Application::GetDefDialogParent(), IDE_RESSTR(RID_STR_WRONGPASSWORD)));
+                        aErrorBox->Execute();
                     }
                 }
             }
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 0b70ec3..a3055f7 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -1077,12 +1077,12 @@ void LibPage::Export( void )
             return;
     }
 
-    ExportDialog aNewDlg(this);
-    if (aNewDlg.Execute() == RET_OK)
+    VclPtr<ExportDialog> aNewDlg(new ExportDialog(this));
+    if (aNewDlg->Execute() == RET_OK)
     {
         try
         {
-            if (aNewDlg.isExportAsPackage())
+            if (aNewDlg->isExportAsPackage())
                 ExportAsPackage( aLibName );
             else
                 ExportAsBasic( aLibName );
@@ -1455,13 +1455,13 @@ void createLibImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
         i++;
     }
 
-    NewObjectDialog aNewDlg(pWin, ObjectMode::Library);
-    aNewDlg.SetObjectName(aLibName);
+    VclPtr<NewObjectDialog> aNewDlg(new NewObjectDialog(pWin, ObjectMode::Library));
+    aNewDlg->SetObjectName(aLibName);
 
-    if (aNewDlg.Execute())
+    if (aNewDlg->Execute())
     {
-        if (!aNewDlg.GetObjectName().isEmpty())
-            aLibName = aNewDlg.GetObjectName();
+        if (!aNewDlg->GetObjectName().isEmpty())
+            aLibName = aNewDlg->GetObjectName();
 
         if ( aLibName.getLength() > 30 )
         {
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 1126d3a..e7f79cc 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -804,12 +804,12 @@ void ObjectPage::NewDialog()
     {
         aDocument.getOrCreateLibrary( E_DIALOGS, aLibName );
 
-        NewObjectDialog aNewDlg(this, ObjectMode::Dialog, true);
-        aNewDlg.SetObjectName( aDocument.createObjectName( E_DIALOGS, aLibName ) );
+        VclPtr<NewObjectDialog> aNewDlg(new NewObjectDialog(this, ObjectMode::Dialog, true));
+        aNewDlg->SetObjectName( aDocument.createObjectName( E_DIALOGS, aLibName ) );
 
-        if (aNewDlg.Execute() != 0)
+        if (aNewDlg->Execute() != 0)
         {
-            OUString aDlgName = aNewDlg.GetObjectName();
+            OUString aDlgName = aNewDlg->GetObjectName();
             if (aDlgName.isEmpty())
                 aDlgName = aDocument.createObjectName( E_DIALOGS, aLibName);
 
@@ -947,13 +947,13 @@ SbModule* createModImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
     if ( aModName.isEmpty() )
         aModName = rDocument.createObjectName( E_SCRIPTS, aLibName );
 
-    NewObjectDialog aNewDlg(pWin, ObjectMode::Module, true);
-    aNewDlg.SetObjectName( aModName );
+    VclPtr<NewObjectDialog> aNewDlg(new NewObjectDialog(pWin, ObjectMode::Module, true));
+    aNewDlg->SetObjectName( aModName );
 
-    if (aNewDlg.Execute() != 0)
+    if (aNewDlg->Execute() != 0)
     {
-        if (!aNewDlg.GetObjectName().isEmpty() )
-            aModName = aNewDlg.GetObjectName();
+        if (!aNewDlg->GetObjectName().isEmpty() )
+            aModName = aNewDlg->GetObjectName();
 
         try
         {
diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index 066704e..83a40ea 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -142,11 +142,11 @@ void ManageLanguageDialog::ClearLanguageBox()
 
 IMPL_LINK_NOARG(ManageLanguageDialog, AddHdl)
 {
-    SetDefaultLanguageDialog aDlg( this, m_xLocalizationMgr );
-    if ( RET_OK == aDlg.Execute() )
+    VclPtr<SetDefaultLanguageDialog> aDlg(new SetDefaultLanguageDialog( this, m_xLocalizationMgr ));
+    if ( RET_OK == aDlg->Execute() )
     {
         // add new locales
-        Sequence< Locale > aLocaleSeq = aDlg.GetLocales();
+        Sequence< Locale > aLocaleSeq = aDlg->GetLocales();
         m_xLocalizationMgr->handleAddLocales( aLocaleSeq );
         // update listbox
         ClearLanguageBox();
@@ -160,8 +160,8 @@ IMPL_LINK_NOARG(ManageLanguageDialog, AddHdl)
 
 IMPL_LINK_NOARG(ManageLanguageDialog, DeleteHdl)
 {
-    MessageDialog aQBox(this, "DeleteLangDialog", "modules/BasicIDE/ui/deletelang.ui");
-    if ( aQBox.Execute() == RET_OK )
+    VclPtr<MessageDialog> aQBox(new MessageDialog(this, "DeleteLangDialog", "modules/BasicIDE/ui/deletelang.ui"));
+    if ( aQBox->Execute() == RET_OK )
     {
         sal_uInt16 i, nCount = m_pLanguageLB->GetSelectEntryCount();
         sal_uInt16 nPos = m_pLanguageLB->GetSelectEntryPos();
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 7689938..1190b10 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -966,10 +966,10 @@ void SbiIoSystem::CloseAll(void)
 void SbiIoSystem::ReadCon(OString& rIn)
 {
     OUString aPromptStr(OStringToOUString(aPrompt, osl_getThreadTextEncoding()));
-    SbiInputDialog aDlg( NULL, aPromptStr );
-    if( aDlg.Execute() )
+    VclPtr<SbiInputDialog> aDlg(new SbiInputDialog(NULL, aPromptStr) );
+    if( aDlg->Execute() )
     {
-        rIn = OUStringToOString(aDlg.GetInput(), osl_getThreadTextEncoding());
+        rIn = OUStringToOString(aDlg->GetInput(), osl_getThreadTextEncoding());
     }
     else
     {
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
index c0f2da1..5bbe9f6 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -205,12 +205,12 @@ IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton )
         aNumberSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, rnFormatKey ));
     aNumberSet.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, rUseSourceFormat ));
 
-    NumberFormatDialog aDlg(m_pWindow, aNumberSet);
+    VclPtr<NumberFormatDialog> aDlg(new NumberFormatDialog(m_pWindow, aNumberSet));
     if( bPercent )
-        aDlg.SetText( m_pFT_NumberFormatForPercent->GetText());
-    if( RET_OK == aDlg.Execute() )
+        aDlg->SetText( m_pFT_NumberFormatForPercent->GetText());
+    if( RET_OK == aDlg->Execute() )
     {
-        const SfxItemSet* pResult = aDlg.GetOutputItemSet();
+        const SfxItemSet* pResult = aDlg->GetOutputItemSet();
         if( pResult )
         {
             bool bOldSource = rUseSourceFormat;
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index a16a4ab..eba598e 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -1277,8 +1277,8 @@ void ChartController::executeDispatch_ChartType()
 
     SolarMutexGuard aSolarGuard;
     //prepare and open dialog
-    ChartTypeDialog aDlg( m_pChartWindow, getModel(), m_xCC );
-    if( aDlg.Execute() == RET_OK )
+    VclPtr<ChartTypeDialog> aDlg(new ChartTypeDialog( m_pChartWindow, getModel(), m_xCC ));
+    if( aDlg->Execute() == RET_OK )
     {
         impl_adaptDataSeriesAutoResize();
         aUndoGuard.commit();
@@ -1298,8 +1298,8 @@ void ChartController::executeDispatch_SourceData()
     if( xChartDoc.is())
     {
         SolarMutexGuard aSolarGuard;
-        ::chart::DataSourceDialog aDlg( m_pChartWindow, xChartDoc, m_xCC );
-        if( aDlg.Execute() == RET_OK )
+        VclPtr<::chart::DataSourceDialog> aDlg(new ::chart::DataSourceDialog( m_pChartWindow, xChartDoc, m_xCC ));
+        if( aDlg->Execute() == RET_OK )
         {
             impl_adaptDataSeriesAutoResize();
             aUndoGuard.commit();
diff --git a/chart2/source/controller/main/ChartController_EditData.cxx b/chart2/source/controller/main/ChartController_EditData.cxx
index aebf313..c732dda9 100644
--- a/chart2/source/controller/main/ChartController_EditData.cxx
+++ b/chart2/source/controller/main/ChartController_EditData.cxx
@@ -56,9 +56,9 @@ void ChartController::executeDispatch_EditData()
             UndoLiveUpdateGuardWithData aUndoGuard = UndoLiveUpdateGuardWithData(
                 SCH_RESSTR( STR_ACTION_EDIT_CHART_DATA ),
                 m_xUndoManager );
-            DataEditor aDataEditorDialog( pParent, xChartDoc, m_xCC );
-            if (aDataEditorDialog.Execute() == RET_OK)
-                aDataEditorDialog.ApplyChangesToModel();
+            VclPtr<DataEditor> aDataEditorDialog(new DataEditor( pParent, xChartDoc, m_xCC ));
+            if (aDataEditorDialog->Execute() == RET_OK)
+                aDataEditorDialog->ApplyChangesToModel();
             aUndoGuard.commit();
         }
     }
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx
index 7c83ecc..57a5d9d 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -109,14 +109,14 @@ void ChartController::executeDispatch_InsertAxes()
         AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram, true );
 
         SolarMutexGuard aGuard;
-        SchAxisDlg aDlg( m_pChartWindow, aDialogInput );
-        if( aDlg.Execute() == RET_OK )
+        VclPtr<SchAxisDlg> aDlg(new SchAxisDlg( m_pChartWindow, aDialogInput ));
+        if( aDlg->Execute() == RET_OK )
         {
             // lock controllers till end of block
             ControllerLockGuardUNO aCLGuard( getModel() );
 
             InsertAxisOrGridDialogData aDialogOutput;
-            aDlg.getResult( aDialogOutput );
+            aDlg->getResult( aDialogOutput );
             boost::scoped_ptr< ReferenceSizeProvider > mpRefSizeProvider(
                 impl_createReferenceSizeProvider());
             bool bChanged = AxisHelper::changeVisibilityOfAxes( xDiagram
@@ -147,13 +147,13 @@ void ChartController::executeDispatch_InsertGrid()
         AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram, false );
 
         SolarMutexGuard aGuard;
-        SchGridDlg aDlg( m_pChartWindow, aDialogInput );//aItemSet, b3D, bNet, bSecondaryX, bSecondaryY );
-        if( aDlg.Execute() == RET_OK )
+        VclPtr<SchGridDlg> aDlg(new SchGridDlg( m_pChartWindow, aDialogInput ));//aItemSet, b3D, bNet, bSecondaryX, bSecondaryY );
+        if( aDlg->Execute() == RET_OK )
         {
             // lock controllers till end of block
             ControllerLockGuardUNO aCLGuard( getModel() );
             InsertAxisOrGridDialogData aDialogOutput;
-            aDlg.getResult( aDialogOutput );
+            aDlg->getResult( aDialogOutput );
             bool bChanged = AxisHelper::changeVisibilityOfGrids( xDiagram
                 , aDialogInput.aExistenceList, aDialogOutput.aExistenceList, m_xCC );
             if( bChanged )
@@ -179,13 +179,13 @@ void ChartController::executeDispatch_InsertTitles()
         aDialogInput.readFromModel( getModel() );
 
         SolarMutexGuard aGuard;
-        SchTitleDlg aDlg( m_pChartWindow, aDialogInput );
-        if( aDlg.Execute() == RET_OK )
+        VclPtr<SchTitleDlg> aDlg(new SchTitleDlg( m_pChartWindow, aDialogInput ));
+        if( aDlg->Execute() == RET_OK )
         {
             // lock controllers till end of block
             ControllerLockGuardUNO aCLGuard( getModel() );
             TitleDialogData aDialogOutput(impl_createReferenceSizeProvider());
-            aDlg.getResult( aDialogOutput );
+            aDlg->getResult( aDialogOutput );
             bool bChanged = aDialogOutput.writeDifferenceToModel( getModel(), m_xCC, &aDialogInput );
             if( bChanged )
                 aUndoGuard.commit();
@@ -232,13 +232,13 @@ void ChartController::executeDispatch_OpenLegendDialog()
     {
         //prepare and open dialog
         SolarMutexGuard aGuard;
-        SchLegendDlg aDlg( m_pChartWindow, m_xCC );
-        aDlg.init( getModel() );
-        if( aDlg.Execute() == RET_OK )
+        VclPtr<SchLegendDlg> aDlg(new SchLegendDlg( m_pChartWindow, m_xCC ));
+        aDlg->init( getModel() );
+        if( aDlg->Execute() == RET_OK )
         {
             // lock controllers till end of block
             ControllerLockGuardUNO aCLGuard( getModel() );
-            bool bChanged = aDlg.writeToModel( getModel() );
+            bool bChanged = aDlg->writeToModel( getModel() );
             if( bChanged )
                 aUndoGuard.commit();
         }
@@ -292,12 +292,12 @@ void ChartController::executeDispatch_InsertMenu_DataLabels()
         NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
         SvNumberFormatter* pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
 
-        DataLabelsDialog aDlg( m_pChartWindow, aItemSet, pNumberFormatter);
+        VclPtr<DataLabelsDialog> aDlg(new DataLabelsDialog( m_pChartWindow, aItemSet, pNumberFormatter));
 
-        if( aDlg.Execute() == RET_OK )
+        if( aDlg->Execute() == RET_OK )
         {
             SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
-            aDlg.FillItemSet( aOutItemSet );
+            aDlg->FillItemSet( aOutItemSet );
             // lock controllers till end of block
             ControllerLockGuardUNO aCLGuard( getModel() );
             bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
@@ -397,14 +397,14 @@ void ChartController::executeDispatch_InsertTrendline()
     aDialogParameter.init( getModel() );
     ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get());
     SolarMutexGuard aGuard;
-    SchAttribTabDlg aDialog( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider,
-                          uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ));
+    VclPtr<SchAttribTabDlg> aDialog(new SchAttribTabDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider,
+                          uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY )));
 
     // note: when a user pressed "OK" but didn't change any settings in the
     // dialog, the SfxTabDialog returns "Cancel"
-    if( aDialog.Execute() == RET_OK || aDialog.DialogWasClosedWithOK())
+    if( aDialog->Execute() == RET_OK || aDialog->DialogWasClosedWithOK())
     {
-        const SfxItemSet* pOutItemSet = aDialog.GetOutputItemSet();
+        const SfxItemSet* pOutItemSet = aDialog->GetOutputItemSet();
         if( pOutItemSet )
         {
             ControllerLockGuardUNO aCLGuard( getModel() );
@@ -452,17 +452,17 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError )
         aDialogParameter.init( getModel() );
         ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get());
         SolarMutexGuard aGuard;
-        SchAttribTabDlg aDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider,
-                              uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ));
-        aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
+        VclPtr<SchAttribTabDlg> aDlg(new SchAttribTabDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider,
+                              uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY )));
+        aDlg->SetAxisMinorStepWidthForErrorBarDecimals(
             InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(),
                                                                              m_xChartView, m_aSelection.getSelectedCID()));
 
         // note: when a user pressed "OK" but didn't change any settings in the
         // dialog, the SfxTabDialog returns "Cancel"
-        if( aDlg.Execute() == RET_OK || aDlg.DialogWasClosedWithOK())
+        if( aDlg->Execute() == RET_OK || aDlg->DialogWasClosedWithOK())
         {
-            const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
+            const SfxItemSet* pOutItemSet = aDlg->GetOutputItemSet();
             if( pOutItemSet )
             {
                 ControllerLockGuardUNO aCLGuard( getModel() );
@@ -489,18 +489,18 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError )
 
             //prepare and open dialog
             SolarMutexGuard aGuard;
-            InsertErrorBarsDialog aDlg(
+            VclPtr<InsertErrorBarsDialog> aDlg(new InsertErrorBarsDialog(
                 m_pChartWindow, aItemSet,
                 uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY ),
-                bYError ? ErrorBarResources::ERROR_BAR_Y : ErrorBarResources::ERROR_BAR_X);
+                bYError ? ErrorBarResources::ERROR_BAR_Y : ErrorBarResources::ERROR_BAR_X));
 
-            aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
+            aDlg->SetAxisMinorStepWidthForErrorBarDecimals(
                 InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, OUString() ) );
 
-            if( aDlg.Execute() == RET_OK )
+            if( aDlg->Execute() == RET_OK )
             {
                 SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
-                aDlg.FillItemSet( aOutItemSet );
+                aDlg->FillItemSet( aOutItemSet );
 
                 // lock controllers till end of block
                 ControllerLockGuardUNO aCLGuard( getModel() );
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index ca3dfa1..d0676cd 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -761,8 +761,8 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard(
         ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get() );
 
         SolarMutexGuard aGuard;
-        SchAttribTabDlg aDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider
-            , uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ) );
+        VclPtr<SchAttribTabDlg> aDlg(new SchAttribTabDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider
+            , uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ) ));
 
         if(aDialogParameter.HasSymbolProperties())
         {
@@ -782,18 +782,18 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard(
             sal_Int32   nStandardSymbol=0;//@todo get from somewhere
             Graphic*    pAutoSymbolGraphic = new Graphic( aViewElementListProvider.GetSymbolGraphic( nStandardSymbol, pSymbolShapeProperties ) );
             // note: the dialog takes the ownership of pSymbolShapeProperties and pAutoSymbolGraphic
-            aDlg.setSymbolInformation( pSymbolShapeProperties, pAutoSymbolGraphic );
+            aDlg->setSymbolInformation( pSymbolShapeProperties, pAutoSymbolGraphic );
         }
         if( aDialogParameter.HasStatisticProperties() )
         {
-            aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
+            aDlg->SetAxisMinorStepWidthForErrorBarDecimals(
                 InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, rObjectCID ) );
         }
 
         //open the dialog
-        if (aDlg.Execute() == RET_OK || (bSuccessOnUnchanged && aDlg.DialogWasClosedWithOK()))
+        if (aDlg->Execute() == RET_OK || (bSuccessOnUnchanged && aDlg->DialogWasClosedWithOK()))
         {
-            const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
+            const SfxItemSet* pOutItemSet = aDlg->GetOutputItemSet();
             if(pOutItemSet)
             {
                 ControllerLockGuardUNO aCLGuard( getModel());
@@ -822,8 +822,8 @@ void ChartController::executeDispatch_View3D()
 
         //open dialog
         SolarMutexGuard aSolarGuard;
-        View3DDialog aDlg( m_pChartWindow, getModel(), m_pDrawModelWrapper->GetColorList() );
-        if( aDlg.Execute() == RET_OK )
+        VclPtr<View3DDialog> aDlg(new View3DDialog( m_pChartWindow, getModel(), m_pDrawModelWrapper->GetColorList() ));
+        if( aDlg->Execute() == RET_OK )
             aUndoGuard.commit();
     }
     catch(const uno::RuntimeException& e)
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 38a4741..bf1f86e 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -31,13 +31,15 @@ public:
 
     virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
 
-    bool VisitFieldDecl(const FieldDecl * decl);
+    bool VisitVarDecl(const VarDecl *);
 
-    bool VisitParmVarDecl(ParmVarDecl const * decl);
+    bool VisitFieldDecl(const FieldDecl *);
 
-    bool VisitFunctionDecl( const FunctionDecl* var );
+    bool VisitParmVarDecl(const ParmVarDecl *);
 
-    bool VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorDecl);
+    bool VisitFunctionDecl(const FunctionDecl *);
+
+    bool VisitCXXDestructorDecl(const CXXDestructorDecl *);
 
 private:
     bool isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodDecl);
@@ -150,6 +152,30 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
 }
 
 
+bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
+    if (ignoreLocation(pVarDecl)) {
+        return true;
+    }
+    const RecordType *recordType = pVarDecl->getType()->getAs<RecordType>();
+    if (recordType == nullptr) {
+        return true;
+    }
+    const CXXRecordDecl *recordDecl = dyn_cast<CXXRecordDecl>(recordType->getDecl());
+    if (recordDecl == nullptr) {
+        return true;
+    }
+
+    // check if this field is derived from Window
+    if (isDerivedFromWindow(recordDecl)) {
+        report(
+            DiagnosticsEngine::Warning,
+            "vcl::Window subclass allocated on stack, should be allocated via VclPtr or via *.",
+            pVarDecl->getLocation())
+          << pVarDecl->getSourceRange();
+    }
+    return true;
+}
+
 bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) {
     if (ignoreLocation(fieldDecl)) {
         return true;
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 97a0bb6..125390c 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2355,9 +2355,9 @@ short SvxMenuConfigPage::QueryReset()
 
     OUString label = replaceSaveInName( msg, saveInName );
 
-    QueryBox qbox( this, WB_YES_NO, label );
+    VclPtr<QueryBox> qbox(new QueryBox( this, WB_YES_NO, label ));
 
-    return qbox.Execute();
+    return qbox->Execute();
 }
 
 IMPL_LINK( SvxMenuConfigPage, SelectMenu, ListBox *, pBox )
@@ -2996,10 +2996,10 @@ bool SvxToolbarConfigPage::DeleteSelectedContent()
         if ( m_pContentsListBox->GetEntryCount() == 0 &&
              GetTopLevelSelection()->IsDeletable() )
         {
-            MessageDialog qbox(this,
-                CUI_RES(RID_SXVSTR_CONFIRM_DELETE_TOOLBAR), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+            VclPtr<MessageDialog> qbox(new MessageDialog(this,
+                CUI_RES(RID_SXVSTR_CONFIRM_DELETE_TOOLBAR), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO));
 
-            if ( qbox.Execute() == RET_YES )
+            if ( qbox->Execute() == RET_YES )
             {
                 DeleteSelectedTopLevel();
             }
@@ -3076,10 +3076,10 @@ IMPL_LINK( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton )
         }
         case ID_DEFAULT_STYLE:
         {
-            MessageDialog qbox(this,
-                CUI_RES(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+            VclPtr<MessageDialog> qbox(new MessageDialog(this,
+                CUI_RES(RID_SVXSTR_CONFIRM_RESTORE_DEFAULT), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO));
 
-            if ( qbox.Execute() == RET_YES )
+            if ( qbox->Execute() == RET_YES )
             {
                 ToolbarSaveInData* pSaveInData_ =
                     static_cast<ToolbarSaveInData*>(GetSaveInData());
@@ -4309,9 +4309,9 @@ short SvxToolbarConfigPage::QueryReset()
 
     OUString label = replaceSaveInName( msg, saveInName );
 
-    QueryBox qbox( this, WB_YES_NO, label );
+    VclPtr<QueryBox> qbox(new QueryBox( this, WB_YES_NO, label ));
 
-    return qbox.Execute();
+    return qbox->Execute();
 }
 
 IMPL_LINK( SvxToolbarConfigPage, SelectToolbar, ListBox *, pBox )
@@ -5230,8 +5230,8 @@ void SvxIconSelectorDialog::ImportGraphics(
             message += newLine;
         }
 
-        SvxIconChangeDialog aDialog(this, message);
-        aDialog.Execute();
+        VclPtr<SvxIconChangeDialog> aDialog(new SvxIconChangeDialog(this, message));
+        aDialog->Execute();
     }
 }
 
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index d3e4a72..c0c1406 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -2034,9 +2034,9 @@ IMPL_LINK( SpellDialog, HandleHyperlink, FixedHyperlink*, pHyperlink )
         uno::Any exc( ::cppu::getCaughtException() );
         OUString msg( ::comphelper::anyToString( exc ) );
         const SolarMutexGuard guard;
-        MessageDialog aErrorBox(NULL, msg);
-        aErrorBox.SetText(sTitle);
-        aErrorBox.Execute();
+        VclPtr<MessageDialog> aErrorBox(new MessageDialog(NULL, msg));
+        aErrorBox->SetText(sTitle);
+        aErrorBox->Execute();
     }
 
     return 1;
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 7e19f10..d885f97 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -127,9 +127,9 @@ IMPL_LINK( AboutDialog, HandleClick, PushButton*, pButton )
         Any exc( ::cppu::getCaughtException() );
         OUString msg( ::comphelper::anyToString( exc ) );
         const SolarMutexGuard guard;
-        MessageDialog aErrorBox(NULL, msg);
-        aErrorBox.SetText( GetText() );
-        aErrorBox.Execute();
+        VclPtr<MessageDialog> aErrorBox(new MessageDialog(NULL, msg));
+        aErrorBox->SetText( GetText() );
+        aErrorBox->Execute();
     }
 
     return 1;
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index 301e9f1..9606cc9 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -1512,10 +1512,10 @@ void SAL_CALL ColorPicker::setTitle( const OUString& sTitle ) throw (RuntimeExce
 
 sal_Int16 SAL_CALL ColorPicker::execute(  ) throw (RuntimeException, std::exception)
 {
-    ColorPickerDialog aDlg( VCLUnoHelper::GetWindow( mxParent ), mnColor, mnMode );
-    sal_Int16 ret = aDlg.Execute();
+    VclPtr<ColorPickerDialog> aDlg(new ColorPickerDialog( VCLUnoHelper::GetWindow( mxParent ), mnColor, mnMode ));
+    sal_Int16 ret = aDlg->Execute();
     if( ret )
-        mnColor = aDlg.GetColor();
+        mnColor = aDlg->GetColor();
 
     return ret;
 }
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index edf2c35..92c276c 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -556,8 +556,8 @@ IMPL_LINK_NOARG(GalleryIdDialog, ClickOkHdl)
             aStr += pInfo->GetThemeName();
             aStr += ")";
 
-            InfoBox aBox( this, aStr );
-            aBox.Execute();
+            VclPtr<InfoBox> aBox(new InfoBox( this, aStr ));
+            aBox->Execute();
             m_pLbResName->GrabFocus();
             bDifferentThemeExists = true;
         }
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index a77bc2c..c514977 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -732,8 +732,8 @@ namespace svx
 
     IMPL_LINK_NOARG( HangulHanjaConversionDialog, OnOption )
     {
-        HangulHanjaOptionsDialog        aOptDlg( this );
-        aOptDlg.Execute();
+        VclPtr<HangulHanjaOptionsDialog>        aOptDlg( new HangulHanjaOptionsDialog(this) );
+        aOptDlg->Execute();
         m_aOptionsChangedLink.Call( this );
         return 0L;
     }
@@ -1012,9 +1012,9 @@ namespace svx
     IMPL_LINK_NOARG(HangulHanjaOptionsDialog, NewDictHdl)
     {
         OUString                    aName;
-        HangulHanjaNewDictDialog    aNewDlg( this );
-        aNewDlg.Execute();
-        if( aNewDlg.GetName( aName ) )
+        VclPtr<HangulHanjaNewDictDialog>    aNewDlg( new HangulHanjaNewDictDialog(this) );
+        aNewDlg->Execute();
+        if( aNewDlg->GetName( aName ) )
         {
             if( m_xConversionDictionaryList.is() )
             {
@@ -1048,8 +1048,8 @@ namespace svx
         DBG_ASSERT( pEntry, "+HangulHanjaEditDictDialog::EditDictHdl(): call of edit should not be possible with no selection!" );
         if( pEntry )
         {
-            HangulHanjaEditDictDialog   aEdDlg( this, m_aDictList, m_pDictsLB->GetSelectEntryPos() );
-            aEdDlg.Execute();
+            VclPtr<HangulHanjaEditDictDialog>   aEdDlg( new HangulHanjaEditDictDialog(this, m_aDictList, m_pDictsLB->GetSelectEntryPos()) );
+            aEdDlg->Execute();
         }
         return 0L;
     }
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index a18841e..610c5ea 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -266,8 +266,8 @@ bool SvxHyperlinkNewDocTp::AskApply()
     bool bRet = ImplGetURLObject( m_pCbbPath->GetText(), m_pCbbPath->GetBaseURL(), aINetURLObject );
     if ( !bRet )
     {
-        WarningBox aWarning( this, WB_OK, CUI_RESSTR(RID_SVXSTR_HYPDLG_NOVALIDFILENAME) );
-        aWarning.Execute();
+        VclPtr<WarningBox> aWarning(new WarningBox( this, WB_OK, CUI_RESSTR(RID_SVXSTR_HYPDLG_NOVALIDFILENAME) ) );
+        aWarning->Execute();
     }
     return bRet;
 }
@@ -316,8 +316,8 @@ void SvxHyperlinkNewDocTp::DoApply ()
 
                 if( bOk )
                 {
-                    WarningBox aWarning( this, WB_YES_NO, CUI_RESSTR(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE) );
-                    bCreate = aWarning.Execute() == BUTTON_YES;
+                    VclPtr<WarningBox> aWarning(new WarningBox( this, WB_YES_NO, CUI_RESSTR(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE) ));
+                    bCreate = aWarning->Execute() == BUTTON_YES;
                 }
             }
 
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index e31ab01..35dedd6 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -325,10 +325,10 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl)
         bool bIsInputEnabled = GetParent()->IsInputEnabled();
         if ( bIsInputEnabled )
             GetParent()->EnableInput( false );
-        SfxMacroAssignDlg aDlg( this, mxDocumentFrame, *pItemSet );
+        VclPtr<SfxMacroAssignDlg> aDlg(new SfxMacroAssignDlg( this, mxDocumentFrame, *pItemSet ));
 
         // add events
-        SfxMacroTabPage *pMacroPage = static_cast<SfxMacroTabPage*>( aDlg.GetTabPage() );
+        SfxMacroTabPage *pMacroPage = static_cast<SfxMacroTabPage*>( aDlg->GetTabPage() );
 
         if ( pHyperlinkItem->GetMacroEvents() & HYPERDLG_EVENT_MOUSEOVER_OBJECT )
             pMacroPage->AddEvent( OUString( CUI_RESSTR(RID_SVXSTR_HYPDLG_MACROACT1) ),
@@ -344,11 +344,11 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl)
             GetParent()->EnableInput( true );
         // execute dlg
         DisableClose( true );
-        short nRet = aDlg.Execute();
+        short nRet = aDlg->Execute();
         DisableClose( false );
         if ( RET_OK == nRet )
         {
-            const SfxItemSet* pOutSet = aDlg.GetOutputItemSet();
+            const SfxItemSet* pOutSet = aDlg->GetOutputItemSet();
             const SfxPoolItem* pItem;
             if( SfxItemState::SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, false, &pItem ))
             {
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index ec2e8b7..6649a44 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -423,9 +423,9 @@ IMPL_LINK( SvBaseLinksDlg, BreakLinkClickHdl, PushButton *, pPushButton )
         if( !xLink.Is() )
             return 0;
 
-        QueryBox aBox( this, WB_YES_NO | WB_DEF_YES, Closelinkmsg() );
+        VclPtr<QueryBox> aBox(new QueryBox( this, WB_YES_NO | WB_DEF_YES, Closelinkmsg() ));
 
-        if( RET_YES == aBox.Execute() )
+        if( RET_YES == aBox->Execute() )
         {
             m_pTbLinks->GetModel()->Remove( m_pTbLinks->GetEntry( nPos ) );
 
@@ -454,9 +454,9 @@ IMPL_LINK( SvBaseLinksDlg, BreakLinkClickHdl, PushButton *, pPushButton )
     }
     else
     {
-        QueryBox aBox( this, WB_YES_NO | WB_DEF_YES, CloselinkmsgMulti() );
+        VclPtr<QueryBox> aBox(new QueryBox( this, WB_YES_NO | WB_DEF_YES, CloselinkmsgMulti() ));
 
-        if( RET_YES == aBox.Execute() )
+        if( RET_YES == aBox->Execute() )
         {
 
             SvBaseLinkMemberList aLinkList;
diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx
index 683d4e1..ccba000 100644
--- a/cui/source/dialogs/passwdomdlg.cxx
+++ b/cui/source/dialogs/passwdomdlg.cxx
@@ -101,9 +101,9 @@ IMPL_LINK( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, OKButton *, EMPTYARG
             m_pPasswdToModifyED->GetText().isEmpty();
     if (bInvalidState)
     {
-        MessageDialog aErrorBox(m_pParent,
-            m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2);
-        aErrorBox.Execute();
+        VclPtr<MessageDialog> aErrorBox(new MessageDialog(m_pParent,
+            m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2));
+        aErrorBox->Execute();
     }
     else // check for mismatched passwords...
     {
@@ -112,8 +112,8 @@ IMPL_LINK( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, OKButton *, EMPTYARG
         const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1);
         if (nMismatch > 0)
         {
-            MessageDialog aErrorBox(m_pParent, nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch);
-            aErrorBox.Execute();
+            VclPtr<MessageDialog> aErrorBox(new MessageDialog(m_pParent, nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch));
+            aErrorBox->Execute();
 
             Edit* pEdit = !bToOpenMatch ? m_pPasswdToOpenED : m_pPasswdToModifyED;
             Edit* pRepeatEdit = !bToOpenMatch? m_pReenterPasswdToOpenED : m_pReenterPasswdToModifyED;
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index d5c64a1..fa25fdf 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -909,9 +909,9 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry )
                         bValid = false;
                         OUString aError( m_createErrStr );
                         aError += m_createDupStr;
-                        MessageDialog aErrorBox(static_cast<vcl::Window*>(this), aError);
-                        aErrorBox.SetText( m_createErrTitleStr );
-                        aErrorBox.Execute();
+                        VclPtr<MessageDialog> aErrorBox(new MessageDialog(static_cast<vcl::Window*>(this), aError));
+                        aErrorBox->SetText( m_createErrTitleStr );
+                        aErrorBox->Execute();
                         xNewDlg->SetObjectName( aNewName );
                         break;
                     }
@@ -991,9 +991,9 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry )
     {
         //ISSUE L10N & message from exception?
         OUString aError( m_createErrStr );
-        MessageDialog aErrorBox(static_cast<vcl::Window*>(this), aError);
-        aErrorBox.SetText( m_createErrTitleStr );
-        aErrorBox.Execute();
+        VclPtr<MessageDialog> aErrorBox(new MessageDialog(static_cast<vcl::Window*>(this), aError));
+        aErrorBox->SetText( m_createErrTitleStr );
+        aErrorBox->Execute();
     }
 }
 
@@ -1067,9 +1067,9 @@ void SvxScriptOrgDialog::renameEntry( SvTreeListEntry* pEntry )
     {
         //ISSUE L10N & message from exception?
         OUString aError( m_renameErrStr );
-        MessageDialog aErrorBox(static_cast<vcl::Window*>(this), aError);
-        aErrorBox.SetText( m_renameErrTitleStr );
-        aErrorBox.Execute();
+        VclPtr<MessageDialog> aErrorBox(new MessageDialog(static_cast<vcl::Window*>(this), aError));
+        aErrorBox->SetText( m_renameErrTitleStr );
+        aErrorBox->Execute();
     }
 }
 void SvxScriptOrgDialog::deleteEntry( SvTreeListEntry* pEntry )
@@ -1078,9 +1078,9 @@ void SvxScriptOrgDialog::deleteEntry( SvTreeListEntry* pEntry )
     Reference< browse::XBrowseNode > node = getBrowseNode( pEntry );
     // ISSUE L10N string & can we centre list?
     OUString aQuery = m_delQueryStr + getListOfChildren( node, 0 );
-    MessageDialog aQueryBox(static_cast<vcl::Window*>(this), aQuery, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
-    aQueryBox.SetText( m_delQueryTitleStr );
-    if ( aQueryBox.Execute() == RET_NO )
+    VclPtr<MessageDialog> aQueryBox(new MessageDialog(static_cast<vcl::Window*>(this), aQuery, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO));
+    aQueryBox->SetText( m_delQueryTitleStr );
+    if ( aQueryBox->Execute() == RET_NO )
     {
         return;
     }
@@ -1113,9 +1113,9 @@ void SvxScriptOrgDialog::deleteEntry( SvTreeListEntry* pEntry )
     else
     {
         //ISSUE L10N & message from exception?
-        MessageDialog aErrorBox(static_cast<vcl::Window*>(this), m_delErrStr);
-        aErrorBox.SetText( m_delErrTitleStr );
-        aErrorBox.Execute();
+        VclPtr<MessageDialog> aErrorBox(new MessageDialog(static_cast<vcl::Window*>(this), m_delErrStr));
+        aErrorBox->SetText( m_delErrTitleStr );
+        aErrorBox->Execute();
     }
 
 }
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index 4b2d076..8dd84ef 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -274,8 +274,8 @@ IMPL_LINK_NOARG(DbRegistrationOptionsPage, DeleteHdl)
     SvTreeListEntry* pEntry = pPathBox->FirstSelected();
     if ( pEntry )
     {
-        MessageDialog aQuery(this, CUI_RES(RID_SVXSTR_QUERY_DELETE_CONFIRM), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
-        if ( aQuery.Execute() == RET_YES )
+        VclPtr<MessageDialog> aQuery(new MessageDialog(this, CUI_RES(RID_SVXSTR_QUERY_DELETE_CONFIRM), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO));
+        if ( aQuery->Execute() == RET_YES )
             pPathBox->GetModel()->Remove(pEntry);
     }
     return 0;
@@ -410,15 +410,15 @@ void DbRegistrationOptionsPage::insertNewEntry( const OUString& _sName,const OUS
 
 void DbRegistrationOptionsPage::openLinkDialog(const OUString& _sOldName,const OUString& _sOldLocation,SvTreeListEntry* _pEntry)
 {
-    ODocumentLinkDialog aDlg(this,_pEntry == NULL);
+    VclPtr<ODocumentLinkDialog> aDlg(new ODocumentLinkDialog(this,_pEntry == NULL));
 
-    aDlg.setLink(_sOldName,_sOldLocation);
-    aDlg.setNameValidator(LINK( this, DbRegistrationOptionsPage, NameValidator ) );
+    aDlg->setLink(_sOldName,_sOldLocation);
+    aDlg->setNameValidator(LINK( this, DbRegistrationOptionsPage, NameValidator ) );
 
-    if ( aDlg.Execute() == RET_OK )
+    if ( aDlg->Execute() == RET_OK )
     {
         OUString sNewName,sNewLocation;
-        aDlg.getLink(sNewName,sNewLocation);
+        aDlg->getLink(sNewName,sNewLocation);
         if ( _pEntry == NULL || sNewName != _sOldName || sNewLocation != _sOldLocation )
         {
             if ( _pEntry )
diff --git a/cui/source/options/doclinkdialog.cxx b/cui/source/options/doclinkdialog.cxx
index 068f361..2d0f70f 100644
--- a/cui/source/options/doclinkdialog.cxx
+++ b/cui/source/options/doclinkdialog.cxx
@@ -116,8 +116,8 @@ namespace svx
         {
             OUString sMsg = CUI_RES(STR_LINKEDDOC_DOESNOTEXIST);
             sMsg = sMsg.replaceFirst("$file$", m_pURL->GetText());
-            MessageDialog aError(this, sMsg);
-            aError.Execute();
+            VclPtr<MessageDialog> aError(new MessageDialog(this, sMsg));
+            aError->Execute();
             return 0L;
         } // if (!bFileExists)
         INetURLObject aURL( sURL );
@@ -125,8 +125,8 @@ namespace svx
         {
             OUString sMsg = CUI_RES(STR_LINKEDDOC_NO_SYSTEM_FILE);
             sMsg = sMsg.replaceFirst("$file$", m_pURL->GetText());
-            MessageDialog aError(this, sMsg);
-            aError.Execute();
+            VclPtr<MessageDialog> aError(new MessageDialog(this, sMsg));
+            aError->Execute();
             return 0L;
         }
 
@@ -137,8 +137,8 @@ namespace svx
             {
                 OUString sMsg = CUI_RES(STR_NAME_CONFLICT);
                 sMsg = sMsg.replaceFirst("$file$", sCurrentText);
-                MessageDialog aError(this, sMsg, VCL_MESSAGE_INFO);
-                aError.Execute();
+                VclPtr<MessageDialog> aError(new MessageDialog(this, sMsg, VCL_MESSAGE_INFO));
+                aError->Execute();
 
                 m_pName->SetSelection(Selection(0,sCurrentText.getLength()));
                 m_pName->GrabFocus();
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
index d1aa210..8f8fd97 100644
--- a/cui/source/options/optchart.cxx
+++ b/cui/source/options/optchart.cxx
@@ -221,9 +221,9 @@ IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, PushButton*, pButton )
     {
         OSL_ENSURE(pColorConfig->GetColorList().size() > 1, "don't delete the last chart color");
 
-        MessageDialog aQuery(pButton, "QueryDeleteChartColorDialog",
-            "cui/ui/querydeletechartcolordialog.ui");
-        if (RET_YES == aQuery.Execute())
+        VclPtr<MessageDialog> aQuery(new MessageDialog(pButton, "QueryDeleteChartColorDialog",
+            "cui/ui/querydeletechartcolordialog.ui"));
+        if (RET_YES == aQuery->Execute())
         {
             pColorConfig->GetColorList().remove( nIndex  );
 
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index bf4a148d..66fa298 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -545,12 +545,12 @@ void ColorConfigWindow_Impl::CreateEntries()
     long nCheckBoxLabelOffset = 0;
     {
         OUString sSampleText("X");
-        CheckBox aCheckBox(this);
-        FixedText aFixedText(this);
-        aCheckBox.SetText(sSampleText);
-        aFixedText.SetText(sSampleText);
-        Size aCheckSize(aCheckBox.CalcMinimumSize(0x7fffffff));
-        Size aFixedSize(aFixedText.CalcMinimumSize(0x7fffffff));
+        VclPtr<CheckBox> aCheckBox(new CheckBox(this));
+        VclPtr<FixedText> aFixedText(new FixedText(this));
+        aCheckBox->SetText(sSampleText);
+        aFixedText->SetText(sSampleText);
+        Size aCheckSize(aCheckBox->CalcMinimumSize(0x7fffffff));
+        Size aFixedSize(aFixedText->CalcMinimumSize(0x7fffffff));
         nCheckBoxLabelOffset = aCheckSize.Width() - aFixedSize.Width();
     }
 
@@ -620,13 +620,13 @@ void ColorConfigWindow_Impl::SetAppearance ()
     OSL_ENSURE( vEntries.size() >= sizeof vEntryInfo / sizeof vEntryInfo[0], "wrong number of helpIDs for color listboxes" );
 
     // creating a sample color listbox with the color entries
-    ColorListBox aSampleColorList(this);
+    VclPtr<ColorListBox> aSampleColorList(new ColorListBox(this));
     {
         XColorListRef const xColorTable = XColorList::CreateStdColorList();
         for (sal_Int32 i = 0; i != xColorTable->Count(); ++i)
         {
             XColorEntry& rEntry = *xColorTable->GetColor(i);
-            aSampleColorList.InsertEntry(rEntry.GetColor(), rEntry.GetName());
+            aSampleColorList->InsertEntry(rEntry.GetColor(), rEntry.GetName());
         }
     }
 
@@ -634,7 +634,7 @@ void ColorConfigWindow_Impl::SetAppearance ()
     for (size_t i = 0; i != vEntries.size(); ++i)
     {
         // appearance
-        vEntries[i]->SetAppearance(aTransparentWall, aSampleColorList);
+        vEntries[i]->SetAppearance(aTransparentWall, *aSampleColorList.get());
     }
 }
 
@@ -1187,9 +1187,9 @@ IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, PushButton*, pButton )
     else
     {
         DBG_ASSERT(m_pColorSchemeLB->GetEntryCount() > 1, "don't delete the last scheme");
-        MessageDialog aQuery(pButton, CUI_RES(RID_SVXSTR_COLOR_CONFIG_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
-        aQuery.SetText(CUI_RES(RID_SVXSTR_COLOR_CONFIG_DELETE_TITLE));
-        if(RET_YES == aQuery.Execute())
+        VclPtr<MessageDialog> aQuery(new MessageDialog(pButton, CUI_RES(RID_SVXSTR_COLOR_CONFIG_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO));
+        aQuery->SetText(CUI_RES(RID_SVXSTR_COLOR_CONFIG_DELETE_TITLE));
+        if(RET_YES == aQuery->Execute())
         {
             OUString sDeleteScheme(m_pColorSchemeLB->GetSelectEntry());
             m_pColorSchemeLB->RemoveEntry(m_pColorSchemeLB->GetSelectEntryPos());
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index 111b14d..c25d8e5 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -445,12 +445,12 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl)
 
     if ( nLang != nOldLang )
     {
-        MessageDialog aBox(this, CUI_RES( RID_SVXSTR_CONFIRM_SET_LANGUAGE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
-        OUString sTxt(aBox.get_primary_text());
+        VclPtr<MessageDialog> aBox(new MessageDialog(this, CUI_RES( RID_SVXSTR_CONFIRM_SET_LANGUAGE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO));
+        OUString sTxt(aBox->get_primary_text());
         sTxt = sTxt.replaceFirst( "%1", pAllDictsLB->GetSelectEntry() );
-        aBox.set_primary_text(sTxt);
+        aBox->set_primary_text(sTxt);
 
-        if ( aBox.Execute() == RET_YES )
+        if ( aBox->Execute() == RET_YES )
         {
             xDic->setLocale( LanguageTag::convertToLocale( nLang ) );
             bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index ab6be47..85575bf 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1284,8 +1284,8 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
             xProp->setPropertyValue(sUserLocaleKey, makeAny(aLangString));
             Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges();
             // display info
-            MessageDialog aBox(this, CUI_RES(RID_SVXSTR_LANGUAGE_RESTART), VCL_MESSAGE_INFO);
-            aBox.Execute();
+            VclPtr<MessageDialog> aBox(new MessageDialog(this, CUI_RES(RID_SVXSTR_LANGUAGE_RESTART), VCL_MESSAGE_INFO));
+            aBox->Execute();
 
             // tell quickstarter to stop being a veto listener
 
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index bdde1b9..a0a7f93 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -661,8 +661,8 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, SavePasswordHdl)
         }
         else
         {
-            QueryBox aQuery( this, WB_YES_NO|WB_DEF_NO, m_sPasswordStoringDeactivateStr );
-            sal_uInt16 nRet = aQuery.Execute();
+            VclPtr<QueryBox> aQuery(new QueryBox( this, WB_YES_NO|WB_DEF_NO, m_sPasswordStoringDeactivateStr ));
+            sal_uInt16 nRet = aQuery->Execute();
 
             if( RET_YES == nRet )
             {
@@ -758,8 +758,8 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, ShowPasswordsHdl)
 
         if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->authorizateWithMasterPassword( Reference< task::XInteractionHandler>() ) )
         {
-            svx::WebConnectionInfoDialog aDlg( this );
-            aDlg.Execute();
+            VclPtr<svx::WebConnectionInfoDialog> aDlg( new svx::WebConnectionInfoDialog(this) );
+            aDlg->Execute();
         }
     }
     catch (const Exception&)
@@ -777,8 +777,8 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, CertPathPBHdl)
 
     if (nRet == RET_OK && sOrig != mpCertPathDlg->getDirectory())
     {
-        MessageDialog aWarnBox(this, CUI_RES(RID_SVXSTR_OPTIONS_RESTART), VCL_MESSAGE_INFO);
-        aWarnBox.Execute();
+        VclPtr<MessageDialog> aWarnBox(new MessageDialog(this, CUI_RES(RID_SVXSTR_OPTIONS_RESTART), VCL_MESSAGE_INFO));
+        aWarnBox->Execute();
     }
 
     return 0;
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 48c97c3..9f216f7 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -326,8 +326,8 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ParameterHdl_Impl)
             (void)eErr;
             if ( bRunning )
             {
-                MessageDialog aWarnBox( this, CUI_RES( RID_SVXSTR_OPTIONS_RESTART ), VCL_MESSAGE_INFO );
-                aWarnBox.Execute();
+                VclPtr<MessageDialog> aWarnBox(new MessageDialog( this, CUI_RES( RID_SVXSTR_OPTIONS_RESTART ), VCL_MESSAGE_INFO ));
+                aWarnBox->Execute();
             }
         }
     }
@@ -371,8 +371,8 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ClassPathHdl_Impl)
             (void)eErr;
             if ( bRunning )
             {
-                MessageDialog aWarnBox( this, CUI_RES( RID_SVXSTR_OPTIONS_RESTART ), VCL_MESSAGE_INFO );
-                aWarnBox.Execute();
+                VclPtr<MessageDialog> aWarnBox(new MessageDialog( this, CUI_RES( RID_SVXSTR_OPTIONS_RESTART ), VCL_MESSAGE_INFO ));
+                aWarnBox->Execute();
             }
         }
     }
@@ -620,13 +620,13 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
     }
     else if ( JFW_E_NOT_RECOGNIZED == eErr )
     {
-        MessageDialog aErrBox( this, CUI_RES( RID_SVXSTR_JRE_NOT_RECOGNIZED ) );
-        aErrBox.Execute();
+        VclPtr<MessageDialog> aErrBox(new MessageDialog( this, CUI_RES( RID_SVXSTR_JRE_NOT_RECOGNIZED ) ));
+        aErrBox->Execute();
     }
     else if ( JFW_E_FAILED_VERSION == eErr )
     {
-        MessageDialog aErrBox( this, CUI_RES( RID_SVXSTR_JRE_FAILED_VERSION ) );
-        aErrBox.Execute();
+        VclPtr<MessageDialog> aErrBox(new MessageDialog( this, CUI_RES( RID_SVXSTR_JRE_FAILED_VERSION ) ));
+        aErrBox->Execute();
     }
 
     if ( bStartAgain )
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index ad0865d..1dfcedb 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -1594,8 +1594,8 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
             pLinguData = new SvxLinguData_Impl;
 
         SvxLinguData_Impl   aOldLinguData( *pLinguData );
-        SvxEditModulesDlg   aDlg( this, *pLinguData );
-        if (aDlg.Execute() != RET_OK)
+        VclPtr<SvxEditModulesDlg>   aDlg(new SvxEditModulesDlg( this, *pLinguData ));
+        if (aDlg->Execute() != RET_OK)
             *pLinguData = aOldLinguData;
 
         // evaluate new status of 'bConfigured' flag
@@ -1671,9 +1671,9 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
     }
     else if (m_pLinguDicsDelPB == pBtn)
     {
-        MessageDialog aQuery(this, "QueryDeleteDictionaryDialog",
-            "cui/ui/querydeletedictionarydialog.ui");
-        if (RET_NO == aQuery.Execute())
+        VclPtr<MessageDialog> aQuery(new MessageDialog(this, "QueryDeleteDictionaryDialog",
+            "cui/ui/querydeletedictionarydialog.ui"));
+        if (RET_NO == aQuery->Execute())
             return 0;
 
         SvTreeListEntry *pEntry = m_pLinguDicsCLB->GetCurEntry();
@@ -1743,11 +1743,11 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
             if(aData.HasNumericValue())
             {
                 sal_uInt16 nRID = aData.GetEntryId();
-                OptionsBreakSet aDlg( this, nRID );
-                aDlg.GetNumericFld().SetValue( aData.GetNumericValue() );
-                if (RET_OK == aDlg.Execute() )
+                VclPtr<OptionsBreakSet> aDlg( new OptionsBreakSet(this, nRID) );
+                aDlg->GetNumericFld().SetValue( aData.GetNumericValue() );
+                if (RET_OK == aDlg->Execute() )
                 {
-                    long nVal = static_cast<long>(aDlg.GetNumericFld().GetValue());
+                    long nVal = static_cast<long>(aDlg->GetNumericFld().GetValue());
                     if (-1 != nVal && aData.GetNumericValue() != nVal)
                     {
                         aData.SetNumericValue( (sal_uInt8)nVal ); //! sets IsModified !
diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx
index 9856e5c..dcb0043 100644
--- a/cui/source/options/optopencl.cxx
+++ b/cui/source/options/optopencl.cxx
@@ -220,10 +220,10 @@ IMPL_LINK(ListEntryDialog, EditModifiedHdl, Edit*, pEdit)
 
 void openListDialog(SvxOpenCLTabPage* pTabPage, OpenCLConfig::ImplMatcher& rEntry, const OString& rTag)
 {
-    ListEntryDialog aDlg(pTabPage, rEntry, rTag);
+    VclPtr<ListEntryDialog> aDlg(new ListEntryDialog(pTabPage, rEntry, rTag));
 
-    if (aDlg.Execute() == RET_OK)
-        rEntry = aDlg.maEntry;
+    if (aDlg->Execute() == RET_OK)
+        rEntry = aDlg->maEntry;
 }
 
 const OpenCLConfig::ImplMatcher& findCurrentEntry(OpenCLConfig::ImplMatcherSet& rSet, ListBox* pListBox)
diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx
index 4c5f287..c5c9297 100644
--- a/cui/source/options/personalization.cxx
+++ b/cui/source/options/personalization.cxx
@@ -437,11 +437,11 @@ void SvxPersonalizationTabPage::LoadExtensionThemes()
 
 IMPL_LINK( SvxPersonalizationTabPage, SelectPersona, PushButton*, /*pButton*/ )
 {
-    SelectPersonaDialog aDialog( NULL );
+    VclPtr<SelectPersonaDialog> aDialog( new SelectPersonaDialog(NULL) );
 
-    while ( aDialog.Execute() == RET_OK )
+    while ( aDialog->Execute() == RET_OK )
     {
-        OUString aPersonaSetting( aDialog.GetAppliedPersonaSetting() );
+        OUString aPersonaSetting( aDialog->GetAppliedPersonaSetting() );
         if ( !aPersonaSetting.isEmpty() )
         {
             SetPersonaSettings( aPersonaSetting );
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 88bd625..129d38e 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -717,11 +717,11 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl)
     else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos )
     {
         // dialog for per cent settings
-        OfaAutoFmtPrcntSet aDlg(this);
-        aDlg.GetPrcntFld().SetValue(nPercent);
-        if(RET_OK == aDlg.Execute())
+        VclPtr<OfaAutoFmtPrcntSet> aDlg(new OfaAutoFmtPrcntSet(this));
+        aDlg->GetPrcntFld().SetValue(nPercent);
+        if(RET_OK == aDlg->Execute())
         {
-            nPercent = (sal_uInt16)aDlg.GetPrcntFld().GetValue();
+            nPercent = (sal_uInt16)aDlg->GetPrcntFld().GetValue();
             sMargin = " " +
                 unicode::formatPercent(nPercent, Application::GetSettings().GetUILanguageTag());
         }
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index 3ceb4e6..06aa600 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -681,17 +681,17 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound )
         // display original size
         const FieldUnit eMetric = GetModuleFieldUnit( GetItemSet() );
 
-        MetricField aFld(this, WB_HIDE);
-        SetFieldUnit( aFld, eMetric );
-        aFld.SetDecimalDigits( m_pWidthMF->GetDecimalDigits() );
-        aFld.SetMax( LONG_MAX - 1 );
-
-        aFld.SetValue( aFld.Normalize( aOrigSize.Width() ), eUnit );
-        OUString sTemp = aFld.GetText();
-        aFld.SetValue( aFld.Normalize( aOrigSize.Height() ), eUnit );
+        VclPtr<MetricField> aFld(new MetricField(this, WB_HIDE));
+        SetFieldUnit( *aFld.get(), eMetric );
+        aFld->SetDecimalDigits( m_pWidthMF->GetDecimalDigits() );
+        aFld->SetMax( LONG_MAX - 1 );
+
+        aFld->SetValue( aFld->Normalize( aOrigSize.Width() ), eUnit );
+        OUString sTemp = aFld->GetText();
+        aFld->SetValue( aFld->Normalize( aOrigSize.Height() ), eUnit );
         // multiplication sign (U+00D7)
         sTemp += OUString( sal_Unicode (0x00D7) );
-        sTemp += aFld.GetText();
+        sTemp += aFld->GetText();
 
         if ( aOrigPixelSize.Width() && aOrigPixelSize.Height() ) {
              sal_Int32 ax = sal_Int32(floor((float)aOrigPixelSize.Width() /
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index c200fa8..5f82bc9 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -716,10 +716,10 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickModifyHdl_Impl)
             }
             else
             {
-                MessageDialog aBox( GetParentDialog()
+                VclPtr<MessageDialog> aBox( new MessageDialog(GetParentDialog()
                                    ,"DuplicateNameDialog"
-                                   ,"cui/ui/queryduplicatedialog.ui");
-                aBox.Execute();
+                                   ,"cui/ui/queryduplicatedialog.ui"));
+                aBox->Execute();
             }
         }
     }
@@ -734,9 +734,9 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickDeleteHdl_Impl)
 
     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     {
-        MessageDialog aQueryBox( GetParentDialog(),"AskDelBitmapDialog","cui/ui/querydeletebitmapdialog.ui");
+        VclPtr<MessageDialog> aQueryBox(new MessageDialog( GetParentDialog(),"AskDelBitmapDialog","cui/ui/querydeletebitmapdialog.ui" ));
 
-        if( aQueryBox.Execute() == RET_YES )
+        if( aQueryBox->Execute() == RET_YES )
         {
             delete pBitmapList->Remove( nPos );
             m_pLbBitmaps->RemoveEntry( nPos );
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index dc3b494..5ebf479 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -682,10 +682,10 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl)
     // if yes, it is repeated and a new name is demanded
     if ( !bDifferent )
     {
-        MessageDialog aWarningBox( GetParentDialog()
+        VclPtr<MessageDialog> aWarningBox(new MessageDialog( GetParentDialog()
                                    ,"DuplicateNameDialog"
-                                   ,"cui/ui/queryduplicatedialog.ui");
-        aWarningBox.Execute();
+                                   ,"cui/ui/queryduplicatedialog.ui"));
+        aWarningBox->Execute();
 
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc ));
@@ -705,7 +705,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl)
             if( bDifferent )
                 bLoop = false;
             else
-                aWarningBox.Execute();
+                aWarningBox->Execute();
         }
     }
 
@@ -753,10 +753,10 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickModifyHdl_Impl)
         // if yes, it is repeated and a new name is demanded
         if ( !bDifferent )
         {
-            MessageDialog aWarningBox( GetParentDialog()
+            VclPtr<MessageDialog> aWarningBox(new MessageDialog( GetParentDialog()
                                       ,"DuplicateNameDialog"
-                                      ,"cui/ui/queryduplicatedialog.ui");
-            aWarningBox.Execute();
+                                      ,"cui/ui/queryduplicatedialog.ui"));
+            aWarningBox->Execute();
 
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
             boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc ));
@@ -774,7 +774,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickModifyHdl_Impl)
                 if( bDifferent )
                     bLoop = false;
                 else
-                    aWarningBox.Execute();
+                    aWarningBox->Execute();
             }
         }
 
@@ -849,9 +849,9 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickDeleteHdl_Impl)
 
     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     {
-        MessageDialog aQueryBox( GetParentDialog(),"AskDelColorDialog","cui/ui/querydeletecolordialog.ui");
+        VclPtr<MessageDialog> aQueryBox(new MessageDialog( GetParentDialog(),"AskDelColorDialog","cui/ui/querydeletecolordialog.ui"));
 
-        if( aQueryBox.Execute() == RET_YES )
+        if( aQueryBox->Execute() == RET_YES )
         {
             XColorEntry* pEntry = pColorList->Remove( nPos );
             DBG_ASSERT( pEntry, "ColorEntry not found !" );
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index f695653..c8692f7 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -561,10 +561,10 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickModifyHdl_Impl)
             }
             else
             {
-                MessageDialog aBox( GetParentDialog()
+                VclPtr<MessageDialog> aBox( new MessageDialog( GetParentDialog()
                                     ,"DuplicateNameDialog"
-                                    ,"cui/ui/queryduplicatedialog.ui");
-                aBox.Execute();
+                                    ,"cui/ui/queryduplicatedialog.ui") );
+                aBox->Execute();
             }
 
         }
@@ -580,9 +580,9 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickDeleteHdl_Impl)
 
     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     {
-        MessageDialog aQueryBox( GetParentDialog(),"AskDelGradientDialog","cui/ui/querydeletegradientdialog.ui");
+        VclPtr<MessageDialog> aQueryBox(new MessageDialog( GetParentDialog(),"AskDelGradientDialog","cui/ui/querydeletegradientdialog.ui"));
 
-        if ( aQueryBox.Execute() == RET_YES )
+        if ( aQueryBox->Execute() == RET_YES )
         {
             delete pGradientList->Remove( nPos );
             m_pLbGradients->RemoveEntry( nPos );
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index 2f988e4..3ddd6c3 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -606,10 +606,10 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickModifyHdl_Impl)
             }
             else
             {
-                MessageDialog aBox( GetParentDialog()
+                VclPtr<MessageDialog> aBox(new MessageDialog( GetParentDialog()
                                     ,"DuplicateNameDialog"
-                                    ,"cui/ui/queryduplicatedialog.ui");
-                aBox.Execute();
+                                    ,"cui/ui/queryduplicatedialog.ui"));
+                aBox->Execute();
             }
         }
     }
@@ -624,9 +624,9 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickDeleteHdl_Impl)
 
     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     {
-        MessageDialog aQueryBox( GetParentDialog(),"AskDelHatchDialog","cui/ui/querydeletehatchdialog.ui");
+        VclPtr<MessageDialog> aQueryBox(new MessageDialog( GetParentDialog(),"AskDelHatchDialog","cui/ui/querydeletehatchdialog.ui"));
 
-        if( aQueryBox.Execute() == RET_YES )
+        if( aQueryBox->Execute() == RET_YES )
         {
             delete pHatchingList->Remove( nPos );
             m_pLbHatchings->RemoveEntry( nPos );
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
index 2918f2d..16c886f 100644
--- a/cui/source/tabpages/tplnedef.cxx
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -594,10 +594,10 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl)
         else
         {
 
-            MessageDialog aBox( GetParentDialog()
+            VclPtr<MessageDialog> aBox(new MessageDialog( GetParentDialog()
                                 ,"DuplicateNameDialog"
-                                ,"cui/ui/queryduplicatedialog.ui");
-            aBox.Execute();
+                                ,"cui/ui/queryduplicatedialog.ui"));
+            aBox->Execute();
         }
     }
     pDlg.reset();
@@ -672,10 +672,10 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickModifyHdl_Impl)
             }
             else
             {
-                MessageDialog aBox( GetParentDialog()
+                VclPtr<MessageDialog> aBox(new MessageDialog( GetParentDialog()
                                    ,"DuplicateNameDialog"
-                                   ,"cui/ui/queryduplicatedialog.ui");
-                aBox.Execute();
+                                   ,"cui/ui/queryduplicatedialog.ui") );
+                aBox->Execute();
             }
         }
     }
@@ -690,11 +690,11 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickDeleteHdl_Impl)
 
     if ( nPos != LISTBOX_ENTRY_NOTFOUND )
     {
-        MessageDialog aQueryBox( GetParentDialog()
+        VclPtr<MessageDialog> aQueryBox(new MessageDialog( GetParentDialog()
                                 ,"AskDelLineStyleDialog"
-                                ,"cui/ui/querydeletelinestyledialog.ui");
+                                ,"cui/ui/querydeletelinestyledialog.ui"));
 
-        if ( aQueryBox.Execute() == RET_YES )
+        if ( aQueryBox->Execute() == RET_YES )
         {
             delete pDashList->Remove( nPos );
             m_pLbLineStyles->RemoveEntry( nPos );
diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx
index eb69f12..5ec5386 100644
--- a/cui/source/tabpages/tplneend.cxx
+++ b/cui/source/tabpages/tplneend.cxx
@@ -188,11 +188,11 @@ void SvxLineEndDefTabPage::CheckChanges_Impl()
 
         if( aString != m_pLbLineEnds->GetSelectEntry() )
         {
-            MessageDialog aQueryBox( GetParentDialog()
+            VclPtr<MessageDialog> aQueryBox(new MessageDialog( GetParentDialog()
                                     ,"AskChangeLineEndDialog"
-                                    ,"cui/ui/querychangelineenddialog.ui");
+                                    ,"cui/ui/querychangelineenddialog.ui"));
 
-            if ( aQueryBox.Execute() == RET_YES )
+            if ( aQueryBox->Execute() == RET_YES )
                 ClickModifyHdl_Impl( this );
         }
     }
@@ -325,10 +325,10 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl)
         // if yes, repeat and demand a new name
         if ( !bDifferent )
         {
-            MessageDialog aWarningBox( GetParentDialog()
+            VclPtr<MessageDialog> aWarningBox(new MessageDialog( GetParentDialog()
                                       ,"DuplicateNameDialog"
-                                      ,"cui/ui/queryduplicatedialog.ui");
-            aWarningBox.Execute();
+                                      ,"cui/ui/queryduplicatedialog.ui"));
+            aWarningBox->Execute();
 
             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
             DBG_ASSERT(pFact, "Dialog creation failed!");
@@ -350,7 +350,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl)
                 if( bDifferent )
                     bLoop = false;
                 else
-                    aWarningBox.Execute();
+                    aWarningBox->Execute();
             }
         }
 
@@ -479,10 +479,10 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl)
             }
             else
             {
-                MessageDialog aBox( GetParentDialog()
+                VclPtr<MessageDialog> aBox(new MessageDialog( GetParentDialog()
                                    ,"DuplicateNameDialog"
-                                   ,"cui/ui/queryduplicatedialog.ui");
-                aBox.Execute();
+                                   ,"cui/ui/queryduplicatedialog.ui"));
+                aBox->Execute();
             }
         }
     }
@@ -507,11 +507,11 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickDeleteHdl_Impl)
 
     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     {
-        MessageDialog aQueryBox( GetParentDialog()
+        VclPtr<MessageDialog> aQueryBox(new MessageDialog( GetParentDialog()
                                 ,"AskDelLineEndDialog"
-                                ,"cui/ui/querydeletelineenddialog.ui");
+                                ,"cui/ui/querydeletelineenddialog.ui"));
 
-        if ( aQueryBox.Execute() == RET_YES )
+        if ( aQueryBox->Execute() == RET_YES )
         {
             delete pLineEndList->Remove( nPos );
             m_pLbLineEnds->RemoveEntry( nPos );
diff --git a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
index c643e80..dd1aa10 100644
--- a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
+++ b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
@@ -406,8 +406,8 @@ namespace dbmm
             // check that the backup location isn't the same as the document itself
             if ( lcl_equalURLs_nothrow( m_pData->aContext, sBackupLocation, m_pData->xDocumentModel->getURL() ) )
             {
-                MessageDialog aErrorBox( const_cast< MacroMigrationDialog* >( this ), MacroMigrationResId( STR_INVALID_BACKUP_LOCATION ) );
-                aErrorBox.Execute();
+                VclPtr<MessageDialog> aErrorBox(new MessageDialog( const_cast< MacroMigrationDialog* >( this ), MacroMigrationResId( STR_INVALID_BACKUP_LOCATION ) ));
+                aErrorBox->Execute();
                 rBackupPage.grabLocationFocus();
                 return false;
             }
diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx
index b32f45b..eae85f4 100644
--- a/dbaccess/source/ui/app/AppControllerDnD.cxx
+++ b/dbaccess/source/ui/app/AppControllerDnD.cxx
@@ -175,8 +175,8 @@ void OApplicationController::deleteTables(const ::std::vector< OUString>& _rList
         else
         {
             OUString sMessage(ModuleRes(STR_MISSING_TABLES_XDROP));
-            MessageDialog aError(getView(), sMessage);
-            aError.Execute();
+            VclPtr<MessageDialog> aError(new MessageDialog(getView(), sMessage));
+            aError->Execute();
         }
     }
 }
@@ -210,19 +210,19 @@ void OApplicationController::deleteObjects( ElementType _eType, const ::std::vec
 
             if ( eResult != svtools::QUERYDELETE_ALL )
             {
-                svtools::QueryDeleteDlg_Impl aDlg( getView(), *aThisRound );
+                VclPtr<svtools::QueryDeleteDlg_Impl> aDlg( new svtools::QueryDeleteDlg_Impl(getView(), *aThisRound) );
 
                 if ( !sDialogPosition.isEmpty() )
-                    aDlg.SetWindowState( sDialogPosition );
+                    aDlg->SetWindowState( sDialogPosition );
 
                 if ( nObjectsLeft > 1 )
-                    aDlg.EnableAllButton();
+                    aDlg->EnableAllButton();
 
-                eResult = aDlg.Execute();
+                eResult = aDlg->Execute();
                 if (eResult == svtools::QUERYDELETE_CANCEL)
                     return;
 
-                sDialogPosition = aDlg.GetWindowState( );
+                sDialogPosition = aDlg->GetWindowState( );
             }
 
             bool bSuccess = false;
@@ -686,17 +686,17 @@ bool OApplicationController::paste( ElementType _eType, const ::svx::ODataAccess
                                                 has a /table/ with that name) */
                 if ( bNeedAskForName )
                 {
-                    OSaveAsDlg aAskForName( getView(),
+                    VclPtr<OSaveAsDlg> aAskForName(new OSaveAsDlg( getView(),
                                             CommandType::QUERY,
                                             getORB(),
                                             getConnection(),
                                             sTargetName,
                                             aNameChecker,
-                                            SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS);
-                    if ( RET_OK != aAskForName.Execute() )
+                                            SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS));
+                    if ( RET_OK != aAskForName->Execute() )
                         // cancelled by the user
                         return false;
-                    sTargetName = aAskForName.getName();
+                    sTargetName = aAskForName->getName();
                 }
 
                 // create a new object
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx
index 45185ed..f8214b8 100644
--- a/dbaccess/source/ui/app/AppControllerGen.cxx
+++ b/dbaccess/source/ui/app/AppControllerGen.cxx
@@ -111,12 +111,12 @@ void OApplicationController::convertToView(const OUString& _sName)
         OUString aDefaultName = ::dbaui::createDefaultName(xMeta,xTables,aName);
 
         DynamicTableOrQueryNameCheck aNameChecker( xConnection, CommandType::TABLE );
-        OSaveAsDlg aDlg( getView(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker );
-        if ( aDlg.Execute() == RET_OK )
+        VclPtr<OSaveAsDlg> aDlg(new OSaveAsDlg( getView(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker ) );
+        if ( aDlg->Execute() == RET_OK )
         {
-            OUString sName = aDlg.getName();
-            OUString sCatalog = aDlg.getCatalog();
-            OUString sSchema  = aDlg.getSchema();
+            OUString sName = aDlg->getName();
+            OUString sCatalog = aDlg->getCatalog();
+            OUString sSchema  = aDlg->getSchema();
             OUString sNewName(
                 ::dbtools::composeTableName( xMeta, sCatalog, sSchema, sName, false, ::dbtools::eInTableDefinitions ) );
             Reference<XPropertySet> xView = ::dbaui::createView(sNewName,xConnection,xSourceObject);
@@ -534,8 +534,8 @@ void OApplicationController::askToReconnect()
         bool bClear = true;
         if ( !m_pSubComponentManager->empty() )
         {
-            MessageDialog aQry(getView(), ModuleRes(STR_QUERY_CLOSEDOCUMENTS), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
-            switch (aQry.Execute())
+            VclPtr<MessageDialog> aQry(new MessageDialog(getView(), ModuleRes(STR_QUERY_CLOSEDOCUMENTS), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO));
+            switch (aQry->Execute())
             {
                 case RET_YES:
                     closeSubComponents();
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 6f05329..f314b1cf 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -1271,8 +1271,8 @@ IMPL_LINK( SbaXDataBrowserController, OnAsyncDisplayError, void*, /* _pNotIntere
 {
     if ( m_aCurrentError.isValid() )
     {
-        OSQLMessageBox aDlg( getBrowserView(), m_aCurrentError );
-        aDlg.Execute();
+        VclPtr<OSQLMessageBox> aDlg(new OSQLMessageBox( getBrowserView(), m_aCurrentError ));
+        aDlg->Execute();
     }
     return 0L;
 }
@@ -1764,19 +1764,19 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(bool bFilter)
         Reference< XConnection> xCon(xFormSet->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY);
         if(bFilter)
         {
-            DlgFilterCrit aDlg( getBrowserView(), getORB(), xCon, xParser, xSup->getColumns() );
-            if ( !aDlg.Execute() )
+            VclPtr<DlgFilterCrit> aDlg(new DlgFilterCrit( getBrowserView(), getORB(), xCon, xParser, xSup->getColumns() ) );
+            if ( !aDlg->Execute() )
                 return; // if so we don't need to update the grid
-            aDlg.BuildWherePart();
+            aDlg->BuildWherePart();
         }
         else
         {
-            DlgOrderCrit aDlg( getBrowserView(),xCon,xParser,xSup->getColumns() );
-            if(!aDlg.Execute())
+            VclPtr<DlgOrderCrit> aDlg(new DlgOrderCrit( getBrowserView(),xCon,xParser,xSup->getColumns() ) );
+            if(!aDlg->Execute())
             {
                 return; // if so we don't need to actualize the grid
             }
-            aDlg.BuildOrderPart();
+            aDlg->BuildOrderPart();
         }
     }
     catch(const SQLException& )
@@ -2172,11 +2172,11 @@ bool SbaXDataBrowserController::SaveModified(bool bAskFor)
     {
         getBrowserView()->getVclControl()->GrabFocus();
 
-        MessageDialog aQry(getBrowserView()->getVclControl(),
+        VclPtr<MessageDialog> aQry(new MessageDialog(getBrowserView()->getVclControl(),
                            "SaveModifiedDialog",
-                           "dbaccess/ui/savemodifieddialog.ui");
+                           "dbaccess/ui/savemodifieddialog.ui"));
 
-        switch (aQry.Execute())
+        switch (aQry->Execute())
         {
             case RET_NO:
                 Execute(ID_BROWSER_UNDORECORD,Sequence<PropertyValue>());
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 9d6f955..bdff335 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -792,10 +792,10 @@ void SbaGridControl::SetColWidth(sal_uInt16 nColId)
         Any aWidth = xAffectedCol->getPropertyValue(PROPERTY_WIDTH);
         sal_Int32 nCurWidth = aWidth.hasValue() ? ::comphelper::getINT32(aWidth) : -1;
 
-        DlgSize aDlgColWidth(this, nCurWidth, false);
-        if (aDlgColWidth.Execute())
+        VclPtr<DlgSize> aDlgColWidth(new DlgSize(this, nCurWidth, false));
+        if (aDlgColWidth->Execute())
         {
-            sal_Int32 nValue = aDlgColWidth.GetValue();
+            sal_Int32 nValue = aDlgColWidth->GetValue();
             Any aNewWidth;
             if (-1 == nValue)
             {   // set to default
@@ -821,10 +821,10 @@ void SbaGridControl::SetRowHeight()
     Any aHeight = xCols->getPropertyValue(PROPERTY_ROW_HEIGHT);
     sal_Int32 nCurHeight = aHeight.hasValue() ? ::comphelper::getINT32(aHeight) : -1;
 
-    DlgSize aDlgRowHeight(this, nCurHeight, true);
-    if (aDlgRowHeight.Execute())
+    VclPtr<DlgSize> aDlgRowHeight(new DlgSize(this, nCurHeight, true));
+    if (aDlgRowHeight->Execute())
     {
-        sal_Int32 nValue = aDlgRowHeight.GetValue();
+        sal_Int32 nValue = aDlgRowHeight->GetValue();
         Any aNewHeight;
         if ((sal_Int16)-1 == nValue)
         {   // set to default
diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx
index 02410b9..c3ba08f 100644
--- a/dbaccess/source/ui/dlg/CollectionView.cxx
+++ b/dbaccess/source/ui/dlg/CollectionView.cxx
@@ -164,8 +164,8 @@ IMPL_LINK_NOARG(OCollectionView, Save_Click)
             Reference< XContent> xContent;
             if ( xNameContainer->hasByName(sName) )
             {
-                QueryBox aBox( this, WB_YES_NO, ModuleRes( STR_ALREADYEXISTOVERWRITE ) );
-                if ( aBox.Execute() != RET_YES )
+                VclPtr<QueryBox> aBox(new QueryBox( this, WB_YES_NO, ModuleRes( STR_ALREADYEXISTOVERWRITE ) ) );
+                if ( aBox->Execute() != RET_YES )
                     return 0;
             }
             m_pName->SetText(sName);
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index bd3f8bf..deeca58 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -311,16 +311,16 @@ namespace dbaui
                     aProfiles.insert(pArray[index]);
 
                 // execute the select dialog
-                ODatasourceSelectDialog aSelector(GetParent(), aProfiles);
+                VclPtr<ODatasourceSelectDialog> aSelector(new ODatasourceSelectDialog(GetParent(), aProfiles));
                 OUString sOldProfile=getURLNoPrefix();
 
                 if (!sOldProfile.isEmpty())
-                    aSelector.Select(sOldProfile);
+                    aSelector->Select(sOldProfile);
                 else
-                    aSelector.Select(xMozillaBootstrap->getDefaultProfile(profileType));
+                    aSelector->Select(xMozillaBootstrap->getDefaultProfile(profileType));
 
-                if ( RET_OK == aSelector.Execute() )
-                    setURLNoPrefix(aSelector.GetSelected());
+                if ( RET_OK == aSelector->Execute() )
+                    setURLNoPrefix(aSelector->GetSelected());
                 break;
             }
             case ::dbaccess::DST_FIREBIRD:
@@ -481,8 +481,8 @@ namespace dbaui
             sQuery = sQuery.replaceFirst("$path$", aTransformer.get(OFileNotation::N_SYSTEM));
 
             m_bUserGrabFocus = false;
-            QueryBox aQuery(GetParent(), WB_YES_NO | WB_DEF_YES, sQuery);
-            sal_Int32 nQueryResult = aQuery.Execute();
+            VclPtr<QueryBox> aQuery(new QueryBox(GetParent(), WB_YES_NO | WB_DEF_YES, sQuery));
+            sal_Int32 nQueryResult = aQuery->Execute();
             m_bUserGrabFocus = true;
 
             switch (nQueryResult)
@@ -498,8 +498,8 @@ namespace dbaui
                             sQuery = sQuery.replaceFirst("$name$", aTransformer.get(OFileNotation::N_SYSTEM));
 
                             m_bUserGrabFocus = false;
-                            QueryBox aWhatToDo(GetParent(), WB_RETRY_CANCEL | WB_DEF_RETRY, sQuery);
-                            nQueryResult = aWhatToDo.Execute();
+                            VclPtr<QueryBox> aWhatToDo(new QueryBox(GetParent(), WB_RETRY_CANCEL | WB_DEF_RETRY, sQuery));
+                            nQueryResult = aWhatToDo->Execute();
                             m_bUserGrabFocus = true;
 
                             if (RET_RETRY == nQueryResult)
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index f33b1e4..a8884ac 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -289,8 +289,8 @@ namespace dbaui
 
         const sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
         const OSQLMessageBox::MessageType mt = bSuccess ? OSQLMessageBox::Info : OSQLMessageBox::Error;
-        OSQLMessageBox aMsg( this, OUString( ModuleRes( nMessage ) ), OUString(), WB_OK | WB_DEF_OK, mt );
-        aMsg.Execute();
+        VclPtr<OSQLMessageBox> aMsg(new OSQLMessageBox( this, OUString( ModuleRes( nMessage ) ), OUString(), WB_OK | WB_DEF_OK, mt ) );
+        aMsg->Execute();
         return 0L;
     }
     bool OConnectionTabPage::checkTestConnection()
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index 394073e..850a91a 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -508,8 +508,8 @@ using namespace ::com::sun::star;
 #endif
         const sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
         const OSQLMessageBox::MessageType mt = bSuccess ? OSQLMessageBox::Info : OSQLMessageBox::Error;
-        OSQLMessageBox aMsg( this, OUString( ModuleRes( nMessage ) ), OUString(), WB_OK | WB_DEF_OK, mt );
-        aMsg.Execute();
+        VclPtr<OSQLMessageBox> aMsg(new OSQLMessageBox( this, OUString( ModuleRes( nMessage ) ), OUString(), WB_OK | WB_DEF_OK, mt ) );
+        aMsg->Execute();
         return 0L;
     }
 
@@ -617,8 +617,8 @@ using namespace ::com::sun::star;
         }
 #endif
         sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
-        OSQLMessageBox aMsg( this, OUString( ModuleRes( nMessage ) ), OUString() );
-        aMsg.Execute();
+        VclPtr<OSQLMessageBox> aMsg(new OSQLMessageBox( this, OUString( ModuleRes( nMessage ) ), OUString() ) );
+        aMsg->Execute();
         return 0L;
     }
 
diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx
index f776e80..219440b 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.cxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.cxx
@@ -92,8 +92,8 @@ IMPL_LINK_NOARG(OPasswordDialog, OKHdl_Impl)
     else
     {
         OUString aErrorMsg( ModuleRes( STR_ERROR_PASSWORDS_NOT_IDENTICAL));
-        MessageDialog aErrorBox(this, aErrorMsg);
-        aErrorBox.Execute();
+        VclPtr<MessageDialog> aErrorBox(new MessageDialog(this, aErrorMsg));
+        aErrorBox->Execute();
         m_pEDPassword->SetText( OUString() );
         m_pEDPasswordRepeat->SetText( OUString() );
         m_pEDPassword->GrabFocus();
@@ -199,16 +199,16 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton )
     {
         if(pButton == m_pNEWUSER)
         {
-            SfxPasswordDialog aPwdDlg(this);
-            aPwdDlg.ShowExtras(SHOWEXTRAS_ALL);
-            if(aPwdDlg.Execute())
+            VclPtr<SfxPasswordDialog> aPwdDlg(new SfxPasswordDialog(this));
+            aPwdDlg->ShowExtras(SHOWEXTRAS_ALL);
+            if(aPwdDlg->Execute())
             {
                 Reference<XDataDescriptorFactory> xUserFactory(m_xUsers,UNO_QUERY);
                 Reference<XPropertySet> xNewUser = xUserFactory->createDataDescriptor();
                 if(xNewUser.is())
                 {
-                    xNewUser->setPropertyValue(PROPERTY_NAME,makeAny(OUString(aPwdDlg.GetUser())));
-                    xNewUser->setPropertyValue(PROPERTY_PASSWORD,makeAny(OUString(aPwdDlg.GetPassword())));
+                    xNewUser->setPropertyValue(PROPERTY_NAME,makeAny(OUString(aPwdDlg->GetUser())));
+                    xNewUser->setPropertyValue(PROPERTY_PASSWORD,makeAny(OUString(aPwdDlg->GetPassword())));
                     Reference<XAppend> xAppend(m_xUsers,UNO_QUERY);
                     if(xAppend.is())
                         xAppend->appendByDescriptor(xNewUser);
@@ -226,11 +226,11 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton )
                 if(xUser.is())
                 {
                     OUString sNewPassword,sOldPassword;
-                    OPasswordDialog aDlg(this,sName);
-                    if(aDlg.Execute() == RET_OK)
+                    VclPtr<OPasswordDialog> aDlg(new OPasswordDialog(this,sName));
+                    if(aDlg->Execute() == RET_OK)
                     {
-                        sNewPassword = aDlg.GetNewPassword();
-                        sOldPassword = aDlg.GetOldPassword();
+                        sNewPassword = aDlg->GetNewPassword();
+                        sOldPassword = aDlg->GetOldPassword();
 
                         if(!sNewPassword.isEmpty())
                             xUser->changePassword(sOldPassword,sNewPassword);
@@ -245,8 +245,8 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton )
                 Reference<XDrop> xDrop(m_xUsers,UNO_QUERY);
                 if(xDrop.is())
                 {
-                    MessageDialog aQry(this, ModuleRes(STR_QUERY_USERADMIN_DELETE_USER), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
-                    if(aQry.Execute() == RET_YES)
+                    VclPtr<MessageDialog> aQry(new MessageDialog(this, ModuleRes(STR_QUERY_USERADMIN_DELETE_USER), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO));
+                    if(aQry->Execute() == RET_YES)
                         xDrop->dropByName(GetUser());
                 }
             }
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index 0d15109..61744a5 100644
--- a/dbaccess/source/ui/dlg/adminpages.cxx
+++ b/dbaccess/source/ui/dlg/adminpages.cxx
@@ -117,19 +117,19 @@ namespace dbaui
             // show an error message
             OUString sError( ModuleRes( STR_COULD_NOT_LOAD_ODBC_LIB ) );
             sError = sError.replaceFirst("#lib#", aEnumeration.getLibraryName());
-            MessageDialog aDialog(this, sError);
-            aDialog.Execute();
+            VclPtr<MessageDialog> aDialog(new MessageDialog(this, sError));
+            aDialog->Execute();
             return false;
         }
         else
         {
             aEnumeration.getDatasourceNames(aOdbcDatasources);
             // execute the select dialog
-            ODatasourceSelectDialog aSelector(GetParent(), aOdbcDatasources);
+            VclPtr<ODatasourceSelectDialog> aSelector(new ODatasourceSelectDialog(GetParent(), aOdbcDatasources));
             if (!_sCurr.isEmpty())
-                aSelector.Select(_sCurr);
-            if ( RET_OK == aSelector.Execute() )
-                _sReturn = aSelector.GetSelected();
+                aSelector->Select(_sCurr);
+            if ( RET_OK == aSelector->Execute() )
+                _sReturn = aSelector->GetSelected();
         }
         return true;
     }
@@ -242,8 +242,8 @@ namespace dbaui
                     eImage = OSQLMessageBox::Error;

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list