basctl/source/basicide/baside2.cxx                         |    6 +-
 basctl/source/basicide/baside3.cxx                         |    2 
 basctl/source/basicide/basobj2.cxx                         |    4 -
 basctl/source/basicide/bastypes.cxx                        |    2 
 basctl/source/basicide/macrodlg.cxx                        |    6 +-
 basctl/source/basicide/moduldl2.cxx                        |   28 ++++++-------
 basctl/source/basicide/moduldlg.cxx                        |    6 +-
 basic/source/runtime/iosys.cxx                             |    4 -
 cui/source/dialogs/cuifmsearch.cxx                         |    2 
 cui/source/dialogs/cuigaldlg.cxx                           |    2 
 cui/source/dialogs/insdlg.cxx                              |    8 +--
 cui/source/options/optdict.cxx                             |    2 
 cui/source/options/optinet2.cxx                            |    2 
 cui/source/options/optjava.cxx                             |    4 -
 cui/source/tabpages/tparea.cxx                             |    2 
 cui/source/tabpages/tpbitmap.cxx                           |   16 +++----
 cui/source/tabpages/tpcolor.cxx                            |   12 ++---
 cui/source/tabpages/tpgradnt.cxx                           |   12 ++---
 cui/source/tabpages/tphatch.cxx                            |   12 ++---
 cui/source/tabpages/tplnedef.cxx                           |   12 ++---
 cui/source/tabpages/tplneend.cxx                           |   12 ++---
 dbaccess/source/ui/browser/brwctrlr.cxx                    |    2 
 dbaccess/source/ui/dlg/TextConnectionHelper.cxx            |    2 
 dbaccess/source/ui/dlg/paramdialog.cxx                     |    2 
 dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx       |    2 
 dbaccess/source/ui/querydesign/QueryDesignView.cxx         |    4 -
 desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx |    4 -
 extensions/source/abpilot/abspilot.cxx                     |    2 
 extensions/source/update/ui/updatecheckui.cxx              |    2 
 sc/source/ui/dbgui/dbnamdlg.cxx                            |    2 
 sc/source/ui/dbgui/filtdlg.cxx                             |    2 
 sc/source/ui/dbgui/sfiltdlg.cxx                            |    2 
 sc/source/ui/dbgui/tpsort.cxx                              |    2 
 sc/source/ui/miscdlgs/crnrdlg.cxx                          |    4 -
 sc/source/ui/miscdlgs/instbdlg.cxx                         |    2 
 sc/source/ui/miscdlgs/optsolver.cxx                        |    2 
 sc/source/ui/miscdlgs/solvrdlg.cxx                         |    2 
 sc/source/ui/miscdlgs/tabopdlg.cxx                         |    2 
 sc/source/ui/pagedlg/areasdlg.cxx                          |    2 
 scripting/source/dlgprov/dlgevtatt.cxx                     |    2 
 sd/source/ui/app/sdmod1.cxx                                |    2 
 sd/source/ui/func/fuinsert.cxx                             |    2 
 sd/source/ui/func/futhes.cxx                               |    4 -
 sfx2/source/appl/appserv.cxx                               |    2 
 sfx2/source/appl/lnkbase2.cxx                              |    2 
 sfx2/source/dialog/dinfdlg.cxx                             |    2 
 sfx2/source/dialog/newstyle.cxx                            |    2 
 sfx2/source/doc/objserv.cxx                                |   12 ++---
 sfx2/source/doc/templatedlg.cxx                            |   18 ++++----
 sfx2/source/view/viewprn.cxx                               |    8 +--
 starmath/source/view.cxx                                   |    2 
 svtools/source/dialogs/restartdialog.cxx                   |    2 
 svtools/source/filter/SvFilterOptionsDialog.cxx            |    2 
 svx/source/dialog/hdft.cxx                                 |    4 -
 svx/source/dialog/imapdlg.cxx                              |    4 -
 svx/source/dialog/passwd.cxx                               |    4 -
 svx/source/form/fmshimp.cxx                                |    4 -
 svx/source/gallery2/galbrws1.cxx                           |    2 
 svx/source/gallery2/galbrws2.cxx                           |    2 
 sw/source/core/crsr/viscrs.cxx                             |    4 -
 sw/source/ui/chrdlg/break.cxx                              |    2 
 sw/source/ui/config/mailconfigpage.cxx                     |    2 
 sw/source/ui/dbui/mmaddressblockpage.cxx                   |    2 
 sw/source/ui/dialog/uiregionsw.cxx                         |   10 ++--
 sw/source/ui/envelp/labfmt.cxx                             |    2 
 sw/source/ui/misc/glossary.cxx                             |    6 +-
 sw/source/ui/misc/srtdlg.cxx                               |    2 
 sw/source/ui/table/tabledlg.cxx                            |    2 
 sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx       |    2 
 sw/source/uibase/dochdl/gloshdl.cxx                        |    2 
 sw/source/uibase/dochdl/swdtflvr.cxx                       |   10 ++--
 sw/source/uibase/docvw/SidebarTxtControl.cxx               |    4 -
 sw/source/uibase/docvw/edtwin.cxx                          |   12 ++---
 sw/source/uibase/uiview/srcview.cxx                        |   14 +++---
 sw/source/uibase/uiview/uivwimp.cxx                        |    2 
 sw/source/uibase/uiview/view2.cxx                          |    2 
 vcl/source/app/dbggui.cxx                                  |    2 
 77 files changed, 181 insertions(+), 181 deletions(-)

New commits:
commit 1379e2feaad6344999358bbfb271edbaea66ce2a
Author: Philippe Jung <phil.j...@free.fr>
Date:   Tue May 26 16:26:35 2015 +0200

    Rewrite all calls like Dialog(params).Execute()
    
    Replace all calls looking like
      ADialog(some params).Execute()
    by
      ScopedVclPtrInstance<ADialog>::Create(some parms)->Execute()
    
    Change-Id: I0b6f0a9ea5ef0a749ffa30ce131e9dc989604639
    Reviewed-on: https://gerrit.libreoffice.org/15915
    Tested-by: Jenkins <c...@libreoffice.org>
    Tested-by: Michael Meeks <michael.me...@collabora.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/basctl/source/basicide/baside2.cxx 
b/basctl/source/basicide/baside2.cxx
index 6079ed4..d602a74 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -305,7 +305,7 @@ bool ModulWindow::BasicExecute()
     {
         if ( !aDocument.allowMacros() )
         {
-            MessageDialog(this, IDE_RESSTR(RID_STR_CANNOTRUNMACRO), 
VCL_MESSAGE_WARNING).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_CANNOTRUNMACRO), VCL_MESSAGE_WARNING)->Execute();
             return false;
         }
     }
@@ -443,7 +443,7 @@ bool ModulWindow::LoadBasic()
                 bDone = true;
         }
         else
-            MessageDialog(this, IDE_RESSTR(RID_STR_COULDNTREAD)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_COULDNTREAD))->Execute();
     }
     return bDone;
 }
@@ -489,7 +489,7 @@ bool ModulWindow::SaveBasicSource()
                 bDone = true;
         }
         else
-            MessageDialog(this, IDEResId(RID_STR_COULDNTWRITE)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDEResId(RID_STR_COULDNTWRITE))->Execute();
     }
 
     return bDone;
diff --git a/basctl/source/basicide/baside3.cxx 
b/basctl/source/basicide/baside3.cxx
index a37b00d..19c052d 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -834,7 +834,7 @@ bool DialogWindow::SaveDialog()
             }
         }
         else
-            MessageDialog(this, IDE_RESSTR(RID_STR_COULDNTWRITE)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_COULDNTWRITE))->Execute();
     }
 
     return bDone;
diff --git a/basctl/source/basicide/basobj2.cxx 
b/basctl/source/basicide/basobj2.cxx
index 530d0fc..987c1aa 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -67,7 +67,7 @@ void Organize( sal_Int16 tabId )
             aDesc = pCurWin->CreateEntryDescriptor();
 
     vcl::Window* pParent = Application::GetDefDialogParent();
-    OrganizeDialog(pParent, tabId, aDesc).Execute();
+    ScopedVclPtrInstance<OrganizeDialog>::Create(pParent, tabId, 
aDesc)->Execute();
 }
 
 bool IsValidSbxName( const OUString& rName )
@@ -331,7 +331,7 @@ OUString ChooseMacro( const uno::Reference< frame::XModel 
>& rxLimitToDocument,
                     {
                         // error
                         bError = true;
-                        MessageDialog(NULL, 
IDEResId(RID_STR_ERRORCHOOSEMACRO)).Execute();
+                        ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
IDEResId(RID_STR_ERRORCHOOSEMACRO))->Execute();
                     }
                 }
             }
diff --git a/basctl/source/basicide/bastypes.cxx 
b/basctl/source/basicide/bastypes.cxx
index 5fc8268..77febec 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -558,7 +558,7 @@ TabBarAllowRenamingReturnCode TabBar::AllowRenaming()
     bool const bValid = IsValidSbxName(GetEditText());
 
     if ( !bValid )
-        MessageDialog(this, IDEResId(RID_STR_BADSBXNAME)).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDEResId(RID_STR_BADSBXNAME))->Execute();
 
     return bValid ? TABBAR_RENAMING_YES : TABBAR_RENAMING_NO;
 }
diff --git a/basctl/source/basicide/macrodlg.cxx 
b/basctl/source/basicide/macrodlg.cxx
index 7dbd983..23e2597 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -632,7 +632,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
                 ScriptDocument aDocument( 
ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
                 if ( aDocument.isDocument() && !aDocument.allowMacros() )
                 {
-                    MessageDialog(this, IDEResId(RID_STR_CANNOTRUNMACRO), 
VCL_MESSAGE_WARNING).Execute();
+                    ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDEResId(RID_STR_CANNOTRUNMACRO), VCL_MESSAGE_WARNING)->Execute();
                     return 0;
                 }
             }
@@ -641,7 +641,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
         {
             if ( !IsValidSbxName(m_pMacroNameEdit->GetText()) )
             {
-                MessageDialog(this, IDEResId(RID_STR_BADSBXNAME)).Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDEResId(RID_STR_BADSBXNAME))->Execute();
                 m_pMacroNameEdit->SetSelection( Selection( 0, 
m_pMacroNameEdit->GetText().getLength() ) );
                 m_pMacroNameEdit->GrabFocus();
                 return 0;
@@ -709,7 +709,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
             {
                 if ( !IsValidSbxName(m_pMacroNameEdit->GetText()) )
                 {
-                    MessageDialog(this, 
IDEResId(RID_STR_BADSBXNAME)).Execute();
+                    ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDEResId(RID_STR_BADSBXNAME))->Execute();
                     m_pMacroNameEdit->SetSelection( Selection( 0, 
m_pMacroNameEdit->GetText().getLength() ) );
                     m_pMacroNameEdit->GrabFocus();
                     return 1;
diff --git a/basctl/source/basicide/moduldl2.cxx 
b/basctl/source/basicide/moduldl2.cxx
index 68499f3..70c4f58 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -269,7 +269,7 @@ bool CheckBox::EditingEntry( SvTreeListEntry* pEntry, 
Selection& )
     OUString aLibName = GetEntryText( pEntry, 0 );
     if ( aLibName.equalsIgnoreAsciiCase( "Standard" ) )
     {
-        MessageDialog(this, 
IDE_RESSTR(RID_STR_CANNOTCHANGENAMESTDLIB)).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_CANNOTCHANGENAMESTDLIB))->Execute();
         return false;
     }
 
@@ -279,7 +279,7 @@ bool CheckBox::EditingEntry( SvTreeListEntry* pEntry, 
Selection& )
     if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && 
xModLibContainer->isLibraryReadOnly( aLibName ) && 
!xModLibContainer->isLibraryLink( aLibName ) ) ||
          ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && 
xDlgLibContainer->isLibraryReadOnly( aLibName ) && 
!xDlgLibContainer->isLibraryLink( aLibName ) ) )
     {
-        MessageDialog(this, IDE_RESSTR(RID_STR_LIBISREADONLY)).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_LIBISREADONLY))->Execute();
         return false;
     }
 
@@ -329,7 +329,7 @@ bool CheckBox::EditedEntry( SvTreeListEntry* pEntry, const 
OUString& rNewName )
         }
         catch (const container::ElementExistException& )
         {
-            MessageDialog(this, 
IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED))->Execute();
             return false;
         }
         catch (const container::NoSuchElementException& )
@@ -342,9 +342,9 @@ bool CheckBox::EditedEntry( SvTreeListEntry* pEntry, const 
OUString& rNewName )
     if ( !bValid )
     {
         if ( rNewName.getLength() > 30 )
-            MessageDialog(this, IDE_RESSTR(RID_STR_LIBNAMETOLONG)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_LIBNAMETOLONG))->Execute();
         else
-            MessageDialog(this, IDE_RESSTR(RID_STR_BADSBXNAME)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_BADSBXNAME))->Execute();
     }
 
     return bValid;
@@ -357,7 +357,7 @@ IMPL_LINK_NOARG(NewObjectDialog, OkButtonHandler)
         EndDialog(1);
     else
     {
-        MessageDialog(this, IDE_RESSTR(RID_STR_BADSBXNAME)).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_BADSBXNAME))->Execute();
         m_pEdit->GrabFocus();
     }
     return 0;
@@ -854,7 +854,7 @@ void LibPage::InsertLib()
             }
 
             if ( !pLibDlg )
-                MessageDialog(this, IDE_RESSTR(RID_STR_NOLIBINSTORAGE), 
VCL_MESSAGE_INFO).Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_NOLIBINSTORAGE), VCL_MESSAGE_INFO)->Execute();
             else
             {
                 bool bChanges = false;
@@ -891,7 +891,7 @@ void LibPage::InsertLib()
                                     // check, if the library is the Standard 
library
                                     if ( aLibName == "Standard" )
                                     {
-                                        MessageDialog(this, 
IDE_RESSTR(RID_STR_REPLACESTDLIB)).Execute();
+                                        
ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_REPLACESTDLIB))->Execute();
                                         continue;
                                     }
 
@@ -903,7 +903,7 @@ void LibPage::InsertLib()
                                         aErrStr = aErrStr.replaceAll("XX", 
aLibName);
                                         aErrStr += "\n";
                                         aErrStr += 
IDE_RESSTR(RID_STR_LIBISREADONLY);
-                                        MessageDialog(this, aErrStr).Execute();
+                                        
ScopedVclPtrInstance<MessageDialog>::Create(this, aErrStr)->Execute();
                                         continue;
                                     }
 
@@ -920,7 +920,7 @@ void LibPage::InsertLib()
                                     aErrStr = aErrStr.replaceAll("XX", 
aLibName);
                                     aErrStr += "\n" ;
                                     aErrStr += 
IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED);
-                                    MessageDialog(this, aErrStr).Execute();
+                                    
ScopedVclPtrInstance<MessageDialog>::Create(this, aErrStr)->Execute();
                                     continue;
                                 }
                             }
@@ -939,7 +939,7 @@ void LibPage::InsertLib()
                                     {
                                         OUString aErrStr( 
IDE_RESSTR(RID_STR_NOIMPORT) );
                                         aErrStr = aErrStr.replaceAll("XX", 
aLibName);
-                                        MessageDialog(this, aErrStr).Execute();
+                                        
ScopedVclPtrInstance<MessageDialog>::Create(this, aErrStr)->Execute();
                                         continue;
                                     }
                                 }
@@ -1513,15 +1513,15 @@ void createLibImpl( vcl::Window* pWin, const 
ScriptDocument& rDocument,
 
         if ( aLibName.getLength() > 30 )
         {
-            MessageDialog(pWin, 
IDEResId(RID_STR_LIBNAMETOLONG).toString()).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(pWin, 
IDEResId(RID_STR_LIBNAMETOLONG).toString())->Execute();
         }
         else if ( !IsValidSbxName( aLibName ) )
         {
-            MessageDialog(pWin, 
IDEResId(RID_STR_BADSBXNAME).toString()).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(pWin, 
IDEResId(RID_STR_BADSBXNAME).toString())->Execute();
         }
         else if ( rDocument.hasLibrary( E_SCRIPTS, aLibName ) || 
rDocument.hasLibrary( E_DIALOGS, aLibName ) )
         {
-            MessageDialog(pWin, 
IDEResId(RID_STR_SBXNAMEALLREADYUSED2).toString()).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(pWin, 
IDEResId(RID_STR_SBXNAMEALLREADYUSED2).toString())->Execute();
         }
         else
         {
diff --git a/basctl/source/basicide/moduldlg.cxx 
b/basctl/source/basicide/moduldlg.cxx
index 504545e..0da8cdb 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -91,7 +91,7 @@ bool ExtTreeListBox::EditedEntry( SvTreeListEntry* pEntry, 
const OUString& rNewT
 {
     if ( !IsValidSbxName(rNewText) )
     {
-        MessageDialog(this, IDE_RESSTR(RID_STR_BADSBXNAME)).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_BADSBXNAME))->Execute();
         return false;
     }
 
@@ -835,7 +835,7 @@ void ObjectPage::NewDialog()
 
             if ( aDocument.hasDialog( aLibName, aDlgName ) )
             {
-                MessageDialog(this, 
IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2)).Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(this, 
IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2))->Execute();
             }
             else
             {
@@ -1047,7 +1047,7 @@ SbModule* createModImpl( vcl::Window* pWin, const 
ScriptDocument& rDocument,
         }
         catch (const container::ElementExistException& )
         {
-            MessageDialog(pWin, 
IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(pWin, 
IDE_RESSTR(RID_STR_SBXNAMEALLREADYUSED2))->Execute();
         }
         catch (const container::NoSuchElementException& )
         {
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index f495827..2e666ea 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -859,9 +859,9 @@ void SbiIoSystem::Shutdown()
     {
 #if defined __GNUC__
         vcl::Window* pParent = Application::GetDefDialogParent();
-        MessBox( pParent, WinBits( WB_OK ), OUString(), aOut ).Execute();
+        ScopedVclPtrInstance<MessBox>::Create( pParent, WinBits( WB_OK ), 
OUString(), aOut )->Execute();
 #else
-        MessBox( GetpApp()->GetDefDialogParent(), WinBits( WB_OK ), 
OUString(), aOut ).Execute();
+        ScopedVclPtrInstance<MessBox>::Create( 
GetpApp()->GetDefDialogParent(), WinBits( WB_OK ), OUString(), aOut 
)->Execute();
 #endif
     }
     aOut.clear();
diff --git a/cui/source/dialogs/cuifmsearch.cxx 
b/cui/source/dialogs/cuifmsearch.cxx
index 76c132a..2a5c31f 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -752,7 +752,7 @@ IMPL_LINK(FmSearchDialog, OnSearchProgress, 
FmSearchProgress*, pProgress)
             sal_uInt16 nErrorId = (FmSearchProgress::STATE_ERROR == 
pProgress->aSearchState)
                 ? RID_STR_SEARCH_GENERAL_ERROR
                 : RID_STR_SEARCH_NORECORD;
-            MessageDialog(this, CUI_RES(nErrorId)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
CUI_RES(nErrorId))->Execute();
         }
             // NO break !
         case FmSearchProgress::STATE_CANCELED:
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 4eafd49..def7872 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -1024,7 +1024,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, 
SelectFileTypeHdl)
     {
         aLastFilterName = aText;
 
-        if( MessageDialog( this, 
"QueryUpdateFileListDialog","cui/ui/queryupdategalleryfilelistdialog.ui" 
).Execute() == RET_YES )
+        if( ScopedVclPtrInstance<MessageDialog>::Create( this, 
"QueryUpdateFileListDialog","cui/ui/queryupdategalleryfilelistdialog.ui" 
)->Execute() == RET_YES )
             SearchFiles();
     }
 
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index eacfed6..a68af45 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -292,7 +292,7 @@ short SvInsertOleDlg::Execute()
                         // global Resource from svtools (former so3 resource)
                         OUString aErr( impl_getSvtResString( 
STR_ERROR_OBJNOCREATE_FROM_FILE ) );
                         aErr = aErr.replaceFirst( "%", aFileName );
-                        MessageDialog(this, aErr).Execute();
+                        ScopedVclPtrInstance<MessageDialog>::Create(this, 
aErr)->Execute();
                     }
                     else
                     {
@@ -300,7 +300,7 @@ short SvInsertOleDlg::Execute()
                         // global Resource from svtools (former so3 resource)
                         OUString aErr( impl_getSvtResString( 
STR_ERROR_OBJNOCREATE ) );
                         aErr = aErr.replaceFirst( "%", aServerName );
-                        MessageDialog(this, aErr).Execute();
+                        ScopedVclPtrInstance<MessageDialog>::Create(this, 
aErr)->Execute();
                     }
                 }
             }
@@ -341,7 +341,7 @@ short SvInsertOleDlg::Execute()
                 // global Resource from svtools (former so3 resource)
                 OUString aErr( impl_getSvtResString( 
STR_ERROR_OBJNOCREATE_FROM_FILE ) );
                 aErr = aErr.replaceFirst( "%", aFileName );
-                MessageDialog(this, aErr).Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(this, 
aErr)->Execute();
             }
         }
     }
@@ -486,7 +486,7 @@ short SvInsertPlugInDialog::Execute()
             // global Resource from svtools (former so3 resource)
             OUString aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_PLUGIN 
) );
             aErr = aErr.replaceFirst( "%", aURL );
-            MessageDialog(this, aErr).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, aErr)->Execute();
         }
     }
 
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index a590931..5b79a08a 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -156,7 +156,7 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl)
     if ( bFound )
     {
         // duplicate names?
-        MessageDialog(this, CUI_RESSTR(RID_SVXSTR_OPT_DOUBLE_DICTS), 
VCL_MESSAGE_INFO).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
CUI_RESSTR(RID_SVXSTR_OPT_DOUBLE_DICTS), VCL_MESSAGE_INFO)->Execute();
         pNameEdit->GrabFocus();
         return 0;
     }
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 91296cb..62989f3 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -133,7 +133,7 @@ void SvxNoSpaceEdit::Modify()
 
         if ( !comphelper::string::isdigitAsciiString(aValue) || 
(long)aValue.toInt32() > USHRT_MAX )
             // the maximum value of a port number is USHRT_MAX
-            MessageDialog( this, CUI_RES( RID_SVXSTR_OPT_PROXYPORTS ) 
).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create( this, CUI_RES( 
RID_SVXSTR_OPT_PROXYPORTS ) )->Execute();
     }
 }
 
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 80c6819..31c94c6 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -1008,7 +1008,7 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl)
         {
             OUString sMsg( CUI_RES( RID_SVXSTR_MULTIFILE_DBL_ERR ) );
             sMsg = sMsg.replaceFirst( "%1", sFile );
-            MessageDialog(this, sMsg).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, sMsg)->Execute();
         }
     }
     EnableRemoveButton();
@@ -1045,7 +1045,7 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl)
         {
             OUString sMsg( CUI_RES( RID_SVXSTR_MULTIFILE_DBL_ERR ) );
             sMsg = sMsg.replaceFirst( "%1", sNewFolder );
-            MessageDialog(this, sMsg).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, sMsg)->Execute();
         }
     }
     EnableRemoveButton();
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index a46b634..ae3f3f3 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -2227,7 +2227,7 @@ IMPL_LINK_NOARG( SvxAreaTabPage, ClickImportHdl_Impl )
         else
         {
             // graphic could not be loaded
-            MessageDialog (this, OUString(ResId(RID_SVXSTR_READ_DATA_ERROR, 
rMgr))).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create (this, 
OUString(ResId(RID_SVXSTR_READ_DATA_ERROR, rMgr)))->Execute();
         }
     }
 
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 77f2c62..0d11116 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -667,9 +667,9 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl_Impl)
         }
         else
             // graphic couldn't be loaded
-            MessageDialog( GetParentDialog()
+            ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog()
                           ,"NoLoadedFileDialog"
-                          ,"cui/ui/querynoloadedfiledialog.ui").Execute();
+                          ,"cui/ui/querynoloadedfiledialog.ui")->Execute();
     }
 
     return 0L;
@@ -782,9 +782,9 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickLoadHdl_Impl)
 
     if ( *pnBitmapListState & ChangeType::MODIFIED )
     {
-        nReturn = MessageDialog( GetParentDialog()
+        nReturn = ScopedVclPtrInstance<MessageDialog>::Create( 
GetParentDialog()
                                 ,"AskSaveList"
-                                ,"cui/ui/querysavelistdialog.ui").Execute();
+                                ,"cui/ui/querysavelistdialog.ui")->Execute();
 
         if ( nReturn == RET_YES )
             pBitmapList->Save();
@@ -844,9 +844,9 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickLoadHdl_Impl)
             else
             {
                 LeaveWait();
-                MessageDialog( GetParentDialog()
+                ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog()
                               ,"NoLoadedFileDialog"
-                              ,"cui/ui/querynoloadedfiledialog.ui").Execute();
+                              ,"cui/ui/querynoloadedfiledialog.ui")->Execute();
             }
         }
     }
@@ -918,9 +918,9 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickSaveHdl_Impl)
         }
         else
         {
-            MessageDialog( GetParentDialog()
+            ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog()
                           ,"NoSaveFileDialog"
-                          ,"cui/ui/querynosavefiledialog.ui").Execute();
+                          ,"cui/ui/querynosavefiledialog.ui")->Execute();
         }
     }
 
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 9a09d3b..6319c4d4 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -128,9 +128,9 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickLoadHdl_Impl)
 
     if( IsModified() && GetList()->Count() > 0 )
     {
-        nReturn = MessageDialog( GetParentDialog()
+        nReturn = ScopedVclPtrInstance<MessageDialog>::Create( 
GetParentDialog()
                                 ,"AskSaveList"
-                                ,"cui/ui/querysavelistdialog.ui").Execute();
+                                ,"cui/ui/querysavelistdialog.ui")->Execute();
 
         if ( nReturn == RET_YES )
             GetList()->Save();
@@ -173,9 +173,9 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickLoadHdl_Impl)
             }
             else
             {
-                MessageDialog( mpTopDlg
+                ScopedVclPtrInstance<MessageDialog>::Create( mpTopDlg
                               ,"NoLoadedFileDialog"
-                              ,"cui/ui/querynoloadedfiledialog.ui").Execute();
+                              ,"cui/ui/querynoloadedfiledialog.ui")->Execute();
             }
         }
     }
@@ -235,9 +235,9 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickSaveHdl_Impl)
         }
         else
         {
-            MessageDialog( mpTopDlg
+            ScopedVclPtrInstance<MessageDialog>::Create( mpTopDlg
                           ,"NoSaveFileDialog"
-                          ,"cui/ui/querynosavefiledialog.ui").Execute();
+                          ,"cui/ui/querynosavefiledialog.ui")->Execute();
         }
     }
     return 0;
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index d9b7c82..e737410 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -642,9 +642,9 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickLoadHdl_Impl)
 
     if ( *pnGradientListState & ChangeType::MODIFIED )
     {
-        nReturn = MessageDialog( GetParentDialog()
+        nReturn = ScopedVclPtrInstance<MessageDialog>::Create( 
GetParentDialog()
                                  ,"AskSaveList"
-                                 ,"cui/ui/querysavelistdialog.ui").Execute();
+                                 ,"cui/ui/querysavelistdialog.ui")->Execute();
 
         if ( nReturn == RET_YES )
             pGradientList->Save();
@@ -707,9 +707,9 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickLoadHdl_Impl)
             else
             {
                 LeaveWait();
-                MessageDialog( GetParentDialog()
+                ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog()
                               ,"NoLoadedFileDialog"
-                              ,"cui/ui/querynoloadedfiledialog.ui").Execute();
+                              ,"cui/ui/querynoloadedfiledialog.ui")->Execute();
             }
         }
     }
@@ -782,9 +782,9 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickSaveHdl_Impl)
         }
         else
         {
-            MessageDialog( GetParentDialog()
+            ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog()
                           ,"NoSaveFileDialog"
-                          ,"cui/ui/querynosavefiledialog.ui").Execute();
+                          ,"cui/ui/querynosavefiledialog.ui")->Execute();
         }
     }
 
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index 5c0a0c1..bad1e71 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -679,9 +679,9 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickLoadHdl_Impl)
 
     if ( *pnHatchingListState & ChangeType::MODIFIED )
     {
-        nReturn = MessageDialog( GetParentDialog()
+        nReturn = ScopedVclPtrInstance<MessageDialog>::Create( 
GetParentDialog()
                                 ,"AskSaveList"
-                                ,"cui/ui/querysavelistdialog.ui").Execute();
+                                ,"cui/ui/querysavelistdialog.ui")->Execute();
 
         if ( nReturn == RET_YES )
             pHatchingList->Save();
@@ -735,9 +735,9 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickLoadHdl_Impl)
                 *pnHatchingListState &= ~ChangeType::MODIFIED;
             }
             else
-                MessageDialog( GetParentDialog()
+                ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog()
                                ,"NoLoadedFileDialog"
-                               ,"cui/ui/querynoloadedfiledialog.ui").Execute();
+                               
,"cui/ui/querynoloadedfiledialog.ui")->Execute();
         }
     }
 
@@ -808,9 +808,9 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickSaveHdl_Impl)
         }
         else
         {
-            MessageDialog( GetParentDialog()
+            ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog()
                           ,"NoSaveFileDialog"
-                          ,"cui/ui/querynosavefiledialog.ui").Execute();
+                          ,"cui/ui/querynosavefiledialog.ui")->Execute();
         }
     }
 
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
index 8bac223..6694a54 100644
--- a/cui/source/tabpages/tplnedef.cxx
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -748,9 +748,9 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl)
 
     if ( *pnDashListState & ChangeType::MODIFIED )
     {
-        nReturn = MessageDialog( GetParentDialog()
+        nReturn = ScopedVclPtrInstance<MessageDialog>::Create( 
GetParentDialog()
                                 ,"AskSaveList"
-                                ,"cui/ui/querysavelistdialog.ui").Execute();
+                                ,"cui/ui/querysavelistdialog.ui")->Execute();
 
         if ( nReturn == RET_YES )
             pDashList->Save();
@@ -791,9 +791,9 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl)
             }
             else
                 //aIStream.Close();
-                MessageDialog( GetParentDialog()
+                ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog()
                               ,"NoLoadedFileDialog"
-                              ,"cui/ui/querynoloadedfiledialog.ui").Execute();
+                              ,"cui/ui/querynoloadedfiledialog.ui")->Execute();
         }
     }
 
@@ -851,9 +851,9 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickSaveHdl_Impl)
         }
         else
         {
-            MessageDialog( GetParentDialog()
+            ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog()
                          ,"NoSaveFileDialog"
-                         ,"cui/ui/querynosavefiledialog.ui").Execute();
+                         ,"cui/ui/querynosavefiledialog.ui")->Execute();
         }
     }
 
diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx
index 21f946c..aff55b9 100644
--- a/cui/source/tabpages/tplneend.cxx
+++ b/cui/source/tabpages/tplneend.cxx
@@ -560,9 +560,9 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl)
 
     if ( *pnLineEndListState & ChangeType::MODIFIED )
     {
-        nReturn = MessageDialog( GetParentDialog()
+        nReturn = ScopedVclPtrInstance<MessageDialog>::Create( 
GetParentDialog()
                                 ,"AskSaveList"
-                                ,"cui/ui/querysavelistdialog.ui").Execute();
+                                ,"cui/ui/querysavelistdialog.ui")->Execute();
 
         if ( nReturn == RET_YES )
             pLineEndList->Save();
@@ -603,9 +603,9 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl)
                 *pnLineEndListState &= ~ChangeType::MODIFIED;
             }
             else
-                MessageDialog( GetParentDialog()
+                ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog()
                               ,"NoLoadedFileDialog"
-                              ,"cui/ui/querynoloadedfiledialog.ui").Execute();
+                              ,"cui/ui/querynoloadedfiledialog.ui")->Execute();
         }
     }
 
@@ -663,9 +663,9 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickSaveHdl_Impl)
         }
         else
         {
-            MessageDialog( GetParentDialog()
+            ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog()
                           ,"NoSaveFileDialog"
-                          ,"cui/ui/querynosavefiledialog.ui").Execute();
+                          ,"cui/ui/querynosavefiledialog.ui")->Execute();
         }
     }
     return 0L;
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx 
b/dbaccess/source/ui/browser/brwctrlr.cxx
index 484e941..8bbc094 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -1386,7 +1386,7 @@ void SbaXDataBrowserController::resetted(const 
::com::sun::star::lang::EventObje
 
 sal_Bool SbaXDataBrowserController::confirmDelete(const 
::com::sun::star::sdb::RowChangeEvent& /*aEvent*/) throw( RuntimeException, 
std::exception )
 {
-    if (MessageDialog(getBrowserView(), ModuleRes(STR_QUERY_BRW_DELETE_ROWS), 
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute() != RET_YES)
+    if (ScopedVclPtrInstance<MessageDialog>::Create(getBrowserView(), 
ModuleRes(STR_QUERY_BRW_DELETE_ROWS), VCL_MESSAGE_QUESTION, 
VCL_BUTTONS_YES_NO)->Execute() != RET_YES)
         return sal_False;
 
     return sal_True;
diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx 
b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
index 66fedee..8b43ab4 100644
--- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
@@ -328,7 +328,7 @@ namespace dbaui
         }
         else
             return true;
-        MessageDialog(NULL, 
MnemonicGenerator::EraseAllMnemonicChars(aErrorText)).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
MnemonicGenerator::EraseAllMnemonicChars(aErrorText))->Execute();
         pErrorWin->GrabFocus();
         return false;
     }
diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx 
b/dbaccess/source/ui/dlg/paramdialog.cxx
index 3b34eab..6d8762a 100644
--- a/dbaccess/source/ui/dlg/paramdialog.cxx
+++ b/dbaccess/source/ui/dlg/paramdialog.cxx
@@ -198,7 +198,7 @@ namespace dbaui
 
                     OUString sMessage(ModuleRes(STR_COULD_NOT_CONVERT_PARAM));
                     sMessage = sMessage.replaceAll( "$name$", sName );
-                    MessageDialog(NULL, sMessage).Execute();
+                    ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
sMessage)->Execute();
                     m_pParam->GrabFocus();
                     return 1L;
                 }
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx 
b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
index 1903b0c..4665a9a 100644
--- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -457,7 +457,7 @@ namespace dbaui
         if ( !pWin )
             pWin = getView()->Window::GetParent();
 
-        MessageDialog(pWin, aMessage, VCL_MESSAGE_INFO).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(pWin, aMessage, 
VCL_MESSAGE_INFO)->Execute();
     }
     const Reference< XConnection >& DBSubComponentController::getConnection() 
const
     {
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx 
b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index de79ceb..8cdb101 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -759,7 +759,7 @@ namespace
                         {
                             // only show the messagebox the first time
                             if (!bCritsOnAsterikWarning)
-                                MessageDialog(_pView, ModuleRes( 
STR_QRY_CRITERIA_ON_ASTERISK)).Execute();
+                                
ScopedVclPtrInstance<MessageDialog>::Create(_pView, ModuleRes( 
STR_QRY_CRITERIA_ON_ASTERISK))->Execute();
                             bCritsOnAsterikWarning = true;
                             continue;
                         }
@@ -918,7 +918,7 @@ namespace
                     {
                         // only show the  MessageBox the first time
                         if (!bCritsOnAsterikWarning)
-                            MessageDialog(_pView, ModuleRes( 
STR_QRY_ORDERBY_ON_ASTERISK)).Execute();
+                            
ScopedVclPtrInstance<MessageDialog>::Create(_pView, ModuleRes( 
STR_QRY_ORDERBY_ON_ASTERISK))->Execute();
                         bCritsOnAsterikWarning = true;
                         continue;
                     }
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx 
b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index 7e97c52..3ff7214 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -407,7 +407,7 @@ void ProgressCmdEnv::handle( uno::Reference< 
task::XInteractionRequest > const &
         }
         {
             SolarMutexGuard guard;
-            short n = DependencyDialog( m_pDialogHelper? 
m_pDialogHelper->getWindow() : NULL, deps ).Execute();
+            short n = ScopedVclPtrInstance<DependencyDialog>::Create( 
m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, deps )->Execute();
             // Distinguish between closing the dialog and programatically
             // canceling the dialog (headless VCL):
             approve = n == RET_OK
@@ -949,7 +949,7 @@ void ExtensionCmdQueue::Thread::_checkForUpdates(
         short nDialogResult = RET_OK;
         if ( !dataDownload.empty() )
         {
-            nDialogResult = UpdateInstallDialog( m_pDialogHelper? 
m_pDialogHelper->getWindow() : NULL, dataDownload, m_xContext ).Execute();
+            nDialogResult = ScopedVclPtrInstance<UpdateInstallDialog>::Create( 
m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, dataDownload, m_xContext 
)->Execute();
             pUpdateDialog->notifyMenubar( false, true ); // Check, if there 
are still pending updates to be notified via menu bar icon
         }
         else
diff --git a/extensions/source/abpilot/abspilot.cxx 
b/extensions/source/abpilot/abspilot.cxx
index 9150d42..a27b1e6 100644
--- a/extensions/source/abpilot/abspilot.cxx
+++ b/extensions/source/abpilot/abspilot.cxx
@@ -267,7 +267,7 @@ namespace abp
 
             if ( aTables.empty() )
             {
-                if (RET_YES != MessageDialog(this, ModuleRes(( 
getSettings().eType == AST_EVOLUTION_GROUPWISE ? RID_STR_QRY_NO_EVO_GW : 
RID_STR_QRY_NOTABLES)), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute())
+                if (RET_YES != 
ScopedVclPtrInstance<MessageDialog>::Create(this, ModuleRes(( 
getSettings().eType == AST_EVOLUTION_GROUPWISE ? RID_STR_QRY_NO_EVO_GW : 
RID_STR_QRY_NOTABLES)), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)->Execute())
                 {
                     // cannot ask the user, or the user chose to use this data 
source, though there are no tables
                     bAllow = false;
diff --git a/extensions/source/update/ui/updatecheckui.cxx 
b/extensions/source/update/ui/updatecheckui.cxx
index 389c39d..88570c5 100644
--- a/extensions/source/update/ui/updatecheckui.cxx
+++ b/extensions/source/update/ui/updatecheckui.cxx
@@ -593,7 +593,7 @@ IMPL_LINK_NOARG(UpdateCheckUI, ClickHdl)
             mrJob->execute( aEmpty );
         }
         catch(const uno::Exception&) {
-            MessageDialog( NULL, ResId( STR_NO_WEBBROWSER_FOUND, *mpSfxResMgr 
)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create( nullptr, ResId( 
STR_NO_WEBBROWSER_FOUND, *mpSfxResMgr ))->Execute();
         }
     }
 
diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index ca24f23..ba3163b 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -43,7 +43,7 @@ class DBSaveData;
 
 static DBSaveData* pSaveObj = NULL;
 
-#define ERRORBOX(s) MessageDialog(this, s).Execute()
+#define ERRORBOX(s) ScopedVclPtrInstance<MessageDialog>::Create(this, 
s)->Execute()
 
 //  class DBSaveData
 
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index c6f2266..5ffac44 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -41,7 +41,7 @@
 
 #include <limits>
 
-#define ERRORBOX(rid)   MessageDialog(this, 
ScGlobal::GetRscString(rid)).Execute()
+#define ERRORBOX(rid)   ScopedVclPtrInstance<MessageDialog>::Create(this, 
ScGlobal::GetRscString(rid))->Execute()
 
 #define QUERY_ENTRY_COUNT 4
 #define INVALID_HEADER_POS std::numeric_limits<size_t>::max()
diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index 4cf0a86..9ae4d34 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -39,7 +39,7 @@
 
 // DEFINE --------------------------------------------------------------------
 
-#define ERRORBOX(rid) MessageDialog(this, 
ScGlobal::GetRscString(rid)).Execute()
+#define ERRORBOX(rid) ScopedVclPtrInstance<MessageDialog>::Create(this, 
ScGlobal::GetRscString(rid))->Execute()
 
 //  class ScSpecialFilterDialog
 
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 68fbc94..85661d1 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -807,7 +807,7 @@ SfxTabPage::sfxpg ScTabPageSortOptions::DeactivatePage( 
SfxItemSet* pSetP )
 
         if ( !bPosInputOk )
         {
-            MessageDialog(this, ScGlobal::GetRscString( 
STR_INVALID_TABREF)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
ScGlobal::GetRscString( STR_INVALID_TABREF))->Execute();
             m_pEdOutPos->GrabFocus();
             m_pEdOutPos->SetSelection( Selection( 0, SELECTION_MAX ) );
             theOutPos.Set(0,0,0);
diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx 
b/sc/source/ui/miscdlgs/crnrdlg.cxx
index d44b489..8772dc0 100644
--- a/sc/source/ui/miscdlgs/crnrdlg.cxx
+++ b/sc/source/ui/miscdlgs/crnrdlg.cxx
@@ -26,8 +26,8 @@
 #include <vcl/msgbox.hxx>
 #include <boost/scoped_array.hpp>
 
-#define ERRORBOX(s) MessageDialog(this, s).Execute()
-#define QUERYBOX(m) QueryBox(this,WinBits(WB_YES_NO|WB_DEF_YES),m).Execute()
+#define ERRORBOX(s) ScopedVclPtrInstance<MessageDialog>::Create(this, 
s)->Execute()
+#define QUERYBOX(m) 
ScopedVclPtrInstance<QueryBox>::Create(this,WinBits(WB_YES_NO|WB_DEF_YES),m)->Execute()
 
 const sal_uLong nEntryDataCol = 0;
 const sal_uLong nEntryDataRow = 1;
diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx 
b/sc/source/ui/miscdlgs/instbdlg.cxx
index fd92d08..719f037 100644
--- a/sc/source/ui/miscdlgs/instbdlg.cxx
+++ b/sc/source/ui/miscdlgs/instbdlg.cxx
@@ -312,7 +312,7 @@ IMPL_LINK_NOARG(ScInsertTableDlg, DoEnterHdl)
     else
     {
         OUString aErrMsg ( ScGlobal::GetRscString( STR_INVALIDTABNAME ) );
-        (void)MessageDialog(this, aErrMsg).Execute();
+        (void)ScopedVclPtrInstance<MessageDialog>::Create(this, 
aErrMsg)->Execute();
     }
     return 0;
 }
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx 
b/sc/source/ui/miscdlgs/optsolver.cxx
index 8072c83..7f960ac 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -809,7 +809,7 @@ IMPL_LINK( ScOptSolverDlg, CursorDownHdl, ScCursorRefEdit*, 
pEdit )
 void ScOptSolverDlg::ShowError( bool bCondition, formula::RefEdit* pFocus )
 {
     OUString aMessage = bCondition ? maConditionError : maInputError;
-    MessageDialog(this, aMessage).Execute();
+    ScopedVclPtrInstance<MessageDialog>::Create(this, aMessage)->Execute();
     if (pFocus)
     {
         mpEdActive = pFocus;
diff --git a/sc/source/ui/miscdlgs/solvrdlg.cxx 
b/sc/source/ui/miscdlgs/solvrdlg.cxx
index af94aab..e890437 100644
--- a/sc/source/ui/miscdlgs/solvrdlg.cxx
+++ b/sc/source/ui/miscdlgs/solvrdlg.cxx
@@ -35,7 +35,7 @@ namespace
 {
     void lclErrorDialog( vcl::Window* pParent, const OUString& aString )
     {
-        MessageDialog(pParent, aString).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(pParent, 
aString)->Execute();
     }
 }
 
diff --git a/sc/source/ui/miscdlgs/tabopdlg.cxx 
b/sc/source/ui/miscdlgs/tabopdlg.cxx
index e86b3b4..3706a34 100644
--- a/sc/source/ui/miscdlgs/tabopdlg.cxx
+++ b/sc/source/ui/miscdlgs/tabopdlg.cxx
@@ -223,7 +223,7 @@ void ScTabOpDlg::RaiseError( ScTabOpErr eError )
             break;
     }
 
-    MessageDialog(this, *pMsg, VCL_MESSAGE_ERROR, 
VCL_BUTTONS_OK_CANCEL).Execute();
+    ScopedVclPtrInstance<MessageDialog>::Create(this, *pMsg, 
VCL_MESSAGE_ERROR, VCL_BUTTONS_OK_CANCEL)->Execute();
     pEd->GrabFocus();
 }
 
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx 
b/sc/source/ui/pagedlg/areasdlg.cxx
index 1985e09..30a124e 100644
--- a/sc/source/ui/pagedlg/areasdlg.cxx
+++ b/sc/source/ui/pagedlg/areasdlg.cxx
@@ -50,7 +50,7 @@ const sal_uInt16 SC_AREASDLG_RR_USER    = 1;
 const sal_uInt16 SC_AREASDLG_RR_OFFSET  = 2;
 
 #define HDL(hdl)            LINK( this, ScPrintAreasDlg, hdl )
-#define ERRORBOX(nId)       MessageDialog(this, 
ScGlobal::GetRscString(nId)).Execute()
+#define ERRORBOX(nId)       ScopedVclPtrInstance<MessageDialog>::Create(this, 
ScGlobal::GetRscString(nId))->Execute()
 
 // globale Funktionen (->am Ende der Datei):
 
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx 
b/scripting/source/dlgprov/dlgevtatt.cxx
index 22fc503..cedfc18 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -646,7 +646,7 @@ namespace dlgprov
                 aOUFinal += aQuoteChar;
                 aOUFinal += aOURes.copy( nIndex + 2 );
 
-                MessageDialog(NULL, aOUFinal).Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
aOUFinal)->Execute();
             }
         }
     }
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 448dd30..e6af0be 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -234,7 +234,7 @@ void SdModule::Execute(SfxRequest& rReq)
             }
             else
             {
-                MessageDialog(NULL, 
SD_RESSTR(STR_CANT_PERFORM_IN_LIVEMODE)).Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
SD_RESSTR(STR_CANT_PERFORM_IN_LIVEMODE))->Execute();
 
                 SFX_REQUEST_ARG( rReq, pLinkItem, SfxLinkItem, SID_DONELINK, 
false );
                 if( pLinkItem )
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index d3708df..7691f2d 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -511,7 +511,7 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq )
                             // unable to create PlugIn
                             OUString aStrErr( SdResId( 
STR_ERROR_OBJNOCREATE_PLUGIN ) );
                             aStrErr = aStrErr.replaceFirst( "%", aStrURL );
-                            MessageDialog(mpWindow, aStrErr).Execute();
+                            
ScopedVclPtrInstance<MessageDialog>::Create(mpWindow, aStrErr)->Execute();
                         }
                     }
                 }
diff --git a/sd/source/ui/func/futhes.cxx b/sd/source/ui/func/futhes.cxx
index 327e58f..7ccee44 100644
--- a/sd/source/ui/func/futhes.cxx
+++ b/sd/source/ui/func/futhes.cxx
@@ -113,7 +113,7 @@ void FuThesaurus::DoExecute( SfxRequest& )
 
             if (eState == EE_SPELL_NOLANGUAGE)
             {
-                MessageDialog(mpWindow, SD_RESSTR(STR_NOLANGUAGE)).Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(mpWindow, 
SD_RESSTR(STR_NOLANGUAGE))->Execute();
             }
         }
     }
@@ -140,7 +140,7 @@ void FuThesaurus::DoExecute( SfxRequest& )
 
         if (eState == EE_SPELL_NOLANGUAGE)
         {
-            MessageDialog(mpWindow, SD_RESSTR(STR_NOLANGUAGE)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(mpWindow, 
SD_RESSTR(STR_NOLANGUAGE))->Execute();
         }
     }
 }
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index b60da28..40c8014 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -1258,7 +1258,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
             SvtModuleOptions aModuleOpt;
             if ( !aModuleOpt.IsImpress() )
             {
-                MessageDialog( 0, SFX2_RESSTR( STR_MODULENOTINSTALLED 
)).Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create( nullptr, 
SFX2_RESSTR( STR_MODULENOTINSTALLED ))->Execute();
                 return;
             }
 
diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx
index 3c899b3..ac35800 100644
--- a/sfx2/source/appl/lnkbase2.cxx
+++ b/sfx2/source/appl/lnkbase2.cxx
@@ -545,7 +545,7 @@ bool SvBaseLink::ExecuteEdit( const OUString& _rNewName )
             else
                 return false;
 
-            MessageDialog(pImpl->m_pParentWin, sError).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(pImpl->m_pParentWin, 
sError)->Execute();
         }
     }
     else if( !pImpl->m_bIsConnect )
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index bda4806..0e47101 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1652,7 +1652,7 @@ void CustomPropertiesWindow::ValidateLine( 
CustomPropertyLine* pLine, bool bIsFr
         if ( bIsFromTypeBox ) // LoseFocus of TypeBox
             pLine->m_bTypeLostFocus = true;
         vcl::Window* pParent = GetParent()->GetParent();
-        if (MessageDialog(pParent, SfxResId(STR_SFX_QUERY_WRONG_TYPE), 
VCL_MESSAGE_QUESTION, VCL_BUTTONS_OK_CANCEL).Execute() == RET_OK)
+        if (ScopedVclPtrInstance<MessageDialog>::Create(pParent, 
SfxResId(STR_SFX_QUERY_WRONG_TYPE), VCL_MESSAGE_QUESTION, 
VCL_BUTTONS_OK_CANCEL)->Execute() == RET_OK)
             pLine->m_aTypeBox->SelectEntryPos( m_aTypeBox->GetEntryPos( 
reinterpret_cast<void*>(CUSTOM_TYPE_TEXT) ) );
         else
             pLine->m_aValueEdit->GrabFocus();
diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx
index 0824e3d..464d12a 100644
--- a/sfx2/source/dialog/newstyle.cxx
+++ b/sfx2/source/dialog/newstyle.cxx
@@ -37,7 +37,7 @@ IMPL_LINK( SfxNewStyleDlg, OKHdl, Control *, pControl )
     {
         if ( !pStyle->IsUserDefined() )
         {
-            MessageDialog( this, SfxResId( STR_POOL_STYLE_NAME ), 
VCL_MESSAGE_INFO ).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create( this, SfxResId( 
STR_POOL_STYLE_NAME ), VCL_MESSAGE_INFO )->Execute();
             return 0;
         }
 
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index f4ba28b..f35c470 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -872,7 +872,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
         }
         case SID_CANCELCHECKOUT:
         {
-            if (MessageDialog(NULL, SfxResId(STR_QUERY_CANCELCHECKOUT), 
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute() == RET_YES)
+            if (ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
SfxResId(STR_QUERY_CANCELCHECKOUT), VCL_MESSAGE_QUESTION, 
VCL_BUTTONS_YES_NO)->Execute() == RET_YES)
             {
                 CancelCheckOut( );
 
@@ -1398,7 +1398,7 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
         )
     {
         // Only OASIS and OOo6.x formats will be handled further
-        MessageDialog( NULL, SfxResId( STR_INFO_WRONGDOCFORMAT ), 
VCL_MESSAGE_INFO ).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create( nullptr, SfxResId( 
STR_INFO_WRONGDOCFORMAT ), VCL_MESSAGE_INFO )->Execute();
         return;
     }
 
@@ -1432,8 +1432,8 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
         if ( nVersion >= SvtSaveOptions::ODFVER_012 )
         {
 
-            if ( (bHasSign && MessageDialog(NULL, 
SfxResId(STR_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN), VCL_MESSAGE_QUESTION, 
VCL_BUTTONS_YES_NO).Execute() == RET_YES)
-              || (!bHasSign && MessageDialog(NULL, 
SfxResId(RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN), VCL_MESSAGE_QUESTION, 
VCL_BUTTONS_YES_NO).Execute() == RET_YES) )
+            if ( (bHasSign && 
ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
SfxResId(STR_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN), VCL_MESSAGE_QUESTION, 
VCL_BUTTONS_YES_NO)->Execute() == RET_YES)
+              || (!bHasSign && 
ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
SfxResId(RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN), VCL_MESSAGE_QUESTION, 
VCL_BUTTONS_YES_NO)->Execute() == RET_YES) )
             {
                 sal_uInt16 nId = SID_SAVEDOC;
                 if ( !GetMedium() || GetMedium()->GetName().isEmpty() )
@@ -1449,7 +1449,7 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
                     || SotStorage::GetVersion( GetMedium()->GetStorage() ) <= 
SOFFICE_FILEFORMAT_60 ) )
                 {
                     // Only OASIS format will be handled further
-                    MessageDialog( NULL, SfxResId( STR_INFO_WRONGDOCFORMAT ), 
VCL_MESSAGE_INFO ).Execute();
+                    ScopedVclPtrInstance<MessageDialog>::Create( nullptr, 
SfxResId( STR_INFO_WRONGDOCFORMAT ), VCL_MESSAGE_INFO )->Execute();
                     return;
                 }
             }
@@ -1464,7 +1464,7 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
         }
         else
         {
-            MessageDialog(NULL, SfxResId(STR_XMLSEC_ODF12_EXPECTED)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
SfxResId(STR_XMLSEC_ODF12_EXPECTED))->Execute();
             return;
         }
 
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 8885a5d..0114dfb 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -942,7 +942,7 @@ void SfxTemplateManagerDlg::OnTemplateImport ()
                     {
                         OUString 
aMsg(SfxResId(STR_MSG_ERROR_IMPORT).toString());
                         aMsg = aMsg.replaceFirst("$1",pFolder->maTitle);
-                        MessageDialog(this, 
aMsg.replaceFirst("$2",aTemplateList)).Execute();
+                        ScopedVclPtrInstance<MessageDialog>::Create(this, 
aMsg.replaceFirst("$2",aTemplateList))->Execute();
                     }
                 }
             }
@@ -965,7 +965,7 @@ void SfxTemplateManagerDlg::OnTemplateImport ()
                 {
                     OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT).toString());
                     aMsg = 
aMsg.replaceFirst("$1",mpLocalView->getCurRegionName());
-                    MessageDialog(this, 
aMsg.replaceFirst("$2",aTemplateList)).Execute();
+                    ScopedVclPtrInstance<MessageDialog>::Create(this, 
aMsg.replaceFirst("$2",aTemplateList))->Execute();
                 }
             }
 
@@ -1054,7 +1054,7 @@ void SfxTemplateManagerDlg::OnTemplateExport()
         if (!aTemplateList.isEmpty())
         {
             OUString aText( SfxResId(STR_MSG_ERROR_EXPORT).toString() );
-            MessageDialog(this, 
aText.replaceFirst("$1",aTemplateList)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
aText.replaceFirst("$1",aTemplateList))->Execute();
         }
     }
 }
@@ -1216,7 +1216,7 @@ void SfxTemplateManagerDlg::OnTemplateDelete ()
     if (!aTemplateList.isEmpty())
     {
         OUString aMsg( SfxResId(STR_MSG_ERROR_DELETE_TEMPLATE).toString() );
-        MessageDialog(this, aMsg.replaceFirst("$1",aTemplateList)).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
aMsg.replaceFirst("$1",aTemplateList))->Execute();
     }
 }
 
@@ -1280,7 +1280,7 @@ void SfxTemplateManagerDlg::OnFolderDelete()
     if (!aFolderList.isEmpty())
     {
         OUString aMsg( SfxResId(STR_MSG_ERROR_DELETE_FOLDER).toString() );
-        MessageDialog(this, aMsg.replaceFirst("$1",aFolderList)).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
aMsg.replaceFirst("$1",aFolderList))->Execute();
     }
 }
 
@@ -1301,7 +1301,7 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs()
 
     if (!mpLocalView->isNonRootRegionVisible() && maSelFolders.empty())
     {
-        MessageDialog(this, SfxResId(STR_MSG_ERROR_SELECT_FOLDER)).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
SfxResId(STR_MSG_ERROR_SELECT_FOLDER))->Execute();
         return;
     }
 
@@ -1480,7 +1480,7 @@ void SfxTemplateManagerDlg::localMoveTo(sal_uInt16 
nMenuId)
             OUString aDst = mpLocalView->getRegionItemName(nItemId);
             OUString aMsg(SfxResId(STR_MSG_ERROR_LOCAL_MOVE).toString());
             aMsg = aMsg.replaceFirst("$1",aDst);
-            MessageDialog(this, aMsg.replaceFirst( 
"$2",aTemplateList)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
aMsg.replaceFirst( "$2",aTemplateList))->Execute();
         }
     }
 }
@@ -1534,7 +1534,7 @@ void SfxTemplateManagerDlg::remoteMoveTo(const sal_uInt16 
nMenuId)
             OUString aMsg(SfxResId(STR_MSG_ERROR_REMOTE_MOVE).toString());
             aMsg = aMsg.replaceFirst("$1",mpRemoteView->getCurRegionName());
             aMsg = 
aMsg.replaceFirst("$2",mpLocalView->getRegionItemName(nItemId));
-            MessageDialog(this, 
aMsg.replaceFirst("$1",aTemplateList)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
aMsg.replaceFirst("$1",aTemplateList))->Execute();
         }
     }
 }
@@ -1590,7 +1590,7 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 
nMenuId)
             OUString aDst = mpLocalView->getRegionItemName(nItemId);
             OUString aMsg(SfxResId(STR_MSG_ERROR_LOCAL_MOVE).toString());
             aMsg = aMsg.replaceFirst("$1",aDst);
-            MessageDialog(this, aMsg.replaceFirst( 
"$2",aTemplateList)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
aMsg.replaceFirst( "$2",aTemplateList))->Execute();
         }
     }
 
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 5655d61..3f238fb 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -343,7 +343,7 @@ void SfxPrinterController::jobFinished( 
com::sun::star::view::PrintableState nSt
                 // "real" problem (not simply printing cancelled by user)
                 OUString aMsg( SfxResId(STR_NOSTARTPRINTER).toString() );
                 if ( !m_bApi )
-                    MessageDialog(mpViewShell->GetWindow(), aMsg).Execute();
+                    
ScopedVclPtrInstance<MessageDialog>::Create(mpViewShell->GetWindow(), 
aMsg)->Execute();
                 // intentionally no break
             }
             case view::PrintableState_JOB_ABORTED :
@@ -521,7 +521,7 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( 
VclPtr<SfxPrinter>& pNewPrinter )
 
     // Ask if possible, if page format should be taken over from printer.
     if ( ( bOriChg  || bPgSzChg ) &&
-        RET_YES == MessageDialog(NULL, aMsg, VCL_MESSAGE_QUESTION, 
VCL_BUTTONS_YES_NO).Execute() )
+        RET_YES == ScopedVclPtrInstance<MessageDialog>::Create(nullptr, aMsg, 
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)->Execute() )
     {
         // Flags with changes for  <SetPrinter(SfxPrinter*)> are maintained
         nChangedFlags |= nNewOpt;
@@ -794,7 +794,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
             {
                 // no valid printer either in ItemSet or at the document
                 if ( !bSilent )
-                    MessageDialog(NULL, SfxResId(STR_NODEFPRINTER)).Execute();
+                    ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
SfxResId(STR_NODEFPRINTER))->Execute();
 
                 rReq.SetReturnValue(SfxBoolItem(0,false));
 
@@ -806,7 +806,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
             {
                 // if printer is busy, abort configuration
                 if ( !bSilent )
-                    MessageDialog(NULL, SfxResId(STR_ERROR_PRINTER_BUSY), 
VCL_MESSAGE_INFO).Execute();
+                    ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
SfxResId(STR_ERROR_PRINTER_BUSY), VCL_MESSAGE_INFO)->Execute();
                 rReq.SetReturnValue(SfxBoolItem(0,false));
 
                 return;
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 0086cad..4e4ad79 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1787,7 +1787,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
             SAL_WARN_IF( !pDev, "starmath", "device for font list missing" );
 
             SmModule *pp = SM_MOD();
-            SmSymbolDialog( NULL, pDev, pp->GetSymbolManager(), *this 
).Execute();
+            ScopedVclPtrInstance<SmSymbolDialog>::Create( nullptr, pDev, 
pp->GetSymbolManager(), *this )->Execute();
         }
         break;
     }
diff --git a/svtools/source/dialogs/restartdialog.cxx 
b/svtools/source/dialogs/restartdialog.cxx
index 7bef797..828188f 100644
--- a/svtools/source/dialogs/restartdialog.cxx
+++ b/svtools/source/dialogs/restartdialog.cxx
@@ -83,7 +83,7 @@ void svtools::executeRestartDialog(
     css::uno::Reference< css::uno::XComponentContext > const & context,
     vcl::Window * parent, RestartReason reason)
 {
-    if (RestartDialog(parent, reason).Execute()) {
+    if (ScopedVclPtrInstance<RestartDialog>::Create(parent, 
reason)->Execute()) {
         css::task::OfficeRestartManager::get(context)->requestRestart(
             css::uno::Reference< css::task::XInteractionHandler >());
     }
diff --git a/svtools/source/filter/SvFilterOptionsDialog.cxx 
b/svtools/source/filter/SvFilterOptionsDialog.cxx
index 46fe1a8..e273483 100644
--- a/svtools/source/filter/SvFilterOptionsDialog.cxx
+++ b/svtools/source/filter/SvFilterOptionsDialog.cxx
@@ -255,7 +255,7 @@ sal_Int16 SvFilterOptionsDialog::execute()
 
             aFltCallDlgPara.aFilterExt = 
aGraphicFilter.GetExportFormatShortName( nFormat );
             bool bIsPixelFormat( aGraphicFilter.IsExportPixelFormat( nFormat ) 
);
-            if ( ExportDialog( aFltCallDlgPara, mxContext, mxSourceDocument, 
mbExportSelection, bIsPixelFormat ).Execute() == RET_OK )
+            if ( ScopedVclPtrInstance<ExportDialog>::Create( aFltCallDlgPara, 
mxContext, mxSourceDocument, mbExportSelection, bIsPixelFormat )->Execute() == 
RET_OK )
                 nRet = ui::dialogs::ExecutableDialogResults::OK;
 
             pResMgr.reset();
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index 6f21f6c..06639f4b0 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -535,9 +535,9 @@ IMPL_LINK( SvxHFPage, TurnOnHdl, CheckBox *, pBox )
         {
             short nResult;
             if (nId == SID_ATTR_PAGE_HEADERSET)
-                nResult = DeleteHeaderDialog(this).Execute();
+                nResult = 
ScopedVclPtrInstance<DeleteHeaderDialog>::Create(this)->Execute();
             else
-                nResult = DeleteFooterDialog(this).Execute();
+                nResult = 
ScopedVclPtrInstance<DeleteFooterDialog>::Create(this)->Execute();
             bDelete = nResult == RET_YES;
         }
 
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index 295c32f..a98f1a6 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -699,8 +699,8 @@ IMPL_LINK_NOARG_TYPED(SvxIMapDlg, UpdateHdl, Idle *, void)
     if ( pOwnData->pUpdateEditingObject != pCheckObj )
     {
         if ( pIMapWnd->IsChanged() &&
-             ( MessageDialog( this,"QuerySaveImageMapChangesDialog",
-             "svx/ui/querysaveimagemapchangesdialog.ui" ).Execute() == RET_YES 
) )
+             ( ScopedVclPtrInstance<MessageDialog>::Create( 
this,"QuerySaveImageMapChangesDialog",
+             "svx/ui/querysaveimagemapchangesdialog.ui" )->Execute() == 
RET_YES ) )
         {
             DoSave();
         }
diff --git a/svx/source/dialog/passwd.cxx b/svx/source/dialog/passwd.cxx
index 25b01d7..5139baf 100644
--- a/svx/source/dialog/passwd.cxx
+++ b/svx/source/dialog/passwd.cxx
@@ -31,7 +31,7 @@ IMPL_LINK_NOARG(SvxPasswordDialog, ButtonHdl)
 
     if ( m_pNewPasswdED->GetText() != m_pRepeatPasswdED->GetText() )
     {
-        MessageDialog(this, aRepeatPasswdErrStr).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
aRepeatPasswdErrStr)->Execute();
         m_pNewPasswdED->SetText( aEmpty );
         m_pRepeatPasswdED->SetText( aEmpty );
         m_pNewPasswdED->GrabFocus();
@@ -40,7 +40,7 @@ IMPL_LINK_NOARG(SvxPasswordDialog, ButtonHdl)
 
     if ( bOK && aCheckPasswordHdl.IsSet() && !aCheckPasswordHdl.Call( this ) )
     {
-        MessageDialog(this, aOldPasswdErrStr).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
aOldPasswdErrStr)->Execute();
         m_pOldPasswdED->SetText( aEmpty );
         m_pOldPasswdED->GrabFocus();
         bOK = false;
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 592f1e8..0c11947 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -1489,7 +1489,7 @@ void FmXFormShell::ExecuteSearch()
 
     if (m_aSearchForms.empty() )
     {   // es gibt keine Controls, die alle Bedingungen fuer eine Suche 
erfuellen
-        MessageDialog(NULL, SVX_RESSTR(RID_STR_NODATACONTROLS)).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
SVX_RESSTR(RID_STR_NODATACONTROLS))->Execute();
         return;
     }
 
@@ -3168,7 +3168,7 @@ void FmXFormShell::CreateExternalView()
 
         if (!bHaveUsableControls)
         {
-            MessageDialog(NULL, 
SVX_RESSTR(RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY)).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
SVX_RESSTR(RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY))->Execute();
             return;
         }
     }
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index 24c20e4..faa108d 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -370,7 +370,7 @@ void GalleryBrowser1::ImplExecute( sal_uInt16 nId )
 
         case( MN_DELETE  ):
         {
-            if( MessageDialog( NULL, 
"QueryDeleteThemeDialog","svx/ui/querydeletethemedialog.ui").Execute() == 
RET_YES )
+            if( ScopedVclPtrInstance<MessageDialog>::Create( nullptr, 
"QueryDeleteThemeDialog","svx/ui/querydeletethemedialog.ui")->Execute() == 
RET_YES )
                 mpGallery->RemoveTheme( mpThemes->GetSelectEntry() );
         }
         break;
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 76dc9d2c..b97bc9d 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -1161,7 +1161,7 @@ void GalleryBrowser2::Execute( sal_uInt16 nId )
             case( MN_DELETE ):
             {
                 if( !mpCurTheme->IsReadOnly() &&
-                    MessageDialog(NULL, 
"QueryDeleteObjectDialog","svx/ui/querydeleteobjectdialog.ui").Execute() == 
RET_YES )
+                    ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
"QueryDeleteObjectDialog","svx/ui/querydeleteobjectdialog.ui")->Execute() == 
RET_YES )
                 {
                     mpCurTheme->RemoveObject( mnCurActionPos );
                 }
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 1366935..38e6ef8 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -622,8 +622,8 @@ short SwShellCrsr::MaxReplaceArived()
             }
             vActionCounts.push_back(nActCnt);
         }
-        nRet = MessageDialog(pDlg, "AskSearchDialog",
-                "modules/swriter/ui/asksearchdialog.ui").Execute();
+        nRet = ScopedVclPtrInstance<MessageDialog>::Create(pDlg, 
"AskSearchDialog",
+                "modules/swriter/ui/asksearchdialog.ui")->Execute();
         auto pActionCount = vActionCounts.begin();
         for(SwViewShell& rShell : const_cast< SwCrsrShell* >( GetShell() 
)->GetRingContainer())
         {
diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx
index 66becc7..b57801d 100644
--- a/sw/source/ui/chrdlg/break.cxx
+++ b/sw/source/ui/chrdlg/break.cxx
@@ -112,7 +112,7 @@ IMPL_LINK_NOARG(SwBreakDlg, OkHdl)
             default:; //prevent warning
         }
         if(!bOk) {
-            MessageDialog(this, SW_RES(STR_ILLEGAL_PAGENUM), 
VCL_MESSAGE_INFO).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
SW_RES(STR_ILLEGAL_PAGENUM), VCL_MESSAGE_INFO)->Execute();
             m_pPageNumEdit->GrabFocus();
             return 0;
         }
diff --git a/sw/source/ui/config/mailconfigpage.cxx 
b/sw/source/ui/config/mailconfigpage.cxx
index 06937b7..ad03fa0 100644
--- a/sw/source/ui/config/mailconfigpage.cxx
+++ b/sw/source/ui/config/mailconfigpage.cxx
@@ -224,7 +224,7 @@ IMPL_LINK_NOARG(SwMailConfigPage, AuthenticationHdl)
 
 IMPL_LINK_NOARG(SwMailConfigPage, TestHdl)
 {
-    SwTestAccountSettingsDialog(this).Execute();
+    ScopedVclPtrInstance<SwTestAccountSettingsDialog>::Create(this)->Execute();
     return 0;
 }
 
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx 
b/sw/source/ui/dbui/mmaddressblockpage.cxx
index df9817f..5a04751c 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -183,7 +183,7 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, 
AddressListHdl_Impl)
     catch (const uno::Exception& e)
     {
         OSL_FAIL(OUStringToOString(e.Message, 
osl_getThreadTextEncoding()).getStr());
-        MessageDialog(this, e.Message).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
e.Message)->Execute();
     }
     return 0;
 }
diff --git a/sw/source/ui/dialog/uiregionsw.cxx 
b/sw/source/ui/dialog/uiregionsw.cxx
index 42760d17..617a604 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -419,7 +419,7 @@ bool SwEditRegionDlg::CheckPasswd(CheckBox* pBox)
                 }
                 else
                 {
-                    MessageDialog(this, SW_RES(STR_WRONG_PASSWORD), 
VCL_MESSAGE_INFO).Execute();
+                    ScopedVclPtrInstance<MessageDialog>::Create(this, 
SW_RES(STR_WRONG_PASSWORD), VCL_MESSAGE_INFO)->Execute();
                 }
             }
         }
@@ -988,7 +988,7 @@ IMPL_LINK( SwEditRegionDlg, UseFileHdl, CheckBox *, pBox )
             bool bContent = pSectRepr->IsContent();
             if( pBox->IsChecked() && bContent && rSh.HasSelection() )
             {
-                if (RET_NO == MessageDialog(this, SW_RES(STR_QUERY_CONNECT), 
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute())
+                if (RET_NO == 
ScopedVclPtrInstance<MessageDialog>::Create(this, SW_RES(STR_QUERY_CONNECT), 
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)->Execute())
                     pBox->Check( false );
             }
             if( bFile )
@@ -1271,7 +1271,7 @@ IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, 
pBox )
                     }
                     else
                     {
-                        MessageDialog(pBox, SW_RES(STR_WRONG_PASSWD_REPEAT), 
VCL_MESSAGE_INFO).Execute();
+                        ScopedVclPtrInstance<MessageDialog>::Create(pBox, 
SW_RES(STR_WRONG_PASSWD_REPEAT), VCL_MESSAGE_INFO)->Execute();
                         ChangePasswdHdl(pBox);
                         break;
                     }
@@ -1725,7 +1725,7 @@ IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, 
Button *, pButton )
                 }
                 else
                 {
-                    MessageDialog(pButton, SW_RES(STR_WRONG_PASSWD_REPEAT), 
VCL_MESSAGE_INFO).Execute();
+                    ScopedVclPtrInstance<MessageDialog>::Create(pButton, 
SW_RES(STR_WRONG_PASSWD_REPEAT), VCL_MESSAGE_INFO)->Execute();
                 }
             }
             else if(!bChange)
@@ -1750,7 +1750,7 @@ IMPL_LINK( SwInsertSectionTabPage, UseFileHdl, CheckBox 
*, pBox )
     if( pBox->IsChecked() )
     {
         if( m_pWrtSh->HasSelection() &&
-            RET_NO == MessageDialog(this, SW_RES(STR_QUERY_CONNECT), 
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO).Execute())
+            RET_NO == ScopedVclPtrInstance<MessageDialog>::Create(this, 
SW_RES(STR_QUERY_CONNECT), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)->Execute())
             pBox->Check( false );
     }
 
diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx
index aa81e11..e8b3d53 100644
--- a/sw/source/ui/envelp/labfmt.cxx
+++ b/sw/source/ui/envelp/labfmt.cxx
@@ -646,7 +646,7 @@ IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl)
         if ( rCfg.IsPredefinedLabel(sMake, sType) )
         {
             SAL_WARN( "sw.envelp", "label is predefined and cannot be 
overwritten" );
-            MessageDialog(this, "CannotSaveLabelDialog", 
"modules/swriter/ui/cannotsavelabeldialog.ui").Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
"CannotSaveLabelDialog", 
"modules/swriter/ui/cannotsavelabeldialog.ui")->Execute();
             return 0;
         }
 
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index d82a5c1..7df83b1 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -465,7 +465,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn )
         const OUString aShortName(m_pShortNameEdit->GetText());
         if(pGlossaryHdl->HasShortName(aShortName))
         {
-            MessageDialog(this, SW_RES(STR_DOUBLE_SHORTNAME), 
VCL_MESSAGE_INFO).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(this, 
SW_RES(STR_DOUBLE_SHORTNAME), VCL_MESSAGE_INFO)->Execute();
             m_pShortNameEdit->SetSelection(Selection(0, SELECTION_MAX));
             m_pShortNameEdit->GrabFocus();
             return 1;
@@ -602,7 +602,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn )
                 Init();
             else
             {
-                MessageDialog(this, SW_RES( STR_NO_GLOSSARIES ), 
VCL_MESSAGE_INFO).Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(this, SW_RES( 
STR_NO_GLOSSARIES ), VCL_MESSAGE_INFO)->Execute();
             }
         }
     }
@@ -817,7 +817,7 @@ IMPL_LINK_NOARG(SwNewGlosNameDlg, Rename)
     if( pDlg->pGlossaryHdl->HasShortName(m_pNewShort->GetText())
         && sNew != m_pOldShort->GetText() )
     {
-        MessageDialog(this, SW_RES(STR_DOUBLE_SHORTNAME), 
VCL_MESSAGE_INFO).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
SW_RES(STR_DOUBLE_SHORTNAME), VCL_MESSAGE_INFO)->Execute();
         m_pNewShort->GrabFocus();
     }
     else
diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx
index 37b42cd..7692e92 100644
--- a/sw/source/ui/misc/srtdlg.cxx
+++ b/sw/source/ui/misc/srtdlg.cxx
@@ -382,7 +382,7 @@ void SwSortDlg::Apply()
     }
 
     if( !bRet )
-        MessageDialog( this->GetParent(), SW_RES(STR_SRTERR), 
VCL_MESSAGE_INFO).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create( this->GetParent(), 
SW_RES(STR_SRTERR), VCL_MESSAGE_INFO)->Execute();
 }
 
 IMPL_LINK( SwSortDlg, DelimHdl, RadioButton*, pButton )
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index e757f3d..d27f981 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -628,7 +628,7 @@ SfxTabPage::sfxpg SwFormatTablePage::DeactivatePage( 
SfxItemSet* _pSet )
     OUString sTableName = m_pNameED->GetText();
     if(sTableName.indexOf(' ') != -1)
     {
-        MessageDialog(this, SW_RES(STR_WRONG_TABLENAME), 
VCL_MESSAGE_INFO).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(this, 
SW_RES(STR_WRONG_TABLENAME), VCL_MESSAGE_INFO)->Execute();
         m_pNameED->GrabFocus();
         return KEEP_PAGE;
     }
diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx 
b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
index 3716b92..0805005 100644
--- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
+++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
@@ -421,7 +421,7 @@ The code below would only be part of the solution.
                 OUString sInfo(SW_RES(STR_SPELLING_COMPLETED));
                 // #i84610#
                 vcl::Window* pTemp = GetWindow();    // temporary needed for 
g++ 3.3.5
-                MessageDialog(pTemp, sInfo, VCL_MESSAGE_INFO).Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(pTemp, sInfo, 
VCL_MESSAGE_INFO)->Execute();
                 LockFocusNotification( false );
                 // take care that the now valid selection is stored
                 LoseFocus();
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx 
b/sw/source/uibase/dochdl/gloshdl.cxx
index fbd4f6d..844f6b6 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -327,7 +327,7 @@ bool SwGlossaryHdl::NewGlossary(const OUString& rName, 
const OUString& rShortNam
                             rCfg.IsSaveRelFile(), pOnlyText );
     if(nSuccess == (sal_uInt16) -1 )
     {
-        MessageDialog(pWrtShell->GetView().GetWindow(), 
SW_RES(STR_ERR_INSERT_GLOS), VCL_MESSAGE_INFO).Execute();
+        
ScopedVclPtrInstance<MessageDialog>::Create(pWrtShell->GetView().GetWindow(), 
SW_RES(STR_ERR_INSERT_GLOS), VCL_MESSAGE_INFO)->Execute();
     }
     if( !pCurGrp )
         delete pTmp;
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index 9178fd2..5e00968 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1717,7 +1717,7 @@ bool SwTransferable::_PasteFileContent( 
TransferableDataHelper& rData,
 
     if( bMsg && nResId )
     {
-        MessageDialog( 0, SW_RES( nResId ), VCL_MESSAGE_INFO).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create( nullptr, SW_RES( nResId 
), VCL_MESSAGE_INFO)->Execute();
     }
     return nRet;
 }
@@ -1793,7 +1793,7 @@ bool SwTransferable::_PasteOLE( TransferableDataHelper& 
rData, SwWrtShell& rSh,
         if( !IsError( aReader.Read( *pRead )) )
             nRet = true;
         else if( bMsg )
-            MessageDialog( 0, SW_RES(STR_ERROR_CLPBRD_READ), VCL_MESSAGE_INFO 
).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create( nullptr, 
SW_RES(STR_ERROR_CLPBRD_READ), VCL_MESSAGE_INFO )->Execute();
     }
     else
     {
@@ -2172,7 +2172,7 @@ bool SwTransferable::_PasteDDE( TransferableDataHelper& 
rData,
                 if( !nRows || !nCols )
                 {
                     if( bMsg )
-                        MessageDialog(0, SW_RESSTR(STR_NO_TABLE), 
VCL_MESSAGE_INFO).Execute();
+                        ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
SW_RESSTR(STR_NO_TABLE), VCL_MESSAGE_INFO)->Execute();
                     pDDETyp = 0;
                     break;
                 }
@@ -2717,7 +2717,7 @@ bool SwTransferable::_PasteDBData( 
TransferableDataHelper& rData,
     }
     else if( bMsg )
     {
-        MessageDialog( 0, SW_RES(STR_CLPBRD_FORMAT_ERROR), 
VCL_MESSAGE_INFO).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create( nullptr, 
SW_RES(STR_CLPBRD_FORMAT_ERROR), VCL_MESSAGE_INFO)->Execute();
     }
     return nRet;
 }
@@ -2756,7 +2756,7 @@ bool SwTransferable::_PasteFileList( 
TransferableDataHelper& rData,
     }
     else if( bMsg )
     {
-        MessageDialog( 0, SW_RES(STR_CLPBRD_FORMAT_ERROR), 
VCL_MESSAGE_INFO).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create( nullptr, 
SW_RES(STR_CLPBRD_FORMAT_ERROR), VCL_MESSAGE_INFO)->Execute();
     }
     return nRet;
 }
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx 
b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 3d6be46..155e394 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -228,8 +228,8 @@ void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt )
             }
             else
             {
-                MessageDialog(this, "InfoReadonlyDialog",
-                    "modules/swriter/ui/inforeadonlydialog.ui").Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(this, 
"InfoReadonlyDialog",
+                    "modules/swriter/ui/inforeadonlydialog.ui")->Execute();
             }
         }
         if (bDone)
diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 0d71473..53e7ceb 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1828,8 +1828,8 @@ KEYINPUT_CHECKTABLE_INSDEL:
                     }
                     else
                     {
-                        MessageDialog(this, "InfoReadonlyDialog",
-                            
"modules/swriter/ui/inforeadonlydialog.ui").Execute();
+                        ScopedVclPtrInstance<MessageDialog>::Create(this, 
"InfoReadonlyDialog",
+                            
"modules/swriter/ui/inforeadonlydialog.ui")->Execute();
                         eKeyState = KS_End;
                     }
                     break;
@@ -1992,8 +1992,8 @@ KEYINPUT_CHECKTABLE_INSDEL:
                     }
                     else
                     {
-                        MessageDialog(this, "InfoReadonlyDialog",
-                            
"modules/swriter/ui/inforeadonlydialog.ui").Execute();
+                        ScopedVclPtrInstance<MessageDialog>::Create(this, 
"InfoReadonlyDialog",
+                            
"modules/swriter/ui/inforeadonlydialog.ui")->Execute();
                         eKeyState = KS_End;
                     }
                     break;
@@ -2418,8 +2418,8 @@ KEYINPUT_CHECKTABLE_INSDEL:
             }
             else
             {
-                MessageDialog(this, "InfoReadonlyDialog",
-                    "modules/swriter/ui/inforeadonlydialog.ui").Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(this, 
"InfoReadonlyDialog",
+                    "modules/swriter/ui/inforeadonlydialog.ui")->Execute();
                 eKeyState = KS_End;
             }
         break;
diff --git a/sw/source/uibase/uiview/srcview.cxx 
b/sw/source/uibase/uiview/srcview.cxx
index 7eb1db9..b29c897 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -631,8 +631,8 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const 
SvxSearchItem& rSearchItem,
         {
             if(bNotFoundMessage)
             {
-                MessageDialog(0, "InfoNotFoundDialog",
-                    "modules/swriter/ui/infonotfounddialog.ui").Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(nullptr, 
"InfoNotFoundDialog",
+                    "modules/swriter/ui/infonotfounddialog.ui")->Execute();
             }
             else if(!bRecursive)
             {
@@ -640,13 +640,13 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const 
SvxSearchItem& rSearchItem,
 
                 if (!bForward)
                 {
-                    nRet = MessageDialog(0, "QueryContinueEndDialog",
-                        
"modules/swriter/ui/querycontinueenddialog.ui").Execute();
+                    nRet = 
ScopedVclPtrInstance<MessageDialog>::Create(nullptr, "QueryContinueEndDialog",
+                        
"modules/swriter/ui/querycontinueenddialog.ui")->Execute();
                 }
                 else
                 {
-                    nRet = MessageDialog(0, "QueryContinueBeginDialog",
-                        
"modules/swriter/ui/querycontinuebegindialog.ui").Execute();
+                    nRet = 
ScopedVclPtrInstance<MessageDialog>::Create(nullptr, "QueryContinueBeginDialog",
+                        
"modules/swriter/ui/querycontinuebegindialog.ui")->Execute();
                 }
 
                 if (nRet == RET_YES)
@@ -829,7 +829,7 @@ void SwSrcView::Load(SwDocShell* pDocShell)
         else
         {
             vcl::Window *pTmpWindow = &GetViewFrame()->GetWindow();
-            MessageDialog(pTmpWindow, SW_RES(STR_ERR_SRCSTREAM), 
VCL_MESSAGE_INFO).Execute();
+            ScopedVclPtrInstance<MessageDialog>::Create(pTmpWindow, 
SW_RES(STR_ERR_SRCSTREAM), VCL_MESSAGE_INFO)->Execute();
         }
     }
     else
diff --git a/sw/source/uibase/uiview/uivwimp.cxx 
b/sw/source/uibase/uiview/uivwimp.cxx
index 3ede0e3..54ceb1f 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -182,7 +182,7 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq )
 
             if( !bDone )
             {
-                MessageDialog( 0, SW_RES(STR_SCAN_NOSOURCE), VCL_MESSAGE_INFO 
).Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create( nullptr, 
SW_RES(STR_SCAN_NOSOURCE), VCL_MESSAGE_INFO )->Execute();
                 rReq.Ignore();
             }
             else
diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index b6f947d..02b58fb 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -2233,7 +2233,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* 
pMedium, sal_Int16 nVe
             if (!bCompare && !nFound)
             {
                 vcl::Window* pWin = &GetEditWin();
-                MessageDialog(pWin, SW_RES(STR_NO_MERGE_ENTRY), 
VCL_MESSAGE_INFO).Execute();
+                ScopedVclPtrInstance<MessageDialog>::Create(pWin, 
SW_RES(STR_NO_MERGE_ENTRY), VCL_MESSAGE_INFO)->Execute();
             }
             if( nRet==2 && xDocSh.Is() )
                 xDocSh->DoClose();
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index 9a17407..d3ef95a 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -842,7 +842,7 @@ void DbgGUIStart()
     }
     else
     {
-        MessageDialog(0, OUString("TOOLS Library has no 
Debug-Routines")).Execute();
+        ScopedVclPtrInstance<MessageDialog>::Create(nullptr, OUString("TOOLS 
Library has no Debug-Routines"))->Execute();
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to