[Libreoffice-commits] core.git: basic/source chart2/inc chart2/source cui/source desktop/source filter/source include/sfx2 include/svtools include/vcl oox/source sc/source sd/source sfx2/source svtools/inc svtools/source svx/source toolkit/source vcl/source vcl/unx

Caolán McNamara caolanm at redhat.com
Tue Feb 27 09:53:29 UTC 2018


 basic/source/basmgr/basmgr.cxx                                             |    1 
 basic/source/runtime/basrdll.cxx                                           |    1 
 basic/source/runtime/runtime.cxx                                           |    1 
 chart2/inc/pch/precompiled_chartcontroller.hxx                             |    1 
 chart2/source/controller/dialogs/DataBrowser.cxx                           |   15 ++-
 chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx                |    1 
 chart2/source/controller/dialogs/dlg_DataEditor.cxx                        |    1 
 chart2/source/controller/dialogs/dlg_DataSource.cxx                        |    1 
 chart2/source/controller/dialogs/dlg_View3D.cxx                            |    2 
 chart2/source/controller/dialogs/res_DataLabel.cxx                         |    1 
 chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx               |    1 
 chart2/source/controller/dialogs/tp_AxisPositions.cxx                      |    1 
 chart2/source/controller/dialogs/tp_ChartType.cxx                          |    1 
 chart2/source/controller/dialogs/tp_DataSource.cxx                         |    1 
 chart2/source/controller/dialogs/tp_Scale.cxx                              |    7 +
 chart2/source/controller/main/ChartController.cxx                          |    1 
 chart2/source/controller/main/ChartController_EditData.cxx                 |    1 
 chart2/source/controller/main/ChartController_Insert.cxx                   |    1 
 chart2/source/controller/main/ChartController_Position.cxx                 |    1 
 chart2/source/controller/main/ChartController_Properties.cxx               |    1 
 chart2/source/controller/main/ChartController_TextEdit.cxx                 |    1 
 chart2/source/controller/main/ChartController_Window.cxx                   |    1 
 chart2/source/controller/main/ShapeController.cxx                          |    1 
 cui/source/customize/SvxToolbarConfigPage.cxx                              |    1 
 cui/source/customize/cfg.cxx                                               |    7 +
 cui/source/customize/macropg.cxx                                           |    1 
 cui/source/dialogs/cuicharmap.cxx                                          |    1 
 cui/source/dialogs/cuigrfflt.cxx                                           |    1 
 cui/source/dialogs/cuiimapwnd.cxx                                          |    1 
 cui/source/dialogs/dlgname.cxx                                             |    1 
 cui/source/dialogs/hangulhanjadlg.cxx                                      |    1 
 cui/source/dialogs/hldocntp.cxx                                            |   15 ++-
 cui/source/dialogs/hyphen.cxx                                              |    1 
 cui/source/dialogs/pastedlg.cxx                                            |    1 
 cui/source/dialogs/postdlg.cxx                                             |    1 
 cui/source/dialogs/showcols.cxx                                            |    1 
 cui/source/dialogs/srchxtra.cxx                                            |    1 
 cui/source/dialogs/thesdlg.cxx                                             |    1 
 cui/source/dialogs/thesdlg_impl.hxx                                        |    1 
 cui/source/dialogs/zoom.cxx                                                |    1 
 cui/source/factory/init.cxx                                                |    1 
 cui/source/inc/SvxMenuConfigPage.hxx                                       |    1 
 cui/source/inc/SvxToolbarConfigPage.hxx                                    |    1 
 cui/source/inc/hltpbase.hxx                                                |    1 
 cui/source/inc/iconcdlg.hxx                                                |    1 
 cui/source/options/cuisrchdlg.cxx                                          |    1 
 cui/source/options/dbregister.cxx                                          |    1 
 cui/source/options/optchart.cxx                                            |    1 
 cui/source/options/optcolor.cxx                                            |    1 
 cui/source/options/optgenrl.cxx                                            |    1 
 cui/source/options/optlingu.cxx                                            |    1 
 cui/source/options/optpath.cxx                                             |    1 
 cui/source/options/optsave.cxx                                             |    1 
 cui/source/tabpages/autocdlg.cxx                                           |    1 
 cui/source/tabpages/backgrnd.cxx                                           |    1 
 cui/source/tabpages/border.cxx                                             |    1 
 cui/source/tabpages/chardlg.cxx                                            |    1 
 cui/source/tabpages/numpages.cxx                                           |    1 
 cui/source/tabpages/tabarea.cxx                                            |    1 
 cui/source/tabpages/tabline.cxx                                            |    1 
 cui/source/tabpages/tpcolor.cxx                                            |    1 
 cui/source/tabpages/tpgradnt.cxx                                           |    1 
 cui/source/tabpages/tphatch.cxx                                            |    1 
 cui/source/tabpages/tpline.cxx                                             |    1 
 cui/source/tabpages/tplneend.cxx                                           |    1 
 cui/source/tabpages/tppattern.cxx                                          |    1 
 desktop/source/pkgchk/unopkg/unopkg_misc.cxx                               |   11 +-
 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx                       |    8 +
 include/sfx2/objsh.hxx                                                     |    4 
 include/svtools/ServerDetailsControls.hxx                                  |    1 
 include/vcl/msgbox.hxx                                                     |    9 -
 oox/source/ppt/pptimport.cxx                                               |    8 +
 sc/source/ui/condformat/colorformat.cxx                                    |    9 +
 sc/source/ui/docshell/docsh.cxx                                            |   28 +++--
 sc/source/ui/docshell/docsh4.cxx                                           |   48 ++++++----
 sc/source/ui/docshell/externalrefmgr.cxx                                   |   11 +-
 sd/source/filter/html/htmlex.cxx                                           |   11 +-
 sd/source/ui/animations/CustomAnimationDialog.cxx                          |   12 +-
 sd/source/ui/animations/SlideTransitionPane.cxx                            |   12 +-
 sd/source/ui/dlg/LayerTabBar.cxx                                           |   10 +-
 sd/source/ui/dlg/PhotoAlbumDialog.cxx                                      |    8 +
 sd/source/ui/dlg/animobjs.cxx                                              |    9 +
 sd/source/ui/dlg/custsdlg.cxx                                              |   10 +-
 sd/source/ui/dlg/tpoption.cxx                                              |   10 +-
 sd/source/ui/func/fucopy.cxx                                               |    1 
 sd/source/ui/func/fulinend.cxx                                             |   10 +-
 sd/source/ui/func/fumorph.cxx                                              |    1 
 sd/source/ui/func/fuscale.cxx                                              |    1 
 sd/source/ui/view/DocumentRenderer.cxx                                     |   14 +-
 sd/source/ui/view/drviews2.cxx                                             |   21 ++--
 sfx2/source/appl/opengrf.cxx                                               |   11 +-
 sfx2/source/dialog/securitypage.cxx                                        |   11 +-
 sfx2/source/doc/objstor.cxx                                                |   11 +-
 sfx2/source/view/viewsh.cxx                                                |    4 
 svtools/inc/pch/precompiled_svt.hxx                                        |    1 
 svtools/source/config/test/test.cxx                                        |    1 
 svtools/source/dialogs/PlaceEditDialog.cxx                                 |    1 
 svtools/source/dialogs/addresstemplate.cxx                                 |    1 
 svtools/source/dialogs/wizardmachine.cxx                                   |    1 
 svtools/source/filter/exportdialog.cxx                                     |    1 
 svtools/source/filter/exportdialog.hxx                                     |    1 
 svtools/source/uno/genericunodialog.cxx                                    |    2 
 svtools/source/uno/wizard/wizardshell.cxx                                  |    3 
 svx/source/dialog/ClassificationDialog.cxx                                 |    1 
 svx/source/dialog/_contdlg.cxx                                             |    1 
 svx/source/dialog/databaseregistrationui.cxx                               |    1 
 svx/source/dialog/grfflt.cxx                                               |    1 
 svx/source/dialog/hdft.cxx                                                 |    1 
 svx/source/dialog/imapdlg.cxx                                              |    1 
 svx/source/dialog/imapwnd.cxx                                              |    1 
 svx/source/dialog/srchdlg.cxx                                              |    1 
 svx/source/dialog/stddlg.cxx                                               |    2 
 svx/source/dialog/svxbmpnumvalueset.cxx                                    |    1 
 svx/source/engine3d/float3d.cxx                                            |    1 
 svx/source/form/fmexpl.cxx                                                 |    1 
 svx/source/form/fmsrcimp.cxx                                               |    1 
 svx/source/form/fmtextcontrolshell.cxx                                     |    1 
 svx/source/form/fmvwimp.cxx                                                |    1 
 svx/source/form/formcontroller.cxx                                         |    1 
 svx/source/form/xfm_addcondition.cxx                                       |    3 
 svx/source/gallery2/galbrws1.cxx                                           |    1 
 svx/source/gallery2/galbrws2.cxx                                           |    1 
 svx/source/svdraw/svdedtv2.cxx                                             |    1 
 svx/source/table/tablecontroller.cxx                                       |    1 
 svx/source/tbxctrls/grafctrl.cxx                                           |    1 
 svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx      |    1 
 svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx |    1 
 svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx     |    1 
 toolkit/source/awt/vclxtoolkit.cxx                                         |   13 ++
 vcl/source/window/msgbox.cxx                                               |   17 ---
 vcl/unx/x11/x11sys.cxx                                                     |   27 +----
 131 files changed, 233 insertions(+), 275 deletions(-)

New commits:
commit 0fad8d308122a862aa49dece498d56a418df2afe
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 26 13:28:48 2018 +0000

    convert remaining WarningBox to weld::MessageDialog
    
    Change-Id: I7e3c156a6ad47ac232636ae274280c1cb7556d4a

diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index b50fbfcc900e..95d06630e1d2 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -25,7 +25,6 @@
 #include <vcl/svapp.hxx>
 #include <vcl/window.hxx>
 #include <vcl/wrkwin.hxx>
-#include <vcl/msgbox.hxx>
 #include <basic/sbx.hxx>
 #include <sot/storinfo.hxx>
 #include <unotools/pathoptions.hxx>
diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index b5949524ccc8..af5b7a2403aa 100644
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -21,7 +21,6 @@
 #include <vcl/svapp.hxx>
 #include <svl/solar.hrc>
 #include <tools/debug.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/weld.hxx>
 #include <vcl/settings.hxx>
 
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 4c2b52d1ca81..23573424b09d 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -37,7 +37,6 @@
 
 #include <tools/wldcrd.hxx>
 
-#include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 
diff --git a/chart2/inc/pch/precompiled_chartcontroller.hxx b/chart2/inc/pch/precompiled_chartcontroller.hxx
index afce85d48159..30880931d066 100644
--- a/chart2/inc/pch/precompiled_chartcontroller.hxx
+++ b/chart2/inc/pch/precompiled_chartcontroller.hxx
@@ -147,7 +147,6 @@
 #include <vcl/metaact.hxx>
 #include <vcl/metaactiontypes.hxx>
 #include <vcl/metric.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/notebookbar.hxx>
 #include <vcl/outdev.hxx>
 #include <vcl/outdevmap.hxx>
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index b16a20a57401..2864c840a353 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -36,7 +36,6 @@
 #include <vcl/fixed.hxx>
 #include <vcl/image.hxx>
 #include <vcl/layout.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/weld.hxx>
 #include <vcl/settings.hxx>
 #include <rtl/math.hxx>
@@ -131,8 +130,12 @@ void SeriesHeaderEdit::MouseButtonDown( const MouseEvent& rMEvt )
     Edit::MouseButtonDown( rMEvt );
 
     if( m_bShowWarningBox )
-        ScopedVclPtrInstance<WarningBox>(this, MessBoxStyle::Ok,
-                   SchResId(STR_INVALID_NUMBER))->Execute();
+    {
+        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+                                                   VclMessageType::Warning, VclButtonsType::Ok,
+                                                   SchResId(STR_INVALID_NUMBER)));
+        xWarn->run();
+    }
 }
 
 class SeriesHeader
@@ -752,8 +755,10 @@ void DataBrowser::MouseButtonDown( const BrowserMouseEvent& rEvt )
 
 void DataBrowser::ShowWarningBox()
 {
-    ScopedVclPtrInstance<WarningBox>(this, MessBoxStyle::Ok,
-                                     SchResId(STR_INVALID_NUMBER))->Execute();
+    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+                                               VclMessageType::Warning, VclButtonsType::Ok,
+                                               SchResId(STR_INVALID_NUMBER)));
+    xWarn->run();
 }
 
 bool DataBrowser::ShowQueryBox()
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
index ff9ecc746ebd..29b8cfc7185b 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
@@ -24,7 +24,6 @@
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include <toolkit/awt/vclxwindow.hxx>
-#include <vcl/msgbox.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <comphelper/servicehelper.hxx>
diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.cxx b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
index 9392444e8494..d30b01cfe212 100644
--- a/chart2/source/controller/dialogs/dlg_DataEditor.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
@@ -23,7 +23,6 @@
 
 #include <ResId.hxx>
 #include <sfx2/dispatch.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/taskpanelist.hxx>
 #include <svtools/miscopt.hxx>
 #include <unotools/pathoptions.hxx>
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx
index 0c666cba08c7..60c7a153ea62 100644
--- a/chart2/source/controller/dialogs/dlg_DataSource.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx
@@ -28,7 +28,6 @@
 #include "tp_DataSource.hxx"
 
 #include <vcl/layout.hxx>
-#include <vcl/msgbox.hxx> // for RET_OK
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::chart2;
diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx
index 7b731f863bd2..8c7e97122f08 100644
--- a/chart2/source/controller/dialogs/dlg_View3D.cxx
+++ b/chart2/source/controller/dialogs/dlg_View3D.cxx
@@ -28,8 +28,6 @@
 #include <ControllerLockGuard.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
 
-#include <vcl/msgbox.hxx>
-
 namespace chart
 {
 
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
index a81c46a51d5f..fb3cc7783eb8 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -29,7 +29,6 @@
 #include <svl/ilstitem.hxx>
 #include <editeng/eeitem.hxx>
 #include <editeng/frmdiritem.hxx>
-#include <vcl/msgbox.hxx>
 #include <svx/svxids.hrc>
 #include <svl/zforlist.hxx>
 #include <svtools/controldims.hxx>
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index 0c63a6f003c2..4e759a59ed24 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -28,7 +28,6 @@
 #include <svx/dialmgr.hxx>
 #include <rtl/math.hxx>
 #include <svtools/colrdlg.hxx>
-#include <vcl/msgbox.hxx>
 #include <svx/svx3ditems.hxx>
 #include <svx/svddef.hxx>
 #include <vcl/builderfactory.hxx>
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.cxx b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
index 9225d9831967..6e0edb6fb9d0 100644
--- a/chart2/source/controller/dialogs/tp_AxisPositions.cxx
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
@@ -30,7 +30,6 @@
 #include <svx/chrtitem.hxx>
 #include <svl/eitem.hxx>
 #include <svl/intitem.hxx>
-#include <vcl/msgbox.hxx>
 #include <svl/zformat.hxx>
 #include <svtools/controldims.hxx>
 
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index d69f88aed855..f1d0df70a1de 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -31,7 +31,6 @@
 #include <svtools/miscopt.hxx>
 
 #include <vcl/layout.hxx>
-#include <vcl/msgbox.hxx>
 
 namespace chart
 {
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index ea5c7f6ef704..2e6db479409e 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -34,7 +34,6 @@
 #include <com/sun/star/util/XModifiable.hpp>
 #include <com/sun/star/chart2/data/XDataSink.hpp>
 
-#include <vcl/msgbox.hxx>
 #include <rtl/ustrbuf.hxx>
 
 #include <functional>
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
index 024341aa2bc1..868dc2812a2b 100644
--- a/chart2/source/controller/dialogs/tp_Scale.cxx
+++ b/chart2/source/controller/dialogs/tp_Scale.cxx
@@ -29,7 +29,7 @@
 #include <svx/chrtitem.hxx>
 #include <svl/eitem.hxx>
 #include <svl/intitem.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/weld.hxx>
 #include <svl/zformat.hxx>
 #include <svtools/controldims.hxx>
 
@@ -614,7 +614,10 @@ bool ScaleTabPage::ShowWarning(const char* pResIdMessage, Control* pControl /* =
     if (pResIdMessage == nullptr)
         return false;
 
-    ScopedVclPtrInstance<WarningBox>(this, MessBoxStyle::Ok, SchResId(pResIdMessage))->Execute();
+    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+                                               VclMessageType::Warning, VclButtonsType::Ok,
+                                               SchResId(pResIdMessage)));
+    xWarn->run();
     if( pControl )
     {
         pControl->GrabFocus();
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index bb2e6c71eabb..8ad8cb32ce3b 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -69,7 +69,6 @@
 #include <com/sun/star/chart2/XDataProviderAccess.hpp>
 
 #include <svx/sidebar/SelectionChangeHandler.hxx>
-#include <vcl/msgbox.hxx>
 #include <toolkit/awt/vclxwindow.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <vcl/svapp.hxx>
diff --git a/chart2/source/controller/main/ChartController_EditData.cxx b/chart2/source/controller/main/ChartController_EditData.cxx
index 3ad6b90b8770..a274a1e402df 100644
--- a/chart2/source/controller/main/ChartController_EditData.cxx
+++ b/chart2/source/controller/main/ChartController_EditData.cxx
@@ -27,7 +27,6 @@
 #include <ResId.hxx>
 #include <strings.hrc>
 
-#include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
 #include <com/sun/star/chart2/XChartDocument.hpp>
 
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx
index 5ad74c244d2f..3589d0cc2d02 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -55,7 +55,6 @@
 #include <com/sun/star/chart/ErrorBarStyle.hpp>
 #include <svx/ActionDescriptionProvider.hxx>
 
-#include <vcl/msgbox.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <vcl/svapp.hxx>
 
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx
index e0dee1b7f8d1..3c11b591d469 100644
--- a/chart2/source/controller/main/ChartController_Position.cxx
+++ b/chart2/source/controller/main/ChartController_Position.cxx
@@ -31,7 +31,6 @@
 #include <CommonConverters.hxx>
 #include <svx/ActionDescriptionProvider.hxx>
 
-#include <vcl/msgbox.hxx>
 #include <svx/svxids.hrc>
 #include <svx/rectenum.hxx>
 #include <svl/aeitem.hxx>
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index 46f5579542ad..bcbe8d303930 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -54,7 +54,6 @@
 
 #include <memory>
 
-#include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
 #include <svx/ActionDescriptionProvider.hxx>
 
diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx
index 9c129617fc6a..5b5378b5f7d1 100644
--- a/chart2/source/controller/main/ChartController_TextEdit.cxx
+++ b/chart2/source/controller/main/ChartController_TextEdit.cxx
@@ -31,7 +31,6 @@
 #include <chartview/DrawModelWrapper.hxx>
 
 #include <svx/svdotext.hxx>
-#include <vcl/msgbox.hxx>
 #include <svx/svdoutl.hxx>
 #include <svx/svxdlg.hxx>
 #include <svx/dialogs.hrc>
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index d00f9e73a2dc..e3df574732de 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -72,7 +72,6 @@
 #include <svx/svddrgmt.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/weld.hxx>
 #include <rtl/math.hxx>
 #include <svtools/acceleratorexecute.hxx>
diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx
index aabf175e0e33..6abf9a97f1ed 100644
--- a/chart2/source/controller/main/ShapeController.cxx
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -29,7 +29,6 @@
 #include <com/sun/star/frame/CommandGroup.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
 
-#include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
 #include <editeng/formatbreakitem.hxx>
 #include <svx/dialogs.hrc>
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index dcd70890d45c..50511fdecf3e 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -27,7 +27,6 @@
 #include <vcl/commandinfoprovider.hxx>
 #include <vcl/help.hxx>
 #include <vcl/weld.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/decoview.hxx>
 #include <vcl/toolbox.hxx>
 #include <vcl/scrbar.hxx>
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index f26bbd6ff085..6f6ec630d613 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -28,7 +28,6 @@
 #include <vcl/help.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/weld.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/decoview.hxx>
 #include <vcl/toolbox.hxx>
 #include <vcl/scrbar.hxx>
@@ -3137,7 +3136,11 @@ IMPL_LINK_NOARG( SvxIconSelectorDialog, ImportHdl, Button *, void)
 IMPL_LINK_NOARG( SvxIconSelectorDialog, DeleteHdl, Button *, void )
 {
     OUString message = CuiResId( RID_SVXSTR_DELETE_ICON_CONFIRM );
-    if (ScopedVclPtrInstance<WarningBox>(this, MessBoxStyle::OkCancel, message)->Execute() == RET_OK)
+
+    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+                                               VclMessageType::Warning, VclButtonsType::OkCancel,
+                                               message));
+    if (xWarn->run() == RET_OK)
     {
         ToolBox::ImplToolItems::size_type nCount = pTbSymbol->GetItemCount();
 
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 0aadee3e1191..3c6e3be3fa1b 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -21,7 +21,6 @@
 
 #include <macropg.hxx>
 #include <vcl/layout.hxx>
-#include <vcl/msgbox.hxx>
 #include <svtools/svmedit.hxx>
 #include <svtools/svlbitm.hxx>
 #include <svtools/treelistentry.hxx>
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index 83e99cd10bf2..49aba8503618 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -28,7 +28,6 @@
 #include <rtl/textenc.h>
 #include <svx/ucsubset.hxx>
 #include <sfx2/objsh.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/builderfactory.hxx>
 #include <vcl/fontcharmap.hxx>
diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx
index 2040cbaeaaa3..33480fc1e697 100644
--- a/cui/source/dialogs/cuigrfflt.cxx
+++ b/cui/source/dialogs/cuigrfflt.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <vcl/builderfactory.hxx>
-#include <vcl/msgbox.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/viewsh.hxx>
 #include <sfx2/objsh.hxx>
diff --git a/cui/source/dialogs/cuiimapwnd.cxx b/cui/source/dialogs/cuiimapwnd.cxx
index 90ba66cd86ce..bcf2b908793a 100644
--- a/cui/source/dialogs/cuiimapwnd.cxx
+++ b/cui/source/dialogs/cuiimapwnd.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <tools/urlobj.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/help.hxx>
 #include <sfx2/sfxsids.hrc>
 #include <macroass.hxx>
diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index f04cf726d5a0..eddb0450ecc2 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <vcl/msgbox.hxx>
 #include <dlgname.hxx>
 #include <defdlgname.hxx>
 #include <dialmgr.hxx>
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index b26c7b0b6beb..75b4ad9317f4 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -25,7 +25,6 @@
 
 #include <algorithm>
 #include <vcl/controllayout.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/builderfactory.hxx>
 #include <vcl/decoview.hxx>
 #include <unotools/lingucfg.hxx>
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index ed4732749268..b071ce6a1be1 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -25,7 +25,8 @@
 #include <com/sun/star/uno/Sequence.h>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/uno/Exception.hpp>
-#include <vcl/image.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <tools/urlobj.hxx>
 #include <unotools/pathoptions.hxx>
 #include <unotools/dynamicmenuoptions.hxx>
@@ -276,8 +277,10 @@ bool SvxHyperlinkNewDocTp::AskApply()
     bool bRet = ImplGetURLObject( m_pCbbPath->GetText(), m_pCbbPath->GetBaseURL(), aINetURLObject );
     if ( !bRet )
     {
-        ScopedVclPtrInstance< WarningBox > aWarning( this, MessBoxStyle::Ok, CuiResId(RID_SVXSTR_HYPDLG_NOVALIDFILENAME) );
-        aWarning->Execute();
+        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+                                                   VclMessageType::Warning, VclButtonsType::Ok,
+                                                   CuiResId(RID_SVXSTR_HYPDLG_NOVALIDFILENAME)));
+        xWarn->run();
     }
     return bRet;
 }
@@ -324,8 +327,10 @@ void SvxHyperlinkNewDocTp::DoApply ()
 
                 if( bOk )
                 {
-                    ScopedVclPtrInstance<WarningBox> aWarning( this, MessBoxStyle::YesNo, CuiResId(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE) );
-                    bCreate = aWarning->Execute() == RET_YES;
+                    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+                                                               VclMessageType::Warning, VclButtonsType::YesNo,
+                                                               CuiResId(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE)));
+                    bCreate = xWarn->run() == RET_YES;
                 }
             }
 
diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx
index 29e8a5ce6f9d..9c4cb2deaba5 100644
--- a/cui/source/dialogs/hyphen.cxx
+++ b/cui/source/dialogs/hyphen.cxx
@@ -26,7 +26,6 @@
 #include <svtools/langtab.hxx>
 #include <svx/dialmgr.hxx>
 #include <svx/dlgutil.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/builderfactory.hxx>
 
 #define HYPH_POS_CHAR       '='
diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx
index 33fafa758654..6aa845b39001 100644
--- a/cui/source/dialogs/pastedlg.cxx
+++ b/cui/source/dialogs/pastedlg.cxx
@@ -28,7 +28,6 @@
 #include <vcl/fixed.hxx>
 #include <vcl/group.hxx>
 #include <vcl/lstbox.hxx>
-#include <vcl/msgbox.hxx>
 #include <sot/exchange.hxx>
 #include <sot/formats.hxx>
 #include <svtools/strings.hrc>
diff --git a/cui/source/dialogs/postdlg.cxx b/cui/source/dialogs/postdlg.cxx
index 147e696b4b4c..a79630834e9e 100644
--- a/cui/source/dialogs/postdlg.cxx
+++ b/cui/source/dialogs/postdlg.cxx
@@ -20,7 +20,6 @@
 #include <tools/date.hxx>
 #include <tools/time.hxx>
 #include <vcl/svapp.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <svl/itempool.hxx>
 #include <svl/itemset.hxx>
diff --git a/cui/source/dialogs/showcols.cxx b/cui/source/dialogs/showcols.cxx
index b27fa36930b3..c1ed32a86a9c 100644
--- a/cui/source/dialogs/showcols.cxx
+++ b/cui/source/dialogs/showcols.cxx
@@ -21,7 +21,6 @@
 #include <strings.hrc>
 
 #include <dialmgr.hxx>
-#include <vcl/msgbox.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <comphelper/types.hxx>
 
diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx
index 366fac3cb7b1..650ecd0066a9 100644
--- a/cui/source/dialogs/srchxtra.cxx
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <srchxtra.hxx>
-#include <vcl/msgbox.hxx>
 #include <svl/cjkoptions.hxx>
 #include <svl/whiter.hxx>
 #include <sfx2/objsh.hxx>
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index bc4d8ca58ce3..3bd8b5cfd451 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -29,7 +29,6 @@
 #include <svtools/treelistentry.hxx>
 #include <svtools/viewdataentry.hxx>
 #include <vcl/wrkwin.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/builderfactory.hxx>
 #include <svx/dlgutil.hxx>
diff --git a/cui/source/dialogs/thesdlg_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx
index 1b283c3c254d..afe84bdfcb77 100644
--- a/cui/source/dialogs/thesdlg_impl.hxx
+++ b/cui/source/dialogs/thesdlg_impl.hxx
@@ -31,7 +31,6 @@
 #include <vcl/image.hxx>
 #include <vcl/lstbox.hxx>
 #include <vcl/menubtn.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/timer.hxx>
 #include <vcl/wrkwin.hxx>
diff --git a/cui/source/dialogs/zoom.cxx b/cui/source/dialogs/zoom.cxx
index 3695c2feab8c..bb2700cafd05 100644
--- a/cui/source/dialogs/zoom.cxx
+++ b/cui/source/dialogs/zoom.cxx
@@ -21,7 +21,6 @@
 #include <svl/itempool.hxx>
 #include <sfx2/objsh.hxx>
 #include <vcl/layout.hxx>
-#include <vcl/msgbox.hxx>
 #include <zoom.hxx>
 #include <sfx2/zoomitem.hxx>
 #include <svx/viewlayoutitem.hxx>
diff --git a/cui/source/factory/init.cxx b/cui/source/factory/init.cxx
index d11370702024..9fc291ec0607 100644
--- a/cui/source/factory/init.cxx
+++ b/cui/source/factory/init.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <vcl/msgbox.hxx>
 #include <cuicharmap.hxx>
 
 // hook to call special character dialog for edits
diff --git a/cui/source/inc/SvxMenuConfigPage.hxx b/cui/source/inc/SvxMenuConfigPage.hxx
index 3763dcaffe77..7f5eb33c39e4 100644
--- a/cui/source/inc/SvxMenuConfigPage.hxx
+++ b/cui/source/inc/SvxMenuConfigPage.hxx
@@ -42,7 +42,6 @@
 #include <sfx2/tabdlg.hxx>
 #include <memory>
 #include <vector>
-#include <vcl/msgbox.hxx>
 
 #include "cfgutil.hxx"
 #include "cfg.hxx" //for SvxConfigPage and SaveInData
diff --git a/cui/source/inc/SvxToolbarConfigPage.hxx b/cui/source/inc/SvxToolbarConfigPage.hxx
index aedc7066678c..d854f45af833 100644
--- a/cui/source/inc/SvxToolbarConfigPage.hxx
+++ b/cui/source/inc/SvxToolbarConfigPage.hxx
@@ -42,7 +42,6 @@
 #include <sfx2/tabdlg.hxx>
 #include <memory>
 #include <vector>
-#include <vcl/msgbox.hxx>
 
 //#include "cfgutil.hxx"
 #include "cfg.hxx" //for SvxConfigPage and SaveInData
diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx
index 4c78d1223d60..f3a6eb723579 100644
--- a/cui/source/inc/hltpbase.hxx
+++ b/cui/source/inc/hltpbase.hxx
@@ -31,7 +31,6 @@
 #include <svl/eitem.hxx>
 #include <svtools/transfer.hxx>
 #include <sfx2/dispatch.hxx>
-#include <vcl/msgbox.hxx>
 #include <sfx2/fcontnr.hxx>
 #include <svtools/inettbc.hxx>
 #include <vcl/timer.hxx>
diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx
index 0ef081c08543..759c9a0999b0 100644
--- a/cui/source/inc/iconcdlg.hxx
+++ b/cui/source/inc/iconcdlg.hxx
@@ -22,7 +22,6 @@
 #include <rtl/ustring.hxx>
 #include <svtools/ivctrl.hxx>
 #include <vcl/tabpage.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/dialog.hxx>
 #include <vcl/button.hxx>
 #include <vcl/image.hxx>
diff --git a/cui/source/options/cuisrchdlg.cxx b/cui/source/options/cuisrchdlg.cxx
index 5dd6a16d9417..7db7d315b805 100644
--- a/cui/source/options/cuisrchdlg.cxx
+++ b/cui/source/options/cuisrchdlg.cxx
@@ -19,7 +19,6 @@
 
 #include <vcl/wrkwin.hxx>
 #include <vcl/morebtn.hxx>
-#include <vcl/msgbox.hxx>
 #include <svl/slstitm.hxx>
 #include <svl/itemiter.hxx>
 #include <svl/style.hxx>
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index 1d3cf77c746b..b5ff1f0a2f07 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -35,7 +35,6 @@
 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
-#include <vcl/msgbox.hxx>
 #include <svtools/svtabbx.hxx>
 #include <svl/itemset.hxx>
 #include "doclinkdialog.hxx"
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
index 6cb02b2731f7..608336cae751 100644
--- a/cui/source/options/optchart.cxx
+++ b/cui/source/options/optchart.cxx
@@ -21,7 +21,6 @@
 #include "optchart.hxx"
 #include <dialmgr.hxx>
 #include <vcl/builderfactory.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/weld.hxx>
 #include <vcl/svapp.hxx>
 #include <svx/svxids.hrc>
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 49d0d3dc79af..f4312f67cc22 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -31,7 +31,6 @@
 #include <svx/xtable.hxx>
 #include <unotools/moduleoptions.hxx>
 #include <unotools/pathoptions.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/builderfactory.hxx>
 #include <vcl/weld.hxx>
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index 872001b2f233..bd5472ac569f 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -27,7 +27,6 @@
 
 #include <i18nlangtag/mslangid.hxx>
 #include <vcl/svapp.hxx>
-#include <vcl/msgbox.hxx>
 #include <unotools/saveopt.hxx>
 #include <svl/intitem.hxx>
 #include <vcl/edit.hxx>
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index c2adea57d669..12f641aa5151 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <vcl/msgbox.hxx>
 #include <vcl/field.hxx>
 #include <vcl/fixed.hxx>
 #include <vcl/settings.hxx>
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index a37566835a7b..e053b3514d1c 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <svx/svxdlg.hxx>
-#include <vcl/msgbox.hxx>
 #include <sfx2/filedlghelper.hxx>
 #include <sfx2/app.hxx>
 #include <svl/aeitem.hxx>
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 8167af33add4..b6d46afa6aca 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -38,7 +38,6 @@
 #include <unotools/configitem.hxx>
 #include <unotools/optionsdlg.hxx>
 
-#include <vcl/msgbox.hxx>
 #include <sfx2/fcontnr.hxx>
 
 using namespace com::sun::star::uno;
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 7b575d0ed605..9fc095c3c9cf 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -19,7 +19,6 @@
 
 #include <i18nutil/unicode.hxx>
 #include <vcl/builderfactory.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/field.hxx>
 #include <vcl/keycodes.hxx>
 #include <vcl/settings.hxx>
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index a89591b092de..da9e79626002 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -21,7 +21,6 @@
 #include <com/sun/star/drawing/FillStyle.hpp>
 #include <unotools/pathoptions.hxx>
 #include <vcl/builderfactory.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/idle.hxx>
 #include <vcl/window.hxx>
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 0760e52d053d..2b08011cd1c9 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -35,7 +35,6 @@
 #include <svx/dlgutil.hxx>
 #include <dialmgr.hxx>
 #include <sfx2/htmlmode.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <svx/flagsdef.hxx>
 #include <sfx2/request.hxx>
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 7f34cb2246d4..a4cba1fa4c52 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -27,7 +27,6 @@
 #include <sfx2/viewsh.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/viewfrm.hxx>
-#include <vcl/msgbox.hxx>
 #include <svx/dialmgr.hxx>
 #include <svx/dialogs.hrc>
 #include <svtools/unitconv.hxx>
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 9eb975a44921..e46831efbf59 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -37,7 +37,6 @@
 #include <svl/intitem.hxx>
 #include <sfx2/objsh.hxx>
 #include <vcl/graph.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/builderfactory.hxx>
 #include <cuicharmap.hxx>
diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx
index 44f3ec016282..0fc1226cee46 100644
--- a/cui/source/tabpages/tabarea.cxx
+++ b/cui/source/tabpages/tabarea.cxx
@@ -19,7 +19,6 @@
 
 #include <sfx2/app.hxx>
 #include <sfx2/objsh.hxx>
-#include <vcl/msgbox.hxx>
 #include <unotools/pathoptions.hxx>
 #include <svx/svdmark.hxx>
 #include <svx/svdobj.hxx>
diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx
index 0dba49f80de9..195d077259e7 100644
--- a/cui/source/tabpages/tabline.cxx
+++ b/cui/source/tabpages/tabline.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <vcl/msgbox.hxx>
 #include <unotools/pathoptions.hxx>
 #include <sfx2/app.hxx>
 #include <sfx2/objsh.hxx>
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 85ffbce5373f..134e6a6f33c2 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -27,7 +27,6 @@
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/dispatch.hxx>
 #include <svtools/colrdlg.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/weld.hxx>
 #include <sfx2/filedlghelper.hxx>
 #include <svx/ofaitem.hxx>
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index 52cf295e245e..7f6bd0c98257 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -20,7 +20,6 @@
 #include <memory>
 #include <vcl/wrkwin.hxx>
 #include <tools/urlobj.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/weld.hxx>
 #include <unotools/pathoptions.hxx>
 #include <sfx2/app.hxx>
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index c34e72484f13..5d0add228d9b 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -19,7 +19,6 @@
 
 #include <memory>
 #include <tools/urlobj.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/weld.hxx>
 #include <unotools/pathoptions.hxx>
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 0ae280830694..c45d56bc5dc0 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -42,7 +42,6 @@
 #include <svx/svdview.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/numvset.hxx>
-#include <vcl/msgbox.hxx>
 #include <editeng/numitem.hxx>
 #include <editeng/svxenum.hxx>
 #include <sfx2/objsh.hxx>
diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx
index 621d90929028..9d42da7f7e3b 100644
--- a/cui/source/tabpages/tplneend.cxx
+++ b/cui/source/tabpages/tplneend.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <tools/urlobj.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/weld.hxx>
 #include <unotools/pathoptions.hxx>
diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx
index 611edb2cc557..4164990c1891 100644
--- a/cui/source/tabpages/tppattern.cxx
+++ b/cui/source/tabpages/tppattern.cxx
@@ -19,7 +19,6 @@
 
 #include <memory>
 #include <vcl/wrkwin.hxx>
-#include <vcl/msgbox.hxx>
 #include <tools/urlobj.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <unotools/pathoptions.hxx>
diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index bc440df922d5..aca6d5d0936a 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -22,7 +22,7 @@
 #include <stdio.h>
 
 #include <vcl/svapp.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/weld.hxx>
 #include <rtl/bootstrap.hxx>
 #include <rtl/strbuf.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -449,10 +449,11 @@ Reference<XComponentContext> getUNO(
                 if ( ! InitVCL() )
                     throw RuntimeException( "Cannot initialize VCL!" );
                 {
-                    ScopedVclPtrInstance< WarningBox > warn(nullptr, MessBoxStyle::Ok | MessBoxStyle::DefaultOk, sMsg);
-                    warn->SetText(utl::ConfigManager::getProductName());
-                    warn->SetIcon(0);
-                    warn->Execute();
+                    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(nullptr,
+                                                               VclMessageType::Warning, VclButtonsType::Ok,
+                                                               sMsg));
+                    xWarn->set_title(utl::ConfigManager::getProductName());
+                    xWarn->run();
                 }
                 DeInitVCL();
             }
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 88918bcdac29..fa0f745ff89c 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -31,7 +31,6 @@
 #include <osl/file.hxx>
 #include <o3tl/enumrange.hxx>
 #include <vcl/builderfactory.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/weld.hxx>
 #include <sfx2/filedlghelper.hxx>
@@ -775,8 +774,11 @@ void XMLFilterSettingsDialog::onDelete()
         OUString aMessage(XsltResId(STR_WARN_DELETE));
         aMessage = aMessage.replaceFirst( "%s", pInfo->maFilterName );
 
-        ScopedVclPtrInstance< WarningBox > aWarnBox(this, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, aMessage );
-        if( aWarnBox->Execute() == RET_YES )
+        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+                                                   VclMessageType::Warning, VclButtonsType::YesNo,
+                                                   aMessage));
+        xWarn->set_default_response(RET_YES);
+        if (xWarn->run() == RET_YES)
         {
             try
             {
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index a8a630259431..4bf859dadcc8 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -159,6 +159,8 @@ namespace o3tl
     template<> struct typed_flags<HiddenInformation> : is_typed_flags<HiddenInformation, 0x07> {};
 }
 
+namespace weld { class Window; }
+
 enum class HiddenWarningFact
 {
     WhenSaving = 0,
@@ -424,7 +426,7 @@ public:
 
     virtual bool                PrepareClose(bool bUI = true);
     virtual HiddenInformation   GetHiddenInformationState( HiddenInformation nStates );
-    sal_Int16                   QueryHiddenInformation( HiddenWarningFact eFact, vcl::Window* pParent );
+    sal_Int16                   QueryHiddenInformation( HiddenWarningFact eFact, weld::Window* pParent );
     bool                        IsSecurityOptOpenReadOnly() const;
     void                        SetSecurityOptOpenReadOnly( bool bOpenReadOnly );
 
diff --git a/include/svtools/ServerDetailsControls.hxx b/include/svtools/ServerDetailsControls.hxx
index 49965ad5e6f8..7f95c80a3b86 100644
--- a/include/svtools/ServerDetailsControls.hxx
+++ b/include/svtools/ServerDetailsControls.hxx
@@ -23,7 +23,6 @@
 #include <vcl/field.hxx>
 #include <vcl/fixed.hxx>
 #include <vcl/layout.hxx>
-#include <vcl/msgbox.hxx>
 
 class DetailsContainer
 {
diff --git a/include/vcl/msgbox.hxx b/include/vcl/msgbox.hxx
index 39b63d3e8a23..46dce1b0bc6a 100644
--- a/include/vcl/msgbox.hxx
+++ b/include/vcl/msgbox.hxx
@@ -84,15 +84,6 @@ public:
 VCL_DLLPUBLIC Image const & GetStandardInfoBoxImage();
 VCL_DLLPUBLIC OUString GetStandardInfoBoxText();
 
-class VCL_DLLPUBLIC WarningBox : public MessBox
-{
-public:
-                        WarningBox( vcl::Window* pParent, MessBoxStyle nStyle,
-                                    const OUString& rMessage );
-                        WarningBox( vcl::Window* pParent, MessBoxStyle nStyle, WinBits n,
-                                    const OUString& rMessage );
-};
-
 VCL_DLLPUBLIC Image const & GetStandardWarningBoxImage();
 VCL_DLLPUBLIC OUString GetStandardWarningBoxText();
 
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index 9af79983d28f..a4fda5c3fac4 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -25,8 +25,8 @@
 #include <com/sun/star/document/XUndoManagerSupplier.hpp>
 #include <comphelper/propertysequence.hxx>
 #include <osl/diagnose.h>
-#include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <svtools/sfxecode.hxx>
 #include <svtools/ehdl.hxx>
 #include <svtools/strings.hrc>
@@ -169,8 +169,10 @@ bool PowerPointImport::importDocument()
         aWarning += SvxResId(RID_SVXSTR_WARN_MISSING_SMARTART);
 
         // Show it.
-        ScopedVclPtrInstance<WarningBox> pBox(nullptr, MessBoxStyle::Ok | MessBoxStyle::DefaultOk, aWarning);
-        pBox->Execute();
+        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(nullptr,
+                                                   VclMessageType::Warning, VclButtonsType::Ok,
+                                                   aWarning));
+        xWarn->run();
     }
 
     if(xUndoManager.is() && bWasUnLocked)
diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx
index 7ea042d9d336..b86d2c3d1bee 100644
--- a/sc/source/ui/condformat/colorformat.cxx
+++ b/sc/source/ui/condformat/colorformat.cxx
@@ -16,7 +16,8 @@
 #include <svx/colorbox.hxx>
 #include <svx/xtable.hxx>
 #include <svx/drawitem.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 
 namespace {
 
@@ -256,8 +257,10 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl, Button*, void )
     if(bWarn)
     {
         //show warning message and don't close
-        ScopedVclPtrInstance< WarningBox > aWarn(this, MessBoxStyle::Ok, maStrWarnSameValue );
-        aWarn->Execute();
+        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+                                                   VclMessageType::Warning, VclButtonsType::Ok,
+                                                   maStrWarnSameValue));
+        xWarn->run();
     }
     else
     {
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index c8bbd5c93dd3..33a59ab41e5a 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -25,7 +25,6 @@
 #include <comphelper/fileformat.h>
 #include <comphelper/classids.hxx>
 #include <formula/errorcodes.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/weld.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/waitobj.hxx>
@@ -867,8 +866,14 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                                             OUString aMessage( ScGlobal::GetRscString( STR_FILE_LOCKED_SAVE_LATER ) );
                                             aMessage = aMessage.replaceFirst( "%1", aUserName );
 
-                                            ScopedVclPtrInstance< WarningBox > aBox( GetActiveDialogParent(), MessBoxStyle::RetryCancel | MessBoxStyle::DefaultRetry, aMessage );
-                                            if ( aBox->Execute() == RET_RETRY )
+                                            vcl::Window* pWin = GetActiveDialogParent();
+                                            std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                                                       VclMessageType::Warning, VclButtonsType::NONE,
+                                                                                       aMessage));
+                                            xWarn->add_button(Button::GetStandardText(StandardButtonType::Retry), RET_RETRY);
+                                            xWarn->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
+                                            xWarn->set_default_response(RET_RETRY);
+                                            if (xWarn->run() == RET_RETRY)
                                             {
                                                 bRetry = true;
                                             }
@@ -942,9 +947,11 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                                     }
                                     else
                                     {
-                                        ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(), MessBoxStyle::Ok,
-                                            ScGlobal::GetRscString( STR_DOC_NOLONGERSHARED ) );
-                                        aBox->Execute();
+                                        vcl::Window* pWin = GetActiveDialogParent();
+                                        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                                                   VclMessageType::Warning, VclButtonsType::Ok,
+                                                                                   ScGlobal::GetRscString(STR_DOC_NOLONGERSHARED)));
+                                        xWarn->run();
 
                                         SfxBindings* pBindings = GetViewBindings();
                                         if ( pBindings )
@@ -983,10 +990,11 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                 {
                     if ( GetDocument().GetExternalRefManager()->containsUnsavedReferences() )
                     {
-                        ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(), MessBoxStyle::YesNo,
-                                ScGlobal::GetRscString( STR_UNSAVED_EXT_REF ) );
-
-                        if( RET_NO == aBox->Execute())
+                        vcl::Window* pWin = GetActiveDialogParent();
+                        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                                   VclMessageType::Warning, VclButtonsType::YesNo,
+                                                                   ScGlobal::GetRscString(STR_UNSAVED_EXT_REF)));
+                        if (RET_NO == xWarn->run())
                         {
                             SetError(ERRCODE_IO_ABORT); // this error code will produce no error message, but will break the further saving process
                         }
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index f9e78ba99034..5091cafd1803 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -43,7 +43,6 @@ using namespace ::com::sun::star;
 #include <svtools/sfxecode.hxx>
 #include <svx/ofaitem.hxx>
 #include <svl/whiter.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/weld.hxx>
 #include <vcl/waitobj.hxx>
 #include <svx/dataaccessdescriptor.hxx>
@@ -619,10 +618,12 @@ void ScDocShell::Execute( SfxRequest& rReq )
                     if ( !pItem )
                     {
                         // no dialog on playing the macro
-                        ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(),
-                            MessBoxStyle::YesNo | MessBoxStyle::DefaultNo,
-                            ScGlobal::GetRscString( STR_END_REDLINING ) );
-                        bDo = ( aBox->Execute() == RET_YES );
+                        vcl::Window* pWin = GetActiveDialogParent();
+                        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                                   VclMessageType::Warning, VclButtonsType::YesNo,
+                                                                   ScGlobal::GetRscString(STR_END_REDLINING)));
+                        xWarn->set_default_response(RET_NO);
+                        bDo = (xWarn->run() == RET_YES );
                     }
 
                     if ( bDo )
@@ -684,10 +685,12 @@ void ScDocShell::Execute( SfxRequest& rReq )
                 {
                     if ( nSlot == SID_DOCUMENT_COMPARE )
                     {   //! old changes trace will be lost
-                        ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(),
-                            MessBoxStyle::YesNo | MessBoxStyle::DefaultNo,
-                            ScGlobal::GetRscString( STR_END_REDLINING ) );
-                        if( aBox->Execute() == RET_YES )
+                        vcl::Window* pWin = GetActiveDialogParent();
+                        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                                   VclMessageType::Warning, VclButtonsType::YesNo,
+                                                                   ScGlobal::GetRscString(STR_END_REDLINING)));
+                        xWarn->set_default_response(RET_NO);
+                        if (xWarn->run() == RET_YES)
                             bDo = ExecuteChangeProtectionDialog( true );
                         else
                             bDo = false;
@@ -1071,16 +1074,21 @@ void ScDocShell::Execute( SfxRequest& rReq )
                                         OUString aMessage( ScGlobal::GetRscString( STR_FILE_LOCKED_TRY_LATER ) );
                                         aMessage = aMessage.replaceFirst( "%1", aUserName );
 
-                                        ScopedVclPtrInstance< WarningBox > aBox( GetActiveDialogParent(), MessBoxStyle::Ok, aMessage );
-                                        aBox->Execute();
+                                        vcl::Window* pWin = GetActiveDialogParent();
+                                        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                                                   VclMessageType::Warning, VclButtonsType::Ok,
+                                                                                   aMessage));
+                                        xWarn->run();
                                     }
                                     else
                                     {
-                                        ScopedVclPtrInstance<WarningBox> aBox(
-                                            GetActiveDialogParent(),
-                                            MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
-                                            ScGlobal::GetRscString( STR_DOC_DISABLESHARED ) );
-                                        if ( aBox->Execute() == RET_YES )
+                                        vcl::Window* pWin = GetActiveDialogParent();
+                                        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                                                   VclMessageType::Warning, VclButtonsType::YesNo,
+                                                                                   ScGlobal::GetRscString(STR_DOC_DISABLESHARED)));
+                                        xWarn->set_default_response(RET_YES);
+
+                                        if (xWarn->run() == RET_YES)
                                         {
                                             xCloseable->close( true );
 
@@ -1112,9 +1120,11 @@ void ScDocShell::Execute( SfxRequest& rReq )
                                 else
                                 {
                                     xCloseable->close( true );
-                                    ScopedVclPtrInstance<WarningBox> aBox( GetActiveDialogParent(), MessBoxStyle::Ok,
-                                        ScGlobal::GetRscString( STR_DOC_NOLONGERSHARED ) );
-                                    aBox->Execute();
+                                    vcl::Window* pWin = GetActiveDialogParent();
+                                    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                                               VclMessageType::Warning, VclButtonsType::Ok,
+                                                                               ScGlobal::GetRscString(STR_DOC_NOLONGERSHARED)));
+                                    xWarn->run();
                                 }
                             }
                             catch ( uno::Exception& )
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 19f31dce2bea..9676d89b318d 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -51,7 +51,8 @@
 #include <tools/urlobj.hxx>
 #include <unotools/configmgr.hxx>
 #include <unotools/ucbhelper.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <stringutil.hxx>
 #include <scmatrix.hxx>
 #include <columnspanset.hxx>
@@ -3195,9 +3196,11 @@ void ScExternalRefManager::Notify( SfxBroadcaster&, const SfxHint& rHint )
         {
             case SfxEventHintId::PrepareCloseDoc:
                 {
-                    ScopedVclPtrInstance<WarningBox> aBox( ScDocShell::GetActiveDialogParent(), MessBoxStyle::Ok,
-                                        ScGlobal::GetRscString( STR_CLOSE_WITH_UNSAVED_REFS ) );
-                    aBox->Execute();
+                    vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
+                    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                               VclMessageType::Warning, VclButtonsType::Ok,
+                                                               ScGlobal::GetRscString(STR_CLOSE_WITH_UNSAVED_REFS)));
+                    xWarn->run();
                 }
                 break;
             case SfxEventHintId::SaveDocDone:
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 55cfc04e9266..1e8c666f68bb 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -37,13 +37,14 @@
 #include <sfx2/fcontnr.hxx>
 #include <sfx2/frmhtmlw.hxx>
 #include <sfx2/progress.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <vcl/wrkwin.hxx>
 #include <svl/aeitem.hxx>
 #include <svx/svditer.hxx>
 #include <svtools/imaprect.hxx>
 #include <svtools/imapcirc.hxx>
 #include <svtools/imappoly.hxx>
-#include <vcl/msgbox.hxx>
 #include <editeng/outlobj.hxx>
 #include <editeng/editobj.hxx>
 #include <svx/svdopath.hxx>
@@ -3097,8 +3098,12 @@ bool HtmlExport::checkForExistingFiles()
             osl::FileBase::getSystemPathFromFileURL( maExportPath, aSystemPath );
             OUString aMsg(SdResId(STR_OVERWRITE_WARNING));
             aMsg = aMsg.replaceFirst( "%FILENAME", aSystemPath );
-            ScopedVclPtrInstance< WarningBox > aWarning( nullptr, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, aMsg );
-            bFound = ( RET_NO == aWarning->Execute() );
+
+            std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(nullptr,
+                                                       VclMessageType::Warning, VclButtonsType::YesNo,
+                                                       aMsg));
+            xWarn->set_default_response(RET_YES);
+            bFound = (RET_NO == xWarn->run());
         }
     }
     catch( Exception& )
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index dad89d8f8ffe..7012cb278b36 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -45,7 +45,8 @@
 #include <vcl/field.hxx>
 #include <vcl/lstbox.hxx>
 #include <vcl/layout.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <vcl/decoview.hxx>
 #include <vcl/combobox.hxx>
 #include <vcl/menu.hxx>
@@ -1527,9 +1528,12 @@ void CustomAnimationEffectTabPage::openSoundFileDialog()
             {
                 OUString aStrWarning(SdResId(STR_WARNING_NOSOUNDFILE));
                 aStrWarning = aStrWarning.replaceFirst("%", aFile);
-                ScopedVclPtrInstance< WarningBox > aWarningBox( nullptr, MessBoxStyle::RetryCancel, WB_3DLOOK, aStrWarning );
-                aWarningBox->SetModalInputMode (true);
-                bQuitLoop = aWarningBox->Execute() != RET_RETRY;
+                std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(nullptr,
+                                                           VclMessageType::Warning, VclButtonsType::NONE,
+                                                           aStrWarning));
+                xWarn->add_button(Button::GetStandardText(StandardButtonType::Retry), RET_RETRY);
+                xWarn->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
+                bQuitLoop = xWarn->run() != RET_RETRY;
 
                 bValidSoundFile=false;
             }
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index 5204d0f3a8ff..0fe9d7292996 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -36,7 +36,8 @@
 #include <svtools/controldims.hxx>
 #include <svx/gallery.hxx>
 #include <unotools/pathoptions.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <tools/urlobj.hxx>
 #include <DrawViewShell.hxx>
 #include <slideshow.hxx>
@@ -768,9 +769,12 @@ void SlideTransitionPane::openSoundFileDialog()
             {
                 OUString aStrWarning(SdResId(STR_WARNING_NOSOUNDFILE));
                 aStrWarning = aStrWarning.replaceFirst("%", aFile);
-                ScopedVclPtrInstance< WarningBox > aWarningBox( nullptr, MessBoxStyle::RetryCancel, WB_3DLOOK, aStrWarning );
-                aWarningBox->SetModalInputMode (true);
-                bQuitLoop = (aWarningBox->Execute() != RET_RETRY);
+                std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(nullptr,
+                                                           VclMessageType::Warning, VclButtonsType::NONE,
+                                                           aStrWarning));
+                xWarn->add_button(Button::GetStandardText(StandardButtonType::Retry), RET_RETRY);
+                xWarn->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
+                bQuitLoop = (xWarn->run() != RET_RETRY);
 
                 bValidSoundFile = false;
             }
diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx
index 38238db341b7..bdfc7855897f 100644
--- a/sd/source/ui/dlg/LayerTabBar.cxx
+++ b/sd/source/ui/dlg/LayerTabBar.cxx
@@ -20,7 +20,8 @@
 #include <LayerTabBar.hxx>
 #include <svx/svdlayer.hxx>
 #include <svx/svdpagv.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <sfx2/dispatch.hxx>
 
 #include <sdattr.hxx>
@@ -274,9 +275,10 @@ TabBarAllowRenamingReturnCode LayerTabBar::AllowRenaming()
         (rLayerAdmin.GetLayer( aNewName ) && aLayerName != aNewName) )
     {
         // Name already exists
-        ScopedVclPtrInstance<WarningBox> aWarningBox( &pDrViewSh->GetViewFrame()->GetWindow(), MessBoxStyle::Ok,
-                                SdResId( STR_WARN_NAME_DUPLICATE ) );
-        aWarningBox->Execute();
+        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pDrViewSh->GetViewFrame()->GetWindow().GetFrameWeld(),
+                                                   VclMessageType::Warning, VclButtonsType::Ok,
+                                                   SdResId(STR_WARN_NAME_DUPLICATE)));
+        xWarn->run();
         bOK = false;
     }
 
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index adf5a386ee9f..c7d0c8243a27 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -25,7 +25,7 @@
 #include <unotools/ucbstreamhelper.hxx>
 #include <officecfg/Office/Impress.hxx>
 #include <svx/svdview.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
 #include <vcl/weld.hxx>
 #include <svx/unoshape.hxx>
 #include <svx/xfltrit.hxx>
@@ -110,8 +110,10 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl, Button*, void)
 {
     if (pImagesLst->GetEntryCount() == 0)
     {
-        ScopedVclPtrInstance< WarningBox > aWarning(this, MessBoxStyle::Ok, SdResId(STR_PHOTO_ALBUM_EMPTY_WARNING));
-        aWarning->Execute();
+        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+                                                   VclMessageType::Warning, VclButtonsType::Ok,
+                                                   SdResId(STR_PHOTO_ALBUM_EMPTY_WARNING)));
+        xWarn->run();
     }
     else
     {
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index b2786b38c451..9f0c5f3ed820 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -25,7 +25,8 @@
 #include <sfx2/basedlgs.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/progress.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 
 #include <anminfo.hxx>
 #include <animobjs.hxx>
@@ -439,8 +440,10 @@ IMPL_LINK( AnimationWindow, ClickRemoveBitmapHdl, Button*, pBtn, void )
     }
     else // delete everything
     {
-        ScopedVclPtrInstance< WarningBox > aWarnBox( this, MessBoxStyle::YesNo, SdResId( STR_ASK_DELETE_ALL_PICTURES ) );
-        short nReturn = aWarnBox->Execute();
+        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+                                                   VclMessageType::Warning, VclButtonsType::YesNo,
+                                                   SdResId(STR_ASK_DELETE_ALL_PICTURES)));
+        short nReturn = xWarn->run();
 
         if( nReturn == RET_YES )
         {
diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx
index 9e6bab218aa2..66fe0686076c 100644
--- a/sd/source/ui/dlg/custsdlg.cxx
+++ b/sd/source/ui/dlg/custsdlg.cxx
@@ -27,7 +27,8 @@
 #include <cusshow.hxx>
 #include <sdmod.hxx>
 #include <customshowlist.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <svtools/treelistentry.hxx>
 
 // SdCustomShowDlg
@@ -531,9 +532,10 @@ IMPL_LINK_NOARG(SdDefineCustomShowDlg, OKHdl, Button*, void)
     }
     else
     {
-        ScopedVclPtrInstance<WarningBox>( this, MessBoxStyle::Ok,
-                    SdResId( STR_WARN_NAME_DUPLICATE ) )->Execute();
-
+        std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+                                                   VclMessageType::Warning, VclButtonsType::Ok,
+                                                   SdResId(STR_WARN_NAME_DUPLICATE)));
+        xWarn->run();
         m_pEdtName->GrabFocus();
     }
 }
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index 944d1c1c06bf..a7381b2abd38 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -31,7 +31,8 @@
 #include <svx/dialogs.hrc>
 #include <svx/strarray.hxx>
 #include <svx/dlgutil.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 
 #include <sdattr.hxx>
 #include <sdresid.hxx>
@@ -367,9 +368,12 @@ DeactivateRC SdTpOptionsMisc::DeactivatePage( SfxItemSet* pActiveSet )
             FillItemSet( pActiveSet );
         return DeactivateRC::LeavePage;
     }
-    ScopedVclPtrInstance< WarningBox > aWarnBox( GetParent(), MessBoxStyle::YesNo, SdResId( STR_WARN_SCALE_FAIL ) );
 
-    if( aWarnBox->Execute() == RET_YES )
+    vcl::Window* pWin = GetParent();
+    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                               VclMessageType::Warning, VclButtonsType::YesNo,
+                                               SdResId(STR_WARN_SCALE_FAIL)));
+    if (xWarn->run() == RET_YES)
         return DeactivateRC::KeepPage;
 
     if( pActiveSet )
diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx
index f3389e861b30..a8cde2135f49 100644
--- a/sd/source/ui/func/fucopy.cxx
+++ b/sd/source/ui/func/fucopy.cxx
@@ -31,7 +31,6 @@
 #include <DrawDocShell.hxx>
 #include <vcl/wrkwin.hxx>
 #include <svx/svdobj.hxx>
-#include <vcl/msgbox.hxx>
 #include <sfx2/app.hxx>
 #include <svx/xcolit.hxx>
 #include <svx/xflclit.hxx>
diff --git a/sd/source/ui/func/fulinend.cxx b/sd/source/ui/func/fulinend.cxx
index 354d4b55e806..36aedff0551d 100644
--- a/sd/source/ui/func/fulinend.cxx
+++ b/sd/source/ui/func/fulinend.cxx
@@ -23,7 +23,8 @@
 #include <svx/dialogs.hrc>
 #include <svx/svdobj.hxx>
 #include <svx/svdopath.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 
 #include <strings.hrc>
 #include <ViewShell.hxx>
@@ -137,9 +138,10 @@ void FuLineEnd::DoExecute( SfxRequest& )
                 }
                 else
                 {
-                    ScopedVclPtrInstance<WarningBox> aWarningBox( mpWindow, MessBoxStyle::Ok,
-                            SdResId( STR_WARN_NAME_DUPLICATE ) );
-                    aWarningBox->Execute();
+                    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(mpWindow ? mpWindow->GetFrameWeld() : nullptr,
+                                                               VclMessageType::Warning, VclButtonsType::Ok,
+                                                               SdResId(STR_WARN_NAME_DUPLICATE)));
+                    xWarn->run();
                 }
             }
         }
diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx
index 16565daf57ad..b78c018747ed 100644
--- a/sd/source/ui/func/fumorph.cxx
+++ b/sd/source/ui/func/fumorph.cxx
@@ -20,7 +20,6 @@
 #include <fumorph.hxx>
 #include <svx/xfillit.hxx>
 #include <svx/xlineit.hxx>
-#include <vcl/msgbox.hxx>
 #include <svx/svdpool.hxx>
 #include <tools/poly.hxx>
 #include <svx/svdopath.hxx>
diff --git a/sd/source/ui/func/fuscale.cxx b/sd/source/ui/func/fuscale.cxx
index 33749b20c71e..7cb45019018d 100644
--- a/sd/source/ui/func/fuscale.cxx
+++ b/sd/source/ui/func/fuscale.cxx
@@ -31,7 +31,6 @@
 #include <ViewShell.hxx>
 #include <fuzoom.hxx>
 
-#include <vcl/msgbox.hxx>
 #include <svx/svdpagv.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/dispatch.hxx>
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index 91377f2b69f2..2e55d56edfe0 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -49,7 +49,8 @@
 #include <svx/xlnclit.hxx>
 #include <toolkit/awt/vclxdevice.hxx>
 #include <unotools/localedatawrapper.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <unotools/moduleoptions.hxx>
 #include <xmloff/autolayout.hxx>
 
@@ -1281,11 +1282,12 @@ public:
                 // Show warning that the orientation could not be set.
                 if (pViewShell)
                 {
-                    ScopedVclPtrInstance<WarningBox> aWarnBox(
-                        pViewShell->GetActiveWindow(),
-                        MessBoxStyle::OkCancel | MessBoxStyle::DefaultCancel,
-                        SdResId(STR_WARN_PRINTFORMAT_FAILURE));
-                    if (aWarnBox->Execute() != RET_OK)
+                    vcl::Window* pWin = pViewShell->GetActiveWindow();
+                    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                               VclMessageType::Warning, VclButtonsType::OkCancel,
+                                                               SdResId(STR_WARN_PRINTFORMAT_FAILURE)));
+                    xWarn->set_default_response(RET_CANCEL);
+                    if (xWarn->run() != RET_OK)
                         return;
                 }
             }
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 6d6dcad9e855..df48f77d5642 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -93,7 +93,6 @@
 #include <unotools/useroptions.hxx>
 
 #include <vcl/graph.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/waitobj.hxx>
 #include <vcl/weld.hxx>
@@ -1813,11 +1812,11 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                             || aLayerName.isEmpty() )
                         {
                             // name already exists
-                            ScopedVclPtrInstance<WarningBox> aWarningBox (
-                                GetParentWindow(),
-                                MessBoxStyle::Ok,
-                                SdResId(STR_WARN_NAME_DUPLICATE));
-                            aWarningBox->Execute();
+                            vcl::Window* pWin = GetParentWindow();
+                            std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                                       VclMessageType::Warning, VclButtonsType::Ok,
+                                                                       SdResId(STR_WARN_NAME_DUPLICATE)));
+                            xWarn->run();
                         }
                         else
                             bLoop = false;
@@ -1982,11 +1981,11 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                              aLayerName != aOldLayerName) || aLayerName.isEmpty() )
                         {
                             // name already exists
-                            ScopedVclPtrInstance<WarningBox> aWarningBox (
-                                GetParentWindow(),
-                                MessBoxStyle::Ok,
-                                SdResId(STR_WARN_NAME_DUPLICATE));
-                            aWarningBox->Execute();
+                            vcl::Window* pWin = GetParentWindow();
+                            std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                                       VclMessageType::Warning, VclButtonsType::Ok,
+                                                                       SdResId(STR_WARN_NAME_DUPLICATE)));
+                            xWarn->run();
                         }
                         else
                             bLoop = false;
diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx
index 6d190e45fce2..6698c1b70d99 100644
--- a/sfx2/source/appl/opengrf.cxx
+++ b/sfx2/source/appl/opengrf.cxx
@@ -39,7 +39,8 @@
 #include <unotools/ucbstreamhelper.hxx>
 #include <svtools/transfer.hxx>
 #include <sot/formats.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <sfx2/filedlghelper.hxx>
 #include <sfx2/docfile.hxx>
 #include <unotools/pathoptions.hxx>
@@ -157,8 +158,12 @@ ErrCode SvxOpenGraphicDialog::Execute()
             // could not load?
             if ( nFound == USHRT_MAX )
             {
-                ScopedVclPtrInstance< WarningBox > aWarningBox(nullptr, MessBoxStyle::RetryCancel, WB_3DLOOK, SfxResId( SvxOpenGrfErr2ResId(nImpRet) ));
-                bQuitLoop = aWarningBox->Execute() != RET_RETRY;
+                std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(nullptr,
+                                                           VclMessageType::Warning, VclButtonsType::NONE,
+                                                           SfxResId(SvxOpenGrfErr2ResId(nImpRet))));
+                xWarn->add_button(Button::GetStandardText(StandardButtonType::Retry), RET_RETRY);
+                xWarn->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
+                bQuitLoop = xWarn->run() != RET_RETRY;
             }
             else
             {
diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx
index eb45d935591d..8d9ef33a9293 100644
--- a/sfx2/source/dialog/securitypage.cxx
+++ b/sfx2/source/dialog/securitypage.cxx
@@ -31,7 +31,7 @@
 #include <vcl/button.hxx>
 #include <vcl/edit.hxx>
 #include <vcl/fixed.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
 #include <vcl/weld.hxx>
 #include <svl/eitem.hxx>
 #include <svl/poolitem.hxx>
@@ -332,9 +332,12 @@ IMPL_LINK_NOARG(SfxSecurityPage_Impl, RecordChangesCBToggleHdl, CheckBox&, void)
         bool bAlreadyDone = false;
         if (!m_bEndRedliningWarningDone)
         {
-            ScopedVclPtrInstance<WarningBox> aBox(m_rMyTabPage.GetParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultNo,
-                    m_aEndRedliningWarning );
-            if (aBox->Execute() != RET_YES)
+            vcl::Window* pWin = m_rMyTabPage.GetParent();
+            std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+                                                       VclMessageType::Warning, VclButtonsType::YesNo,
+                                                       m_aEndRedliningWarning));
+            xWarn->set_default_response(RET_NO);
+            if (xWarn->run() != RET_YES)
                 bAlreadyDone = true;
             else
                 m_bEndRedliningWarningDone = true;
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index fc290b791fd6..5de8041192d4 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -23,7 +23,6 @@
 
 #include <cassert>
 
-#include <vcl/msgbox.hxx>
 #include <svl/eitem.hxx>
 #include <svl/stritem.hxx>
 #include <svl/intitem.hxx>
@@ -97,6 +96,8 @@
 #include <comphelper/documentconstants.hxx>
 #include <comphelper/string.hxx>
 #include <vcl/bitmapex.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
 #include <svtools/embedhlp.hxx>
 #include <basic/modsizeexceeded.hxx>
 #include <officecfg/Office/Common.hxx>
@@ -2868,7 +2869,7 @@ HiddenInformation SfxObjectShell::GetHiddenInformationState( HiddenInformation n
     return nState;
 }
 
-sal_Int16 SfxObjectShell::QueryHiddenInformation( HiddenWarningFact eFact, vcl::Window* pParent )
+sal_Int16 SfxObjectShell::QueryHiddenInformation(HiddenWarningFact eFact, weld::Window* pParent)
 {
     sal_Int16 nRet = RET_YES;
     const char* pResId = nullptr;
@@ -2936,8 +2937,10 @@ sal_Int16 SfxObjectShell::QueryHiddenInformation( HiddenWarningFact eFact, vcl::
         {
             sMessage += "\n";
             sMessage += SfxResId(pResId);
-            ScopedVclPtrInstance< WarningBox > aWBox(pParent, MessBoxStyle::YesNo | MessBoxStyle::DefaultNo, sMessage);
-            nRet = aWBox->Execute();
+            std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pParent,
+                                                       VclMessageType::Warning, VclButtonsType::YesNo, sMessage));
+            xWarn->set_default_response(RET_NO);
+            nRet = xWarn->run();
         }
     }
 
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index f5b0f7399318..cdb960c9bed9 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -450,7 +450,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
         {
             SfxObjectShell* pDoc = GetObjectShell();
             if ( pDoc && pDoc->QueryHiddenInformation(
-                             HiddenWarningFact::WhenSaving, &GetViewFrame()->GetWindow() ) != RET_YES )
+                             HiddenWarningFact::WhenSaving, GetViewFrame()->GetWindow().GetFrameWeld() ) != RET_YES )
                 break;
 
 
@@ -514,7 +514,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
             SfxBluetoothModel aModel;
             SfxObjectShell* pDoc = GetObjectShell();
             if ( pDoc && pDoc->QueryHiddenInformation(
-                            HiddenWarningFact::WhenSaving, &GetViewFrame()->GetWindow() ) != RET_YES )
+                            HiddenWarningFact::WhenSaving, GetViewFrame()->GetWindow().GetFrameWeld() ) != RET_YES )
                 break;
             uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() );
             SfxMailModel::SendMailResult eResult = aModel.SaveAndSend( xFrame );
diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx
index bf6068638065..16029ba95cfa 100644
--- a/svtools/inc/pch/precompiled_svt.hxx
+++ b/svtools/inc/pch/precompiled_svt.hxx
@@ -133,7 +133,6 @@
 #include <vcl/menu.hxx>
 #include <vcl/metaact.hxx>
 #include <vcl/metric.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/notebookbar.hxx>
 #include <vcl/outdev.hxx>
 #include <vcl/salnativewidgets.hxx>
diff --git a/svtools/source/config/test/test.cxx b/svtools/source/config/test/test.cxx
index 85e5437af107..d4a7335770c7 100644
--- a/svtools/source/config/test/test.cxx
+++ b/svtools/source/config/test/test.cxx
@@ -43,7 +43,6 @@
 #include <vcl/event.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/wrkwin.hxx>
-#include <vcl/msgbox.hxx>
 
 using namespace ::osl                       ;
 using namespace ::comphelper                ;
diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx
index a8a09a739485..23eeaa21809b 100644
--- a/svtools/source/dialogs/PlaceEditDialog.cxx
+++ b/svtools/source/dialogs/PlaceEditDialog.cxx
@@ -14,7 +14,6 @@
 #include <officecfg/Office/Common.hxx>
 #include <svtools/svtresid.hxx>
 #include <svtools/strings.hrc>
-#include <vcl/msgbox.hxx>
 
 using namespace com::sun::star::uno;
 
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index c526c7744935..1dbb503bd506 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -28,7 +28,6 @@
 #include <comphelper/string.hxx>
 #include <vcl/stdtext.hxx>
 #include <vcl/waitobj.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/weld.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx
index b559d58e9e3e..ae5bdac443d3 100644
--- a/svtools/source/dialogs/wizardmachine.cxx
+++ b/svtools/source/dialogs/wizardmachine.cxx
@@ -21,7 +21,6 @@
 #include <svtools/helpids.h>
 #include <tools/debug.hxx>
 #include <tools/diagnose_ex.h>
-#include <vcl/msgbox.hxx>
 #include <svtools/svtresid.hxx>
 #include <svtools/strings.hrc>
 
diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx
index 931e4008dd27..8cc0ee5fb7f8 100644
--- a/svtools/source/filter/exportdialog.cxx
+++ b/svtools/source/filter/exportdialog.cxx
@@ -35,7 +35,6 @@
 #include <com/sun/star/io/XStream.hpp>
 #include <com/sun/star/view/XSelectionSupplier.hpp>
 #include <unotools/streamwrap.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/outdev.hxx>
 #include <vcl/graph.hxx>
diff --git a/svtools/source/filter/exportdialog.hxx b/svtools/source/filter/exportdialog.hxx
index ad41a4d8b125..59119350e7a3 100644
--- a/svtools/source/filter/exportdialog.hxx
+++ b/svtools/source/filter/exportdialog.hxx
@@ -28,7 +28,6 @@
 #include <vcl/field.hxx>
 #include <vcl/layout.hxx>
 #include <vcl/lstbox.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/slider.hxx>
 #include <com/sun/star/document/XExporter.hpp>
 #include <com/sun/star/drawing/XShape.hpp>
diff --git a/svtools/source/uno/genericunodialog.cxx b/svtools/source/uno/genericunodialog.cxx
index 94578e4cbe03..f6446e76ec62 100644
--- a/svtools/source/uno/genericunodialog.cxx
+++ b/svtools/source/uno/genericunodialog.cxx
@@ -30,8 +30,8 @@
 #include <comphelper/property.hxx>
 #include <osl/diagnose.h>
 #include <tools/diagnose_ex.h>
-#include <vcl/msgbox.hxx>
 #include <osl/mutex.hxx>
+#include <vcl/dialog.hxx>
 #include <vcl/svapp.hxx>
 
 using namespace ::comphelper;
diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx
index 0fe2faa4a903..4fa05361a3e9 100644
--- a/svtools/source/uno/wizard/wizardshell.cxx
+++ b/svtools/source/uno/wizard/wizardshell.cxx
@@ -25,9 +25,6 @@
 
 #include <com/sun/star/ui/dialogs/WizardTravelType.hpp>
 
-#include <vcl/msgbox.hxx>
-
-
 namespace svt { namespace uno
 {
 
diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx
index 7e8097e7e120..37ac145b5dc4 100644
--- a/svx/source/dialog/ClassificationDialog.cxx
+++ b/svx/source/dialog/ClassificationDialog.cxx
@@ -19,7 +19,6 @@
 #include <editeng/editobj.hxx>
 #include <editeng/wghtitem.hxx>
 #include <svl/itemset.hxx>
-#include <vcl/msgbox.hxx>
 #include <osl/file.hxx>
 #include <rtl/bootstrap.hxx>
 #include <rtl/uri.hxx>
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index 5cdae19699bc..322d06dfb970 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -21,7 +21,6 @@
 
 #include <vcl/wrkwin.hxx>
 #include <tools/helpers.hxx>
-#include <vcl/msgbox.hxx>
 #include <svl/eitem.hxx>
 #include <sfx2/ctrlitem.hxx>
 #include <sfx2/dispatch.hxx>
diff --git a/svx/source/dialog/databaseregistrationui.cxx b/svx/source/dialog/databaseregistrationui.cxx
index 980ab961e1be..ea4bff819e32 100644
--- a/svx/source/dialog/databaseregistrationui.cxx
+++ b/svx/source/dialog/databaseregistrationui.cxx
@@ -25,7 +25,6 @@
 
 #include <sfx2/app.hxx>
 #include <svl/itemset.hxx>
-#include <vcl/msgbox.hxx>
 #include <memory>
 
 namespace svx
diff --git a/svx/source/dialog/grfflt.cxx b/svx/source/dialog/grfflt.cxx
index 2d008bec558a..ac51b4b483c9 100644
--- a/svx/source/dialog/grfflt.cxx
+++ b/svx/source/dialog/grfflt.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <vcl/msgbox.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/viewsh.hxx>
 #include <sfx2/objsh.hxx>
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index e109b7472fa7..342d61471afe 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -21,7 +21,6 @@
 #include <sfx2/app.hxx>
 #include <sfx2/objsh.hxx>
 #include <sfx2/module.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/graph.hxx>
 #include <sfx2/sfxsids.hrc>
 #include <svx/svxids.hrc>
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index 1e200a128d18..6f3860285a3e 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -21,7 +21,6 @@
 #include <vcl/errinf.hxx>
 #include <tools/urlobj.hxx>
 #include <unotools/ucbstreamhelper.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/group.hxx>
 #include <vcl/lstbox.hxx>
 #include <svl/eitem.hxx>
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 69686edce864..c577bd8fb1e9 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <tools/urlobj.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/help.hxx>
 #include <sfx2/sfxsids.hrc>
 #include <svtools/imaprect.hxx>
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index d23133956212..3f822f5f84cb 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -21,7 +21,6 @@
 #include <sal/macros.h>
 #include <vcl/wrkwin.hxx>
 #include <vcl/morebtn.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/timer.hxx>
 #include <svl/slstitm.hxx>
 #include <svl/itemiter.hxx>
diff --git a/svx/source/dialog/stddlg.cxx b/svx/source/dialog/stddlg.cxx
index 9ae4ca27098f..f73e65e6e7b5 100644
--- a/svx/source/dialog/stddlg.cxx
+++ b/svx/source/dialog/stddlg.cxx
@@ -17,8 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <vcl/msgbox.hxx>
-
 #include <svx/stddlg.hxx>
 
 short SvxStandardDialog::Execute()
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx
index ec7df547a0dd..4da581ed1241 100644
--- a/svx/source/dialog/svxbmpnumvalueset.cxx
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -31,7 +31,6 @@
 #include <svl/intitem.hxx>
 #include <sfx2/objsh.hxx>
 #include <vcl/graph.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/builderfactory.hxx>
 #include <editeng/flstitem.hxx>
diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx
index 82b76e1f187e..1fe81614807b 100644
--- a/svx/source/engine3d/float3d.cxx
+++ b/svx/source/engine3d/float3d.cxx
@@ -25,7 +25,6 @@
 #include <sfx2/viewfrm.hxx>
 #include <svl/eitem.hxx>
 #include <svtools/colrdlg.hxx>
-#include <vcl/msgbox.hxx>
 #include <sfx2/viewsh.hxx>
 #include <svx/colorbox.hxx>
 #include <svx/xflclit.hxx>
diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx
index 394a76c48f70..28307c43af3c 100644
--- a/svx/source/form/fmexpl.cxx
+++ b/svx/source/form/fmexpl.cxx
@@ -37,7 +37,6 @@
 #include <svx/svditer.hxx>
 #include <svx/svdouno.hxx>
 #include <svx/svdobj.hxx>
-#include <vcl/msgbox.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/objsh.hxx>
 #include <sfx2/viewsh.hxx>
diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx
index a601ae6f2344..3efa7273dab3 100644
--- a/svx/source/form/fmsrcimp.cxx
+++ b/svx/source/form/fmsrcimp.cxx
@@ -24,7 +24,6 @@
 #include <tools/debug.hxx>
 #include <tools/diagnose_ex.h>
 #include <tools/wldcrd.hxx>
-#include <vcl/msgbox.hxx>
 #include <svx/dialmgr.hxx>
 #include <vcl/svapp.hxx>
 #include <unotools/textsearch.hxx>
diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx
index b4a1108a6766..86ff9b51be92 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -58,7 +58,6 @@
 #include <svl/whiter.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <tools/diagnose_ex.h>
-#include <vcl/msgbox.hxx>
 #include <vcl/outdev.hxx>
 
 #include <memory>
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index ba25b1ad29c4..a6e647c5f909 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -80,7 +80,6 @@
 #include <cppuhelper/exc_hlp.hxx>
 #include <unotools/moduleoptions.hxx>
 #include <tools/diagnose_ex.h>
-#include <vcl/msgbox.hxx>
 #include <vcl/stdtext.hxx>
 #include <connectivity/dbtools.hxx>
 
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index fffc0cd449ee..2408b2bf30ae 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -83,7 +83,6 @@
 #include <toolkit/helper/vclunohelper.hxx>
 #include <tools/debug.hxx>
 #include <tools/diagnose_ex.h>
-#include <vcl/msgbox.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <osl/mutex.hxx>
diff --git a/svx/source/form/xfm_addcondition.cxx b/svx/source/form/xfm_addcondition.cxx
index 8cbe432c395f..a16ad62628b0 100644
--- a/svx/source/form/xfm_addcondition.cxx
+++ b/svx/source/form/xfm_addcondition.cxx
@@ -24,13 +24,10 @@
 #include <cppuhelper/typeprovider.hxx>
 #include <datanavi.hxx>
 #include <fmservs.hxx>
-#include <vcl/msgbox.hxx>
-
 
 namespace svxform
 {
 
-
 #define PROPERTY_ID_BINDING             5724
 #define PROPERTY_ID_FORM_MODEL          5725
 #define PROPERTY_ID_FACET_NAME          5726
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index 2082050ecc4e..7a8525c25990 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -22,7 +22,6 @@
 #include <comphelper/processfactory.hxx>
 #include <tools/datetime.hxx>
 #include <unotools/datetime.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/weld.hxx>
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 43b79f3bd33a..34eb599082bd 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -20,7 +20,6 @@
 
 #include <comphelper/string.hxx>
 #include <sot/formats.hxx>
-#include <vcl/msgbox.hxx>
 #include <svl/urlbmk.hxx>
 #include <svl/stritem.hxx>
 #include <svl/intitem.hxx>
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index ac1f11f834f9..42380e506605 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -32,7 +32,6 @@
 #include "svdfmtf.hxx"
 #include <svx/svdetc.hxx>
 #include <sfx2/basedlgs.hxx>
-#include <vcl/msgbox.hxx>
 #include <editeng/outlobj.hxx>
 #include <editeng/eeitem.hxx>
 #include <basegfx/polygon/b2dpolypolygon.hxx>
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 804ebcb655a2..6fb9252cb273 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -64,7 +64,6 @@
 #include <svx/svdpage.hxx>
 #include "tableundo.hxx"
 #include "tablelayouter.hxx"
-#include <vcl/msgbox.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <memory>
 #include <o3tl/enumarray.hxx>
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index 73e27238bd2a..b08c22ea74a2 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -23,7 +23,6 @@
 #include <vcl/toolbox.hxx>
 #include <vcl/field.hxx>
 #include <vcl/fixed.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/idle.hxx>
 #include <svl/intitem.hxx>
 #include <svl/eitem.hxx>
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
index f339f0b6472f..f4d00ecd2475 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
@@ -30,7 +30,6 @@
 #include <svtools/headbar.hxx>
 #include <svtools/svlbitm.hxx>
 #include <svtools/treelistentry.hxx>
-#include <vcl/msgbox.hxx>
 #include <vcl/settings.hxx>
 #include <unotools/lingucfg.hxx>
 #include <unotools/linguprops.hxx>
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
index 0ce3530ccd5f..8a05397d74cf 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
@@ -22,7 +22,6 @@
 #include "chinese_translationdialog.hxx"
 #include <vcl/svapp.hxx>
 #include <toolkit/awt/vclxwindow.hxx>
-#include <vcl/msgbox.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <com/sun/star/beans/PropertyValue.hpp>
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
index d7ade209af60..a6ac160ebf2a 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
@@ -21,7 +21,6 @@
 #include "chinese_translationdialog.hxx"
 #include "chinese_dictionarydialog.hxx"
 #include <com/sun/star/i18n/TextConversionOption.hpp>
-#include <vcl/msgbox.hxx>
 #include <unotools/lingucfg.hxx>
 #include <unotools/linguprops.hxx>
 
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 1a3d10237bc4..272163fbc728 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -827,6 +827,19 @@ public:
     }
 };
 
+class WarningBox : public MessBox
+{
+public:
+    WarningBox(vcl::Window* pParent, MessBoxStyle nStyle, WinBits nWinBits, const OUString& rMessage)
+        : MessBox(pParent, nStyle, nWinBits, OUString(), rMessage)
+    {
+        // Default Text is the display title from the application
+        if (GetText().isEmpty())
+            SetText(GetStandardWarningBoxText());
+        SetImage(GetStandardWarningBoxImage());
+    }
+};
+
 vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
     const css::awt::WindowDescriptor& rDescriptor,
     vcl::Window* pParent, WinBits nWinBits, MessBoxStyle nMessBoxStyle )
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index 1b8f9d7d47fe..805eae6f8b4f 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -314,23 +314,6 @@ OUString GetStandardInfoBoxText()
     return VclResId(SV_MSGBOX_INFO);
 }
 
-WarningBox::WarningBox( vcl::Window* pParent, MessBoxStyle nStyle,
-                        const OUString& rMessage ) :
-    WarningBox( pParent, nStyle, 0, rMessage )
-{
-}
-
-WarningBox::WarningBox( vcl::Window* pParent, MessBoxStyle nStyle, WinBits nWinBits,
-                        const OUString& rMessage ) :
-    MessBox( pParent, nStyle, nWinBits, OUString(), rMessage )
-{
-    // Default Text is the display title from the application
-    if ( GetText().isEmpty() )
-        SetText(GetStandardWarningBoxText());
-
-    SetImage(GetStandardWarningBoxImage() );
-}
-
 Image const & GetStandardWarningBoxImage()
 {
     ImplInitMsgBoxImageList();
diff --git a/vcl/unx/x11/x11sys.cxx b/vcl/unx/x11/x11sys.cxx
index 50471e8fc06f..c354269b3a3d 100644
--- a/vcl/unx/x11/x11sys.cxx
+++ b/vcl/unx/x11/x11sys.cxx
@@ -22,8 +22,7 @@
 #include <unx/saldisp.hxx>
 #include <unx/x11/x11sys.hxx>
 
-#include <vcl/msgbox.hxx>
-#include <vcl/button.hxx>
+#include <vcl/weld.hxx>
 
 #include <svdata.hxx>
 
@@ -86,31 +85,21 @@ tools::Rectangle X11SalSystem::GetDisplayScreenPosSizePixel( unsigned int nScree
 
 int X11SalSystem::ShowNativeDialog( const OUString& rTitle, const OUString& rMessage, const std::vector< OUString >& rButtons )
 {
-    int nRet = -1;
-
     ImplSVData* pSVData = ImplGetSVData();
     if( pSVData->mpIntroWindow )
         pSVData->mpIntroWindow->Hide();
 
-    ScopedVclPtrInstance<WarningBox> aWarn(nullptr, MessBoxStyle::NONE, WB_STDWORK, rMessage);
-    aWarn->SetText( rTitle );
-    aWarn->Clear();
+    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(nullptr,
+                                               VclMessageType::Warning, VclButtonsType::NONE,
+                                               rMessage));
+    xWarn->set_title(rTitle);
 
     sal_uInt16 nButton = 0;
     for (auto const& button : rButtons)
-    {
-            aWarn->AddButton( button, nButton+1, (nButton == 0) ? ButtonDialogFlags::Default : ButtonDialogFlags::NONE );
-            nButton++;
-    }
-    aWarn->SetFocusButton( sal_uInt16(1) );
-
-    nRet = static_cast<int>(aWarn->Execute()) - 1;
-
-    // normalize behaviour, actually this should never happen
-    if( nRet < -1 || nRet >= int(rButtons.size()) )
-        nRet = -1;
+        xWarn->add_button(button, nButton++);
+    xWarn->set_default_response(0);
 
-    return nRet;
+    return xWarn->run();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list