[Libreoffice-commits] core.git: basctl/source cui/source dbaccess/source filter/source include/sfx2 include/svtools include/svx include/vcl sc/source sfx2/inc sfx2/source starmath/source svtools/source svx/source sw/source uui/source vcl/source writerperfect/source

Caolán McNamara caolanm at redhat.com
Fri Mar 9 12:48:21 UTC 2018


 basctl/source/basicide/bastypes.cxx                          |    2 
 basctl/source/basicide/moduldl2.cxx                          |    3 -
 basctl/source/basicide/moduldlg.hxx                          |    5 --
 cui/source/dialogs/dlgname.cxx                               |    3 -
 cui/source/dialogs/insrc.cxx                                 |    5 --
 cui/source/dialogs/scriptdlg.cxx                             |    3 -
 cui/source/dialogs/splitcelldlg.cxx                          |    5 --
 cui/source/inc/dlgname.hxx                                   |    8 ---
 cui/source/inc/insrc.hxx                                     |    4 -
 cui/source/inc/scriptdlg.hxx                                 |    5 --
 cui/source/inc/splitcelldlg.hxx                              |    4 -
 cui/source/options/securityoptions.cxx                       |    3 -
 cui/source/options/securityoptions.hxx                       |    7 ---
 dbaccess/source/ui/dlg/UserAdmin.cxx                         |    2 
 filter/source/pdf/impdialog.cxx                              |    2 
 include/sfx2/inputdlg.hxx                                    |    5 --
 include/sfx2/new.hxx                                         |    8 ---
 include/sfx2/passwd.hxx                                      |    9 ----
 include/svtools/fileview.hxx                                 |    7 ---
 include/svx/hdft.hxx                                         |   20 ++-------
 include/svx/linkwarn.hxx                                     |    7 ---
 include/vcl/weld.hxx                                         |   18 ++++++++
 sc/source/ui/docshell/docsh4.cxx                             |    2 
 sc/source/ui/docshell/impex.cxx                              |    2 
 sc/source/ui/inc/strindlg.hxx                                |    6 --
 sc/source/ui/inc/warnbox.hxx                                 |    8 +--
 sc/source/ui/miscdlgs/strindlg.cxx                           |    4 -
 sc/source/ui/miscdlgs/warnbox.cxx                            |    6 +-
 sc/source/ui/view/tabvwsh3.cxx                               |    6 +-
 sc/source/ui/view/viewfun3.cxx                               |    2 
 sfx2/inc/saveastemplatedlg.hxx                               |    5 --
 sfx2/source/appl/appserv.cxx                                 |   24 +++--------
 sfx2/source/dialog/alienwarn.cxx                             |    3 -
 sfx2/source/dialog/inputdlg.cxx                              |    3 -
 sfx2/source/dialog/passwd.cxx                                |    6 --
 sfx2/source/dialog/securitypage.cxx                          |    2 
 sfx2/source/doc/docinsert.cxx                                |    2 
 sfx2/source/doc/new.cxx                                      |    3 -
 sfx2/source/doc/saveastemplatedlg.cxx                        |    3 -
 sfx2/source/inc/alienwarn.hxx                                |    7 ---
 sfx2/source/view/viewfrm.cxx                                 |    9 +---
 starmath/source/dialog.cxx                                   |   10 +---
 svtools/source/contnr/fileview.cxx                           |    3 -
 svx/source/dialog/linkwarn.cxx                               |    3 -
 svx/source/form/datanavi.cxx                                 |    4 -
 svx/source/inc/datanavi.hxx                                  |    6 --
 sw/source/ui/chrdlg/break.cxx                                |   24 +++++------
 sw/source/ui/dialog/swdlgfact.cxx                            |    6 +-
 sw/source/ui/dialog/uiregionsw.cxx                           |    6 +-
 sw/source/ui/table/convert.cxx                               |    4 -
 sw/source/ui/table/splittbl.cxx                              |    3 -
 sw/source/ui/table/tautofmt.cxx                              |   16 ++-----
 sw/source/uibase/dbui/mailmergehelper.cxx                    |    2 
 sw/source/uibase/inc/break.hxx                               |    8 +--
 sw/source/uibase/inc/convert.hxx                             |    7 ---
 sw/source/uibase/inc/splittbl.hxx                            |    6 --
 sw/source/uibase/inc/tautofmt.hxx                            |    8 +--
 sw/source/uibase/uiview/view2.cxx                            |    4 -
 uui/source/sslwarndlg.cxx                                    |    3 -
 uui/source/sslwarndlg.hxx                                    |    7 ---
 uui/source/unknownauthdlg.cxx                                |    4 -
 uui/source/unknownauthdlg.hxx                                |    6 --
 vcl/source/app/salvtables.cxx                                |    6 ++
 writerperfect/source/calc/MSWorksCalcImportFilter.cxx        |    2 
 writerperfect/source/writer/StarOfficeWriterImportFilter.cxx |    2 
 writerperfect/source/writer/WordPerfectImportFilter.cxx      |    2 
 66 files changed, 147 insertions(+), 243 deletions(-)

New commits:
commit 48bca65f1cf381cba7cb7a4c3916155a1bca0955
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 8 09:49:36 2018 +0000

    inherit welded dialogs from a common ancestor
    
    Change-Id: Ifa6c871a134cf89bfba71b1049a115cf7c953c42
    Reviewed-on: https://gerrit.libreoffice.org/50936
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index d645a74fc272..e69e37c4aaa6 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -768,7 +768,7 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer,
         }
 
         // execute dialog
-        nRet = aDlg.run();
+        nRet = aDlg.execute();
 
         // verify password
         if ( nRet == RET_OK )
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 9062db209b33..a1a11613ca19 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -369,8 +369,7 @@ IMPL_LINK_NOARG(NewObjectDialog, OkButtonHandler, weld::Button&, void)
 }
 
 NewObjectDialog::NewObjectDialog(weld::Window * pParent, ObjectMode eMode, bool bCheckName)
-    : m_xBuilder(Application::CreateBuilder(pParent, "modules/BasicIDE/ui/newlibdialog.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("NewLibDialog"))
+    : GenericDialogController(pParent, "modules/BasicIDE/ui/newlibdialog.ui", "NewLibDialog")
     , m_xEdit(m_xBuilder->weld_entry("entry"))
     , m_xOKButton(m_xBuilder->weld_button("ok"))
     , m_bCheckName(bCheckName)
diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx
index b1fe48ad0ac4..ac9a4b37b7c7 100644
--- a/basctl/source/basicide/moduldlg.hxx
+++ b/basctl/source/basicide/moduldlg.hxx
@@ -42,11 +42,9 @@ enum class ObjectMode
     Dialog  = 3,
 };
 
-class NewObjectDialog
+class NewObjectDialog : public weld::GenericDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::Entry> m_xEdit;
     std::unique_ptr<weld::Button> m_xOKButton;
     bool m_bCheckName;
@@ -54,7 +52,6 @@ private:
     DECL_LINK(OkButtonHandler, weld::Button&, void);
 public:
     NewObjectDialog(weld::Window* pParent, ObjectMode, bool bCheckName = false);
-    short run() { return m_xDialog->run(); }
     OUString GetObjectName() const { return m_xEdit->get_text(); }
     void SetObjectName(const OUString& rName)
     {
diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index e8873de17ebd..e3ad99d3497e 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -29,8 +29,7 @@
 \************************************************************************/
 
 SvxNameDialog::SvxNameDialog(weld::Window* pParent, const OUString& rName, const OUString& rDesc)
-    : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/namedialog.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("NameDialog"))
+    : GenericDialogController(pParent, "cui/ui/namedialog.ui", "NameDialog")
     , m_xEdtName(m_xBuilder->weld_entry("name_entry"))
     , m_xFtDescription(m_xBuilder->weld_label("description_label"))
     , m_xBtnOK(m_xBuilder->weld_button("ok"))
diff --git a/cui/source/dialogs/insrc.cxx b/cui/source/dialogs/insrc.cxx
index 01e2335e6c8f..9e29733e7486 100644
--- a/cui/source/dialogs/insrc.cxx
+++ b/cui/source/dialogs/insrc.cxx
@@ -34,8 +34,7 @@ sal_uInt16 SvxInsRowColDlg::getInsertCount() const
 }
 
 SvxInsRowColDlg::SvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId)
-    : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/insertrowcolumn.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("InsertRowColumnDialog"))
+    : GenericDialogController(pParent, "cui/ui/insertrowcolumn.ui", "InsertRowColumnDialog")
     , m_xCountEdit(m_xBuilder->weld_spin_button("insert_number"))
     , m_xBeforeBtn(m_xBuilder->weld_radio_button("insert_before"))
     , m_xAfterBtn(m_xBuilder->weld_radio_button("insert_after"))
@@ -49,7 +48,7 @@ SvxInsRowColDlg::SvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString
 
 short SvxInsRowColDlg::Execute()
 {
-    return m_xDialog->run();
+    return run();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index f52317edec7c..1657140def76 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -405,8 +405,7 @@ void SFTreeListBox::ExpandedHdl()
 
 // CuiInputDialog ------------------------------------------------------------
 CuiInputDialog::CuiInputDialog(weld::Window * pParent, InputDialogMode nMode)
-    : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/newlibdialog.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("NewLibDialog"))
+    : GenericDialogController(pParent, "cui/ui/newlibdialog.ui", "NewLibDialog")
     , m_xEdit(m_xBuilder->weld_entry("entry"))
 {
     m_xEdit->grab_focus();
diff --git a/cui/source/dialogs/splitcelldlg.cxx b/cui/source/dialogs/splitcelldlg.cxx
index a465dafef186..4248f2fe3956 100644
--- a/cui/source/dialogs/splitcelldlg.cxx
+++ b/cui/source/dialogs/splitcelldlg.cxx
@@ -25,8 +25,7 @@
 #include <splitcelldlg.hxx>
 
 SvxSplitTableDlg::SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal)
-    : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/splitcellsdialog.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("SplitCellsDialog"))
+    : GenericDialogController(pParent, "cui/ui/splitcellsdialog.ui", "SplitCellsDialog")
     , m_xCountEdit(m_xBuilder->weld_spin_button("countnf"))
     , m_xHorzBox(!bIsTableVertical ? m_xBuilder->weld_radio_button("hori") : m_xBuilder->weld_radio_button("vert"))
     , m_xVertBox(!bIsTableVertical ? m_xBuilder->weld_radio_button("vert") : m_xBuilder->weld_radio_button("hori"))
@@ -84,7 +83,7 @@ long SvxSplitTableDlg::GetCount() const
 
 short SvxSplitTableDlg::Execute()
 {
-    return m_xDialog->run();
+    return run();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/dlgname.hxx b/cui/source/inc/dlgname.hxx
index 6c960ce114da..5543d9cf1dea 100644
--- a/cui/source/inc/dlgname.hxx
+++ b/cui/source/inc/dlgname.hxx
@@ -28,11 +28,9 @@
 #include <vcl/weld.hxx>
 
 /// Dialog for editing a name
-class SvxNameDialog
+class SvxNameDialog : public weld::GenericDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::Entry> m_xEdtName;
     std::unique_ptr<weld::Label> m_xFtDescription;
     std::unique_ptr<weld::Button> m_xBtnOK;
@@ -44,12 +42,8 @@ private:
 public:
     SvxNameDialog(weld::Window* pWindow, const OUString& rName, const OUString& rDesc);
 
-    void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
-    void set_help_id(const OString& rHelpId) { m_xDialog->set_help_id(rHelpId); }
     OUString GetName() const { return m_xEdtName->get_text(); }
 
-    short run() { return m_xDialog->run(); }
-
     /** add a callback Link that is called whenever the content of the edit
         field is changed.  The Link result determines whether the OK
         Button is enabled (> 0) or disabled (== 0).
diff --git a/cui/source/inc/insrc.hxx b/cui/source/inc/insrc.hxx
index b2e9cb96b70d..aed5617d8065 100644
--- a/cui/source/inc/insrc.hxx
+++ b/cui/source/inc/insrc.hxx
@@ -24,11 +24,9 @@
 #include <svx/stddlg.hxx>
 #include <vcl/weld.hxx>
 
-class SvxInsRowColDlg : public SvxAbstractInsRowColDlg
+class SvxInsRowColDlg : public SvxAbstractInsRowColDlg, public weld::GenericDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::SpinButton> m_xCountEdit;
     std::unique_ptr<weld::RadioButton> m_xBeforeBtn;
     std::unique_ptr<weld::RadioButton> m_xAfterBtn;
diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx
index 2b86a9ea515a..604c7a4c3f90 100644
--- a/cui/source/inc/scriptdlg.hxx
+++ b/cui/source/inc/scriptdlg.hxx
@@ -92,15 +92,12 @@ enum class InputDialogMode {
     RENAME        = 3,
 };
 
-class CuiInputDialog
+class CuiInputDialog : public weld::GenericDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::Entry> m_xEdit;
 public:
     CuiInputDialog(weld::Window * pParent, InputDialogMode nMode);
-    short run() { return m_xDialog->run(); }
     OUString GetObjectName() const { return m_xEdit->get_text(); }
     void SetObjectName(const OUString& rName)
     {
diff --git a/cui/source/inc/splitcelldlg.hxx b/cui/source/inc/splitcelldlg.hxx
index 868e6b7e72c5..02e7db683565 100644
--- a/cui/source/inc/splitcelldlg.hxx
+++ b/cui/source/inc/splitcelldlg.hxx
@@ -22,11 +22,9 @@
 #include <svx/svxdlg.hxx>
 #include <vcl/weld.hxx>
 
-class SvxSplitTableDlg : public SvxAbstractSplittTableDialog
+class SvxSplitTableDlg : public SvxAbstractSplittTableDialog, public weld::GenericDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::SpinButton> m_xCountEdit;
     std::unique_ptr<weld::RadioButton> m_xHorzBox;
     std::unique_ptr<weld::RadioButton> m_xVertBox;
diff --git a/cui/source/options/securityoptions.cxx b/cui/source/options/securityoptions.cxx
index ab4b1dd3d5a7..8273953cbe9c 100644
--- a/cui/source/options/securityoptions.cxx
+++ b/cui/source/options/securityoptions.cxx
@@ -40,8 +40,7 @@ namespace svx
 {
 
 SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* pParent, SvtSecurityOptions const * pOptions)
-    : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/securityoptionsdialog.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("SecurityOptionsDialog"))
+    : GenericDialogController(pParent, "cui/ui/securityoptionsdialog.ui", "SecurityOptionsDialog")
     , m_xSaveOrSendDocsCB(m_xBuilder->weld_check_button("savesenddocs"))
     , m_xSaveOrSendDocsImg(m_xBuilder->weld_widget("locksavesenddocs"))
     , m_xSignDocsCB(m_xBuilder->weld_check_button("whensigning"))
diff --git a/cui/source/options/securityoptions.hxx b/cui/source/options/securityoptions.hxx
index f88e8164ca2e..1176bd7fe818 100644
--- a/cui/source/options/securityoptions.hxx
+++ b/cui/source/options/securityoptions.hxx
@@ -26,12 +26,9 @@ class SvtSecurityOptions;
 namespace svx
 {
 
-    class SecurityOptionsDialog
+    class SecurityOptionsDialog : public weld::GenericDialogController
     {
     private:
-        std::unique_ptr<weld::Builder> m_xBuilder;
-        std::unique_ptr<weld::Dialog> m_xDialog;
-
         std::unique_ptr<weld::CheckButton> m_xSaveOrSendDocsCB;
         std::unique_ptr<weld::Widget> m_xSaveOrSendDocsImg;
         std::unique_ptr<weld::CheckButton> m_xSignDocsCB;
@@ -53,8 +50,6 @@ namespace svx
     public:
         SecurityOptionsDialog(weld::Window* pParent, SvtSecurityOptions const * pOptions);
 
-        short run() { return m_xDialog->run(); }
-
         bool IsSaveOrSendDocsChecked() const { return m_xSaveOrSendDocsCB->get_active(); }
         bool IsSignDocsChecked() const { return m_xSignDocsCB->get_active(); }
         bool IsPrintDocsChecked() const { return m_xPrintDocsCB->get_active(); }
diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx
index 1c7ce5531b15..645c6847d261 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.cxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.cxx
@@ -216,7 +216,7 @@ IMPL_LINK( OUserAdmin, UserHdl, Button *, pButton, void )
         {
             SfxPasswordDialog aPwdDlg(GetFrameWeld());
             aPwdDlg.ShowExtras(SfxShowExtras::ALL);
-            if (aPwdDlg.run())
+            if (aPwdDlg.execute())
             {
                 Reference<XDataDescriptorFactory> xUserFactory(m_xUsers,UNO_QUERY);
                 Reference<XPropertySet> xNewUser = xUserFactory->createDataDescriptor();
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 65579a7fd87c..e252156de5dc 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -1337,7 +1337,7 @@ IMPL_LINK_NOARG(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl, Button*, void)
     aPwdDialog.set_title(msStrSetPwd);
     aPwdDialog.SetGroup2Text(msOwnerPwdTitle);
     aPwdDialog.AllowAsciiOnly();
-    if (aPwdDialog.run() == RET_OK)  // OK issued get password and set it
+    if (aPwdDialog.execute() == RET_OK)  // OK issued get password and set it
     {
         OUString aUserPW(aPwdDialog.GetPassword());
         OUString aOwnerPW(aPwdDialog.GetPassword2());
diff --git a/include/sfx2/inputdlg.hxx b/include/sfx2/inputdlg.hxx
index bef84fcbd7f7..6f50e012e997 100644
--- a/include/sfx2/inputdlg.hxx
+++ b/include/sfx2/inputdlg.hxx
@@ -13,18 +13,15 @@
 #include <sfx2/dllapi.h>
 #include <vcl/weld.hxx>
 
-class SFX2_DLLPUBLIC InputDialog
+class SFX2_DLLPUBLIC InputDialog : public weld::GenericDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::Entry> m_xEntry;
     std::unique_ptr<weld::Label> m_xLabel;
     std::unique_ptr<weld::Button> m_xHelp;
 
 public:
     InputDialog(weld::Window* pParent, const OUString &rLabelText);
-    short run() { return m_xDialog->run(); }
     OUString GetEntryText() const;
     void SetEntryText(const OUString& rStr);
     void HideHelpBtn();
diff --git a/include/sfx2/new.hxx b/include/sfx2/new.hxx
index 91539cb7a048..e7c355db1341 100644
--- a/include/sfx2/new.hxx
+++ b/include/sfx2/new.hxx
@@ -54,11 +54,9 @@ namespace o3tl
 
 #define RET_TEMPLATE_LOAD       100
 
-class SFX2_DLLPUBLIC SfxNewFileDialog
+class SFX2_DLLPUBLIC SfxNewFileDialog : public weld::GenericDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::TreeView> m_xRegionLb;
     std::unique_ptr<weld::TreeView> m_xTemplateLb;
     std::unique_ptr<weld::CheckButton> m_xTextStyleCB;
@@ -87,9 +85,7 @@ private:
 
 public:
     SfxNewFileDialog(weld::Window *pParent, SfxNewFileDialogMode nFlags);
-    void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
-    short run() { return m_xDialog->run(); }
-    ~SfxNewFileDialog();
+    virtual ~SfxNewFileDialog() override;
 
     // Returns false, when '- No -' is set as Template
     // Template names can only be obtained when IsTemplate() returns true.
diff --git a/include/sfx2/passwd.hxx b/include/sfx2/passwd.hxx
index 2b30d56ae428..4c8b7f15868c 100644
--- a/include/sfx2/passwd.hxx
+++ b/include/sfx2/passwd.hxx
@@ -43,12 +43,9 @@ namespace o3tl
 
 // class SfxPasswordDialog -----------------------------------------------
 
-class SFX2_DLLPUBLIC SfxPasswordDialog
+class SFX2_DLLPUBLIC SfxPasswordDialog : public weld::GenericDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
-
     std::unique_ptr<weld::Frame> m_xPassword1Box;
     std::unique_ptr<weld::Label> m_xUserFT;
     std::unique_ptr<weld::Entry> m_xUserED;
@@ -128,9 +125,7 @@ public:
 
     void ShowMinLengthText(bool bShow);
 
-    void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
-    void set_help_id(const OString& rHelpId) { m_xDialog->set_help_id(rHelpId); }
-    short run();
+    short execute();
 };
 
 #endif // INCLUDED_SFX2_PASSWD_HXX
diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx
index 21a5098e89bf..6feb9d5c4837 100644
--- a/include/svtools/fileview.hxx
+++ b/include/svtools/fileview.hxx
@@ -209,17 +209,14 @@ enum QueryDeleteResult_Impl
     QUERYDELETE_ALL = 101
 };
 
-class SVT_DLLPUBLIC QueryDeleteDlg_Impl
+class SVT_DLLPUBLIC QueryDeleteDlg_Impl :  public weld::MessageDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::MessageDialog> m_xDialog;
     std::unique_ptr<weld::Button> m_xAllButton;
 public:
 
     QueryDeleteDlg_Impl(weld::Widget* pParent, const OUString& rName);
-    short run() { return m_xDialog->run(); }
-    ~QueryDeleteDlg_Impl();
+    virtual ~QueryDeleteDlg_Impl() override;
 
     void EnableAllButton() { m_xAllButton->set_sensitive(true); }
 };
diff --git a/include/svx/hdft.hxx b/include/svx/hdft.hxx
index e9bd472446c4..6ce1508b225a 100644
--- a/include/svx/hdft.hxx
+++ b/include/svx/hdft.hxx
@@ -121,32 +121,24 @@ public:
     SVX_DLLPRIVATE SvxFooterPage(   vcl::Window* pParent, const SfxItemSet& rSet );
 };
 
-class SVX_DLLPUBLIC DeleteHeaderDialog
+class SVX_DLLPUBLIC DeleteHeaderDialog : public weld::MessageDialogController
 {
-private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::MessageDialog> m_xDialog;
 public:
     DeleteHeaderDialog(weld::Widget* pParent)
-        : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/deleteheaderdialog.ui"))
-        , m_xDialog(m_xBuilder->weld_message_dialog("DeleteHeaderDialog"))
+        : MessageDialogController(pParent, "svx/ui/deleteheaderdialog.ui",
+                "DeleteHeaderDialog")
     {
     }
-    short run() { return m_xDialog->run(); }
 };
 
-class SVX_DLLPUBLIC DeleteFooterDialog
+class SVX_DLLPUBLIC DeleteFooterDialog : public weld::MessageDialogController
 {
-private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::MessageDialog> m_xDialog;
 public:
     DeleteFooterDialog(weld::Widget* pParent)
-        : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/deletefooterdialog.ui"))
-        , m_xDialog(m_xBuilder->weld_message_dialog("DeleteFooterDialog"))
+        : MessageDialogController(pParent, "svx/ui/deletefooterdialog.ui",
+                "DeleteFooterDialog")
     {
     }
-    short run() { return m_xDialog->run(); }
 };
 
 #endif
diff --git a/include/svx/linkwarn.hxx b/include/svx/linkwarn.hxx
index 96143fd0a68d..30598ffaf5f3 100644
--- a/include/svx/linkwarn.hxx
+++ b/include/svx/linkwarn.hxx
@@ -23,17 +23,14 @@
 #include <vcl/weld.hxx>
 #include <svx/svxdllapi.h>
 
-class SVX_DLLPUBLIC SvxLinkWarningDialog
+class SVX_DLLPUBLIC SvxLinkWarningDialog : public weld::MessageDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::MessageDialog> m_xDialog;
     std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
 
 public:
     SvxLinkWarningDialog(weld::Widget* pParent, const OUString& _rFileName);
-    short run() { return m_xDialog->run(); }
-    ~SvxLinkWarningDialog();
+    virtual ~SvxLinkWarningDialog() override;
 };
 
 #endif // INCLUDED_SVX_LINKWARN_HXX
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index ff3a1e8c346e..30cbaef2f607 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -566,6 +566,24 @@ protected:
 public:
     GenericDialogController(weld::Widget* pParent, const OUString& rUIFile,
                             const OString& rDialogId);
+    void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
+    void set_help_id(const OString& rHelpId) { m_xDialog->set_help_id(rHelpId); }
+};
+
+class VCL_DLLPUBLIC MessageDialogController : public DialogController
+{
+private:
+    virtual Dialog* getDialog() override { return m_xDialog.get(); }
+
+protected:
+    std::unique_ptr<weld::Builder> m_xBuilder;
+    std::unique_ptr<weld::MessageDialog> m_xDialog;
+
+public:
+    MessageDialogController(weld::Widget* pParent, const OUString& rUIFile,
+                            const OString& rDialogId);
+    void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
+    void set_help_id(const OString& rHelpId) { m_xDialog->set_help_id(rHelpId); }
 };
 }
 #endif
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 6a7d258c6c71..d0d95a28277f 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1293,7 +1293,7 @@ bool ScDocShell::ExecuteChangeProtectionDialog( bool bJustQueryIfProtected )
         aDlg.SetEditHelpId( HID_CHG_PROTECT );
         if ( !bProtected )
             aDlg.ShowExtras(SfxShowExtras::CONFIRM);
-        if (aDlg.run() == RET_OK)
+        if (aDlg.execute() == RET_OK)
             aPassword = aDlg.GetPassword();
 
         if (!aPassword.isEmpty())
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 11c3e29103ad..d6372e89ab0c 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1478,7 +1478,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
             {
                 vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
                 ScReplaceWarnBox aBox(pWin ? pWin->GetFrameWeld() : nullptr);
-                if (aBox.run() != RET_YES)
+                if (aBox.execute() != RET_YES)
                 {
                     return false;
                 }
diff --git a/sc/source/ui/inc/strindlg.hxx b/sc/source/ui/inc/strindlg.hxx
index 22dd85049f47..8d14f5ec5187 100644
--- a/sc/source/ui/inc/strindlg.hxx
+++ b/sc/source/ui/inc/strindlg.hxx
@@ -22,11 +22,9 @@
 
 #include <vcl/weld.hxx>
 
-class ScStringInputDlg
+class ScStringInputDlg : public weld::GenericDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::Label> m_xLabel;
     std::unique_ptr<weld::Entry> m_xEdInput;
 
@@ -37,8 +35,6 @@ public:
         const OUString& rDefault,
         const OString& sHelpId, const OString& sEditHelpId);
 
-    short run() { return m_xDialog->run(); }
-
     OUString GetInputString() const
     {
         return m_xEdInput->get_text();
diff --git a/sc/source/ui/inc/warnbox.hxx b/sc/source/ui/inc/warnbox.hxx
index d4a17d69b94f..54bdd269ebeb 100644
--- a/sc/source/ui/inc/warnbox.hxx
+++ b/sc/source/ui/inc/warnbox.hxx
@@ -24,21 +24,19 @@
 
 /** Warning box for "Replace cell contents?".
     With warning image and "Do not show again" checkbox. */
-class ScReplaceWarnBox
+class ScReplaceWarnBox : public weld::MessageDialogController
 {
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::MessageDialog> m_xDialog;
     std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
     std::unique_ptr<weld::Container> m_xOrigParent;
     std::unique_ptr<weld::Container> m_xContentArea;
 public:
     ScReplaceWarnBox(weld::Window* pParent);
-    ~ScReplaceWarnBox();
+    virtual ~ScReplaceWarnBox() override;
 
     /** Opens dialog if IsDialogEnabled() returns true.
         @descr  If after executing the dialog the checkbox "Do not show again" is set,
                 the method DisableDialog() will be called. */
-    short run();
+    short execute();
 };
 
 #endif
diff --git a/sc/source/ui/miscdlgs/strindlg.cxx b/sc/source/ui/miscdlgs/strindlg.cxx
index da9da0387e9a..d9100992db6b 100644
--- a/sc/source/ui/miscdlgs/strindlg.cxx
+++ b/sc/source/ui/miscdlgs/strindlg.cxx
@@ -28,8 +28,8 @@ ScStringInputDlg::ScStringInputDlg(weld::Window* pParent,
                                    const OUString& rEditTitle,
                                    const OUString& rDefault,
                                    const OString& rHelpId, const OString& rEditHelpId)
-    : m_xBuilder(Application::CreateBuilder(pParent, "modules/scalc/ui/inputstringdialog.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("InputStringDialog"))
+    : GenericDialogController(pParent, "modules/scalc/ui/inputstringdialog.ui",
+            "InputStringDialog")
     , m_xLabel(m_xBuilder->weld_label("description_label"))
     , m_xEdInput(m_xBuilder->weld_entry("name_entry"))
 {
diff --git a/sc/source/ui/miscdlgs/warnbox.cxx b/sc/source/ui/miscdlgs/warnbox.cxx
index dbe87229c6f9..bc0302c4bcbd 100644
--- a/sc/source/ui/miscdlgs/warnbox.cxx
+++ b/sc/source/ui/miscdlgs/warnbox.cxx
@@ -26,8 +26,8 @@
 #include <helpids.h>
 
 ScReplaceWarnBox::ScReplaceWarnBox(weld::Window* pParent)
-    : m_xBuilder(Application::CreateBuilder(pParent, "modules/scalc/ui/checkwarningdialog.ui"))
-    , m_xDialog(m_xBuilder->weld_message_dialog("CheckWarningDialog"))
+    : MessageDialogController(pParent, "modules/scalc/ui/checkwarningdialog.ui",
+            "CheckWarningDialog")
     // By default, the check box is ON, and the user needs to un-check it to
     // disable all future warnings.
     , m_xWarningOnBox(m_xBuilder->weld_check_button("ask"))
@@ -49,7 +49,7 @@ ScReplaceWarnBox::~ScReplaceWarnBox()
     m_xOrigParent->add(m_xWarningOnBox.get());
 }
 
-short ScReplaceWarnBox::run()
+short ScReplaceWarnBox::execute()
 {
     short nRet = RET_YES;
     if( SC_MOD()->GetInputOptions().GetReplaceCellsWarn() )
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index dde0b99b3484..4c9fae9e1a11 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -1067,7 +1067,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
                         aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand());
                         aDlg.SetEditHelpId(HID_PASSWD_DOC);
 
-                        if (aDlg.run() == RET_OK)
+                        if (aDlg.execute() == RET_OK)
                             aPassword = aDlg.GetPassword();
                         else
                             bCancel = true;
@@ -1091,7 +1091,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
                     aDlg.ShowExtras(SfxShowExtras::CONFIRM);
                     aDlg.SetConfirmHelpId(HID_PASSWD_DOC_CONFIRM);
 
-                    if (aDlg.run() == RET_OK)
+                    if (aDlg.execute() == RET_OK)
                     {
                         OUString aPassword = aDlg.GetPassword();
                         Protect( TABLEID_DOC, aPassword );
@@ -1137,7 +1137,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
                     aDlg.set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_TABLE)->GetCommand());
                     aDlg.SetEditHelpId(HID_PASSWD_TABLE);
 
-                    if (aDlg.run() == RET_OK)
+                    if (aDlg.execute() == RET_OK)
                     {
                         OUString aPassword = aDlg.GetPassword();
                         Unprotect(nTab, aPassword);
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index ae15097d2720..3afb0f466a32 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -841,7 +841,7 @@ bool checkDestRangeForOverwrite(const ScRangeList& rDestRanges, const ScDocument
     if (!bIsEmpty)
     {
         ScReplaceWarnBox aBox(pParentWnd);
-        if (aBox.run() != RET_YES)
+        if (aBox.execute() != RET_YES)
         {
             //  changing the configuration is within the ScReplaceWarnBox
             return false;
diff --git a/sfx2/inc/saveastemplatedlg.hxx b/sfx2/inc/saveastemplatedlg.hxx
index 8e7af6d3a448..cbd695be24cb 100644
--- a/sfx2/inc/saveastemplatedlg.hxx
+++ b/sfx2/inc/saveastemplatedlg.hxx
@@ -15,11 +15,9 @@
 #include <vcl/weld.hxx>
 
 //  class SfxSaveAsTemplateDialog -------------------------------------------------------------------
-class SfxSaveAsTemplateDialog
+class SfxSaveAsTemplateDialog : public weld::GenericDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::TreeView> m_xLBCategory;
     std::unique_ptr<weld::CheckButton> m_xCBXDefault;
     std::unique_ptr<weld::Entry> m_xTemplateNameEdit;
@@ -51,7 +49,6 @@ public:
 public:
     SfxSaveAsTemplateDialog(weld::Window* pParent,
                             const css::uno::Reference<css::frame::XModel>& rModel);
-    short run() { return m_xDialog->run(); }
 };
 
 #endif // INCLUDED_SFX2_INC_SAVEASTEMPLATEDLG_HXX
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 550578327d0b..f7765defa192 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -304,22 +304,18 @@ namespace
         return nullptr;
     }
 
-    class LicenseDialog
+    class LicenseDialog : public weld::GenericDialogController
     {
-    private:
-        std::unique_ptr<weld::Builder> m_xBuilder;
-        std::unique_ptr<weld::Dialog> m_xDialog;
         std::unique_ptr<weld::Label> m_xLabel;
     public:
         LicenseDialog(weld::Window* pParent)
-            : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/licensedialog.ui"))
-            , m_xDialog(m_xBuilder->weld_dialog("LicenseDialog"))
+            : GenericDialogController(pParent, "sfx/ui/licensedialog.ui",  "LicenseDialog")
             , m_xLabel(m_xBuilder->weld_label("label"))
         {
             m_xLabel->set_label(Translate::GetReadStringHook()(m_xLabel->get_label()));
         }
 
-        short run()
+        short execute()
         {
             short nRet = m_xDialog->run();
             if (nRet == RET_OK)
@@ -328,20 +324,16 @@ namespace
         }
     };
 
-    class SafeModeQueryDialog
+    class SafeModeQueryDialog : public weld::MessageDialogController
     {
-    private:
-        std::unique_ptr<weld::Builder> m_xBuilder;
-        std::unique_ptr<weld::MessageDialog> m_xDialog;
     public:
         SafeModeQueryDialog(weld::Window* pParent)
-            : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/safemodequerydialog.ui"))
-            , m_xDialog(m_xBuilder->weld_message_dialog("SafeModeQueryDialog"))
+            : MessageDialogController(pParent, "sfx/ui/safemodequerydialog.ui", "SafeModeQueryDialog")
         {
             m_xDialog->set_primary_text(Translate::GetReadStringHook()(m_xDialog->get_primary_text()));
         }
 
-        short run()
+        short execute()
         {
             short nRet = m_xDialog->run();
             if (nRet == RET_OK)
@@ -572,7 +564,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
         case SID_SHOW_LICENSE:
         {
             LicenseDialog aDialog(rReq.GetFrameWeld());
-            aDialog.run();
+            aDialog.execute();
             break;
         }
 
@@ -1036,7 +1028,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
         case SID_SAFE_MODE:
         {
             SafeModeQueryDialog aDialog(rReq.GetFrameWeld());
-            aDialog.run();
+            aDialog.execute();
             break;
         }
 
diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx
index dd88541fbb29..d9eeed1bd956 100644
--- a/sfx2/source/dialog/alienwarn.cxx
+++ b/sfx2/source/dialog/alienwarn.cxx
@@ -27,8 +27,7 @@
 
 SfxAlienWarningDialog::SfxAlienWarningDialog(weld::Window* pParent, const OUString& _rFormatName,
                                              const OUString& _rDefaultExtension, bool rDefaultIsAlien)
-    : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/alienwarndialog.ui"))
-    , m_xDialog(m_xBuilder->weld_message_dialog("AlienWarnDialog"))
+    : MessageDialogController(pParent, "sfx/ui/alienwarndialog.ui", "AlienWarnDialog")
     , m_xKeepCurrentBtn(m_xBuilder->weld_button("save"))
     , m_xUseDefaultFormatBtn(m_xBuilder->weld_button("cancel"))
     , m_xWarningOnBox(m_xBuilder->weld_check_button("ask"))
diff --git a/sfx2/source/dialog/inputdlg.cxx b/sfx2/source/dialog/inputdlg.cxx
index ff864ddd01a5..33015e788f9d 100644
--- a/sfx2/source/dialog/inputdlg.cxx
+++ b/sfx2/source/dialog/inputdlg.cxx
@@ -12,8 +12,7 @@
 #include <vcl/svapp.hxx>
 
 InputDialog::InputDialog(weld::Window* pParent, const OUString &rLabelText)
-    : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/inputdialog.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("InputDialog"))
+    : GenericDialogController(pParent, "sfx/ui/inputdialog.ui", "InputDialog")
     , m_xEntry(m_xBuilder->weld_entry("entry"))
     , m_xLabel(m_xBuilder->weld_label("label"))
     , m_xHelp(m_xBuilder->weld_button("help"))
diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx
index 7b4f236f39af..71df5e7d8d72 100644
--- a/sfx2/source/dialog/passwd.cxx
+++ b/sfx2/source/dialog/passwd.cxx
@@ -82,8 +82,7 @@ IMPL_LINK_NOARG(SfxPasswordDialog, OKHdl, weld::Button&, void)
 // CTOR / DTOR -----------------------------------------------------------
 
 SfxPasswordDialog::SfxPasswordDialog(weld::Window* pParent, const OUString* pGroupText)
-    : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/password.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("PasswordDialog"))
+    : GenericDialogController(pParent, "sfx/ui/password.ui", "PasswordDialog")
     , m_xPassword1Box(m_xBuilder->weld_frame("password1frame"))
     , m_xUserFT(m_xBuilder->weld_label("userft"))
     , m_xUserED(m_xBuilder->weld_entry("usered"))
@@ -151,7 +150,7 @@ void SfxPasswordDialog::ShowMinLengthText(bool bShow)
     m_xMinLengthFT->show(bShow);
 }
 
-short SfxPasswordDialog::run()
+short SfxPasswordDialog::execute()
 {
     m_xUserFT->hide();
     m_xUserED->hide();
@@ -192,5 +191,4 @@ short SfxPasswordDialog::run()
     return m_xDialog->run();
 }
 
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx
index fcd78d3f0ab5..8633a5e0eff9 100644
--- a/sfx2/source/dialog/securitypage.cxx
+++ b/sfx2/source/dialog/securitypage.cxx
@@ -101,7 +101,7 @@ static bool lcl_GetPassword(
     aPasswdDlg.SetMinLen(1);
     if (bProtect)
         aPasswdDlg.ShowExtras( SfxShowExtras::CONFIRM );
-    if (RET_OK == aPasswdDlg.run() && !aPasswdDlg.GetPassword().isEmpty())
+    if (RET_OK == aPasswdDlg.execute() && !aPasswdDlg.GetPassword().isEmpty())
     {
         rPassword = aPasswdDlg.GetPassword();
         bRes = true;
diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx
index 2f53b7519163..bdb083a58334 100644
--- a/sfx2/source/doc/docinsert.cxx
+++ b/sfx2/source/doc/docinsert.cxx
@@ -218,7 +218,7 @@ IMPL_LINK_NOARG(DocumentInserter, DialogClosedHdl, sfx2::FileDialogHelper*, void
                     // ask for the password
                     SfxPasswordDialog aPasswordDlg(m_xParent ? m_xParent->GetFrameWeld() : nullptr);
                     aPasswordDlg.ShowExtras( SfxShowExtras::CONFIRM );
-                    short nRet = aPasswordDlg.run();
+                    short nRet = aPasswordDlg.execute();
                     if ( RET_OK == nRet )
                     {
                         m_pItemSet->Put( SfxStringItem( SID_PASSWORD, aPasswordDlg.GetPassword() ) );
diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx
index 2a50c964bc71..eed042b7d60e 100644
--- a/sfx2/source/doc/new.cxx
+++ b/sfx2/source/doc/new.cxx
@@ -237,8 +237,7 @@ sal_uInt16  SfxNewFileDialog::GetSelectedTemplatePos() const
 }
 
 SfxNewFileDialog::SfxNewFileDialog(weld::Window *pParent, SfxNewFileDialogMode nFlags)
-    : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/loadtemplatedialog.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("LoadTemplateDialog"))
+    : GenericDialogController(pParent, "sfx/ui/loadtemplatedialog.ui", "LoadTemplateDialog")
     , m_xRegionLb(m_xBuilder->weld_tree_view("categories"))
     , m_xTemplateLb(m_xBuilder->weld_tree_view("templates"))
     , m_xTextStyleCB(m_xBuilder->weld_check_button("text"))
diff --git a/sfx2/source/doc/saveastemplatedlg.cxx b/sfx2/source/doc/saveastemplatedlg.cxx
index efdb861d86a8..e1f8101fa78d 100644
--- a/sfx2/source/doc/saveastemplatedlg.cxx
+++ b/sfx2/source/doc/saveastemplatedlg.cxx
@@ -34,8 +34,7 @@ using namespace ::com::sun::star::frame;
 // Class SfxSaveAsTemplateDialog --------------------------------------------------
 
 SfxSaveAsTemplateDialog::SfxSaveAsTemplateDialog(weld::Window* pParent, const uno::Reference<frame::XModel> &rModel)
-    : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/saveastemplatedlg.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("SaveAsTemplateDialog"))
+    : GenericDialogController(pParent, "sfx/ui/saveastemplatedlg.ui", "SaveAsTemplateDialog")
     , m_xLBCategory(m_xBuilder->weld_tree_view("categorylb"))
     , m_xCBXDefault(m_xBuilder->weld_check_button("defaultcb"))
     , m_xTemplateNameEdit(m_xBuilder->weld_entry("name_entry"))
diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx
index 05f5a3835aee..5b93430882d8 100644
--- a/sfx2/source/inc/alienwarn.hxx
+++ b/sfx2/source/inc/alienwarn.hxx
@@ -21,11 +21,9 @@
 
 #include <vcl/weld.hxx>
 
-class SfxAlienWarningDialog
+class SfxAlienWarningDialog : public weld::MessageDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::MessageDialog> m_xDialog;
     std::unique_ptr<weld::Button> m_xKeepCurrentBtn;
     std::unique_ptr<weld::Button> m_xUseDefaultFormatBtn;
     std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
@@ -36,8 +34,7 @@ private:
 public:
     SfxAlienWarningDialog(weld::Window* pParent, const OUString& _rFormatName,
                           const OUString& _rDefaultExtension, bool rDefaultIsAlien);
-    short run() { return m_xDialog->run(); }
-    ~SfxAlienWarningDialog();
+    virtual ~SfxAlienWarningDialog() override;
 };
 
 #endif // INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index b640f5f4aff9..dd37efc0016e 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -154,22 +154,19 @@ void SfxViewFrame::InitInterface_Impl()
 
 namespace {
 /// Asks the user if editing a read-only document is really wanted.
-class SfxEditDocumentDialog
+class SfxEditDocumentDialog : public weld::MessageDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::MessageDialog> m_xDialog;
     std::unique_ptr<weld::Button> m_xEditDocument;
     std::unique_ptr<weld::Button> m_xCancel;
 
 public:
     SfxEditDocumentDialog(weld::Widget* pParent);
-    short run() { return m_xDialog->run(); }
 };
 
 SfxEditDocumentDialog::SfxEditDocumentDialog(weld::Widget* pParent)
-    : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/editdocumentdialog.ui"))
-    , m_xDialog(m_xBuilder->weld_message_dialog("EditDocumentDialog"))
+    : MessageDialogController(pParent, "sfx/ui/editdocumentdialog.ui",
+            "EditDocumentDialog")
     , m_xEditDocument(m_xBuilder->weld_button("edit"))
     , m_xCancel(m_xBuilder->weld_button("cancel"))
 {
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index ee3e1f5cbf5b..beb269afdc62 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -394,18 +394,14 @@ void SmFontDialog::DataChanged( const DataChangedEvent& rDCEvt )
     ModalDialog::DataChanged( rDCEvt );
 }
 
-class SaveDefaultsQuery
+class SaveDefaultsQuery : public weld::MessageDialogController
 {
-private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::MessageDialog> m_xBox;
 public:
     explicit SaveDefaultsQuery(weld::Widget* pParent)
-        : m_xBuilder(Application::CreateBuilder(pParent, "modules/smath/ui/savedefaultsdialog.ui"))
-        , m_xBox(m_xBuilder->weld_message_dialog("SaveDefaultsDialog"))
+        : MessageDialogController(pParent, "modules/smath/ui/savedefaultsdialog.ui",
+                "SaveDefaultsDialog")
     {
     }
-    short run() { return m_xBox->run(); }
 };
 
 IMPL_LINK_NOARG( SmFontSizeDialog, DefaultButtonClickHdl, Button *, void )
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index c58f0a6609be..6e3257faece6 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -2182,8 +2182,7 @@ void SvtFileView_Impl::SetActualFolder( const INetURLObject& rActualFolder )
 namespace svtools {
 
 QueryDeleteDlg_Impl::QueryDeleteDlg_Impl(weld::Widget* pParent, const OUString& rName)
-    : m_xBuilder(Application::CreateBuilder(pParent, "svt/ui/querydeletedialog.ui"))
-    , m_xDialog(m_xBuilder->weld_message_dialog("QueryDeleteDialog"))
+    : MessageDialogController(pParent, "svt/ui/querydeletedialog.ui", "QueryDeleteDialog")
     , m_xAllButton(m_xBuilder->weld_button("all"))
 {
     // display specified texts
diff --git a/svx/source/dialog/linkwarn.cxx b/svx/source/dialog/linkwarn.cxx
index 23a4f0d2102f..2dcf5be18747 100644
--- a/svx/source/dialog/linkwarn.cxx
+++ b/svx/source/dialog/linkwarn.cxx
@@ -23,8 +23,7 @@
 #include <svtools/miscopt.hxx>
 
 SvxLinkWarningDialog::SvxLinkWarningDialog(weld::Widget* pParent, const OUString& _rFileName)
-    : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/linkwarndialog.ui"))
-    , m_xDialog(m_xBuilder->weld_message_dialog("LinkWarnDialog"))
+    : MessageDialogController(pParent, "svx/ui/linkwarndialog.ui", "LinkWarnDialog")
     , m_xWarningOnBox(m_xBuilder->weld_check_button("ask"))
 {
     // replace filename
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 9f0bf7f064d2..7d686263a2ef 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -3402,8 +3402,8 @@ namespace svxform
     }
 
     LinkedInstanceWarningBox::LinkedInstanceWarningBox(weld::Widget* pParent)
-        : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/formlinkwarndialog.ui"))
-        , m_xDialog(m_xBuilder->weld_message_dialog("FormLinkWarnDialog"))
+        : MessageDialogController(pParent, "svx/ui/formlinkwarndialog.ui",
+                "FormLinkWarnDialog")
     {
     }
 
diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx
index c2daff365856..323b7bad3029 100644
--- a/svx/source/inc/datanavi.hxx
+++ b/svx/source/inc/datanavi.hxx
@@ -633,14 +633,10 @@ namespace svxform
     };
 
 
-    class LinkedInstanceWarningBox
+    class LinkedInstanceWarningBox : public weld::MessageDialogController
     {
-    private:
-        std::unique_ptr<weld::Builder> m_xBuilder;
-        std::unique_ptr<weld::MessageDialog> m_xDialog;
     public:
         LinkedInstanceWarningBox(weld::Widget* pParent);
-        short run() { return m_xDialog->run(); }
     };
 }
 
diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx
index 68f2e3241474..038284e6a11c 100644
--- a/sw/source/ui/chrdlg/break.cxx
+++ b/sw/source/ui/chrdlg/break.cxx
@@ -36,7 +36,7 @@
 #include <strings.hrc>
 #include <SwStyleNameMapper.hxx>
 
-short SwBreakDlg::run()
+short SwBreakDlg::execute()
 {
     short nRet = m_xDialog->run();
     if (nRet == RET_OK)
@@ -131,21 +131,19 @@ IMPL_LINK_NOARG(SwBreakDlg, OkHdl, weld::Button&, void)
 }
 
 SwBreakDlg::SwBreakDlg(weld::Window *pParent, SwWrtShell &rS)
-    : rSh(rS)
-    , m_xBuilder(Application::CreateBuilder(pParent, "modules/swriter/ui/insertbreak.ui"))
+    : GenericDialogController(pParent, "modules/swriter/ui/insertbreak.ui", "BreakDialog")
+    , m_xLineBtn(m_xBuilder->weld_radio_button("linerb"))
+    , m_xColumnBtn(m_xBuilder->weld_radio_button("columnrb"))
+    , m_xPageBtn(m_xBuilder->weld_radio_button("pagerb"))
+    , m_xPageCollText(m_xBuilder->weld_label("styleft"))
+    , m_xPageCollBox(m_xBuilder->weld_combo_box_text("stylelb"))
+    , m_xPageNumBox(m_xBuilder->weld_check_button("pagenumcb"))
+    , m_xPageNumEdit(m_xBuilder->weld_spin_button("pagenumsb"))
+    , m_xOkBtn(m_xBuilder->weld_button("ok"))
+    , rSh(rS)
     , nKind(0)
     , bHtmlMode(0 != ::GetHtmlMode(rS.GetView().GetDocShell()))
 {
-    m_xDialog.reset(m_xBuilder->weld_dialog("BreakDialog"));
-    m_xLineBtn.reset(m_xBuilder->weld_radio_button("linerb"));
-    m_xColumnBtn.reset(m_xBuilder->weld_radio_button("columnrb"));
-    m_xPageBtn.reset(m_xBuilder->weld_radio_button("pagerb"));
-    m_xPageCollBox.reset(m_xBuilder->weld_combo_box_text("stylelb"));
-    m_xPageNumBox.reset(m_xBuilder->weld_check_button("pagenumcb"));
-    m_xPageNumEdit.reset(m_xBuilder->weld_spin_button("pagenumsb"));
-    m_xPageCollText.reset(m_xBuilder->weld_label("styleft"));
-    m_xOkBtn.reset(m_xBuilder->weld_button("ok"));
-
     Link<weld::ToggleButton&,void> aLk = LINK(this, SwBreakDlg, ToggleHdl);
     m_xPageBtn->connect_toggled(aLk);
     m_xLineBtn->connect_toggled(aLk);
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 96a4acb469c5..c283f4fec404 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -94,11 +94,11 @@ IMPL_ABSTDLG_BASE(AbstractSwAsciiFilterDlg_Impl);
 IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl);
 short AbstractSplitTableDialog_Impl::Execute()
 {
-    return m_xDlg->run();
+    return m_xDlg->execute();
 }
 short AbstractSwBreakDlg_Impl::Execute()
 {
-    return m_xDlg->run();
+    return m_xDlg->execute();
 }
 IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl);
 short AbstractSwConvertTableDlg_Impl::Execute()
@@ -111,7 +111,7 @@ IMPL_ABSTDLG_BASE(AbstractSwLabDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractSwSelGlossaryDlg_Impl);
 short AbstractSwAutoFormatDlg_Impl::Execute()
 {
-    return m_xDlg->run();
+    return m_xDlg->execute();
 }
 IMPL_ABSTDLG_BASE(AbstractSwFieldDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractSwRenameXNamedDlg_Impl);
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index b513bbcffa2b..64988bc9ca17 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -409,7 +409,7 @@ bool SwEditRegionDlg::CheckPasswd(CheckBox* pBox)
         {
             SfxPasswordDialog aPasswdDlg(GetFrameWeld());
             bRet = false;
-            if (aPasswdDlg.run())
+            if (aPasswdDlg.execute())
             {
                 const OUString sNewPasswd(aPasswdDlg.GetPassword());
                 css::uno::Sequence <sal_Int8 > aNewPasswd;
@@ -1262,7 +1262,7 @@ IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox, void )
             {
                 SfxPasswordDialog aPasswdDlg(GetFrameWeld());
                 aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
-                if (RET_OK == aPasswdDlg.run())
+                if (RET_OK == aPasswdDlg.execute())
                 {
                     const OUString sNewPasswd(aPasswdDlg.GetPassword());
                     if (aPasswdDlg.GetConfirm() == sNewPasswd)
@@ -1702,7 +1702,7 @@ IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, Button *, pButton, void )
         {
             SfxPasswordDialog aPasswdDlg(GetFrameWeld());
             aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
-            if(RET_OK == aPasswdDlg.run())
+            if (RET_OK == aPasswdDlg.execute())
             {
                 const OUString sNewPasswd(aPasswdDlg.GetPassword());
                 if (aPasswdDlg.GetConfirm() == sNewPasswd)
diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx
index f6df42e9c9bd..f33d262bba41 100644
--- a/sw/source/ui/table/convert.cxx
+++ b/sw/source/ui/table/convert.cxx
@@ -94,8 +94,8 @@ void SwConvertTableDlg::GetValues(  sal_Unicode& rDelim,
 }
 
 SwConvertTableDlg::SwConvertTableDlg(SwView& rView, bool bToTable)
-    : m_xBuilder(Application::CreateBuilder(rView.GetViewFrame()->GetWindow().GetFrameWeld(), "modules/swriter/ui/converttexttable.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("ConvertTextTableDialog"))
+    : GenericDialogController(rView.GetViewFrame()->GetWindow().GetFrameWeld(),
+            "modules/swriter/ui/converttexttable.ui", "ConvertTextTableDialog")
     , m_xTabBtn(m_xBuilder->weld_radio_button("tabs"))
     , m_xSemiBtn(m_xBuilder->weld_radio_button("semicolons"))
     , m_xParaBtn(m_xBuilder->weld_radio_button("paragraph"))
diff --git a/sw/source/ui/table/splittbl.cxx b/sw/source/ui/table/splittbl.cxx
index f78041b06cfa..e322bd8462a0 100644
--- a/sw/source/ui/table/splittbl.cxx
+++ b/sw/source/ui/table/splittbl.cxx
@@ -22,8 +22,7 @@
 #include <tblenum.hxx>
 
 SwSplitTableDlg::SwSplitTableDlg(weld::Window *pParent, SwWrtShell &rSh)
-    : m_xBuilder(Application::CreateBuilder(pParent, "modules/swriter/ui/splittable.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("SplitTableDialog"))
+    : GenericDialogController(pParent, "modules/swriter/ui/splittable.ui", "SplitTableDialog")
     , m_xContentCopyRB(m_xBuilder->weld_radio_button("copyheading"))
     , m_xBoxAttrCopyWithParaRB(m_xBuilder->weld_radio_button("customheadingapplystyle"))
     , m_xBoxAttrCopyNoParaRB(m_xBuilder->weld_radio_button("customheading"))
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index fcbae6f6d46c..5adc8ca51fcd 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -24,19 +24,17 @@
 #include <shellres.hxx>
 #include <tautofmt.hxx>
 
-class SwStringInputDlg
+class SwStringInputDlg : public weld::GenericDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::Label> m_xLabel;
     std::unique_ptr<weld::Entry> m_xEdInput; // Edit obtains the focus.
 
 public:
     SwStringInputDlg(weld::Window* pParent, const OUString& rTitle,
         const OUString& rEditTitle, const OUString& rDefault)
-        : m_xBuilder(Application::CreateBuilder(pParent, "modules/swriter/ui/stringinput.ui"))
-        , m_xDialog(m_xBuilder->weld_dialog("StringInputDialog"))
+        : GenericDialogController(pParent, "modules/swriter/ui/stringinput.ui",
+                "StringInputDialog")
         , m_xLabel(m_xBuilder->weld_label("name"))
         , m_xEdInput(m_xBuilder->weld_entry("edit"))
     {
@@ -50,15 +48,13 @@ public:
     {
         return m_xEdInput->get_text();
     }
-
-    short run() {  return m_xDialog->run(); }
 };
 
 // AutoFormat-Dialogue:
 SwAutoFormatDlg::SwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pWrtShell,
                                  bool bAutoFormat, const SwTableAutoFormat* pSelFormat)
-    : m_xBuilder(Application::CreateBuilder(pParent, "modules/swriter/ui/autoformattable.ui"))
-    , m_xDialog(m_xBuilder->weld_dialog("AutoFormatTableDialog"))
+    : GenericDialogController(pParent, "modules/swriter/ui/autoformattable.ui",
+            "AutoFormatTableDialog")
     , m_xLbFormat(m_xBuilder->weld_tree_view("formatlb"))
     , m_xBtnNumFormat(m_xBuilder->weld_check_button("numformatcb"))
     , m_xBtnBorder(m_xBuilder->weld_check_button("bordercb"))
@@ -394,7 +390,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, SelFormatHdl, weld::TreeView&, void)
     m_xBtnRename->set_sensitive(bBtnEnable);
 }
 
-short SwAutoFormatDlg::run()
+short SwAutoFormatDlg::execute()
 {
     short nRet = m_xDialog->run();
     if (nRet == RET_OK && bSetAutoFormat)
diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx
index 6125e58b2f77..aae8e1f553da 100644
--- a/sw/source/uibase/dbui/mailmergehelper.cxx
+++ b/sw/source/uibase/dbui/mailmergehelper.cxx
@@ -615,7 +615,7 @@ OUString SwAuthenticator::getPassword(  )
     {
        SfxPasswordDialog aPasswdDlg(m_pParentWindow->GetFrameWeld());
        aPasswdDlg.SetMinLen(0);
-       if (RET_OK == aPasswdDlg.run())
+       if (RET_OK == aPasswdDlg.execute())
             m_aPassword = aPasswdDlg.GetPassword();
     }
     return m_aPassword;
diff --git a/sw/source/uibase/inc/break.hxx b/sw/source/uibase/inc/break.hxx
index 4f39f55674b1..70af5ad61c51 100644
--- a/sw/source/uibase/inc/break.hxx
+++ b/sw/source/uibase/inc/break.hxx
@@ -29,11 +29,8 @@
 
 class SwWrtShell;
 
-class SwBreakDlg
+class SwBreakDlg : public weld::GenericDialogController
 {
-    SwWrtShell     &rSh;
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::RadioButton> m_xLineBtn;
     std::unique_ptr<weld::RadioButton> m_xColumnBtn;
     std::unique_ptr<weld::RadioButton> m_xPageBtn;
@@ -43,6 +40,7 @@ class SwBreakDlg
     std::unique_ptr<weld::SpinButton> m_xPageNumEdit;
     std::unique_ptr<weld::Button> m_xOkBtn;
 
+    SwWrtShell     &rSh;
     OUString        m_aTemplate;
     sal_uInt16      nKind;
     ::boost::optional<sal_uInt16>      oPgNum;
@@ -59,7 +57,7 @@ class SwBreakDlg
 
 public:
     SwBreakDlg(weld::Window *pParent, SwWrtShell &rSh);
-    short run();
+    short execute();
     const OUString& GetTemplateName() const { return m_aTemplate; }
     sal_uInt16 GetKind() const { return nKind; }
     const ::boost::optional<sal_uInt16>&  GetPageNumber() const { return oPgNum; }
diff --git a/sw/source/uibase/inc/convert.hxx b/sw/source/uibase/inc/convert.hxx
index 6ae9a8e699c9..9dfefc5fa642 100644
--- a/sw/source/uibase/inc/convert.hxx
+++ b/sw/source/uibase/inc/convert.hxx
@@ -27,11 +27,8 @@ class SwView;
 class SwWrtShell;
 struct SwInsertTableOptions;
 
-class SwConvertTableDlg
+class SwConvertTableDlg : public weld::GenericDialogController
 {
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
-
     std::unique_ptr<weld::RadioButton> m_xTabBtn;
     std::unique_ptr<weld::RadioButton> m_xSemiBtn;
     std::unique_ptr<weld::RadioButton> m_xParaBtn;
@@ -63,8 +60,6 @@ class SwConvertTableDlg
 public:
     SwConvertTableDlg(SwView& rView, bool bToTable);
 
-    short run() { return m_xDialog->run(); }
-
     void GetValues( sal_Unicode& rDelim,
                     SwInsertTableOptions& rInsTableOpts,
                     SwTableAutoFormat const*& prTAFormat );
diff --git a/sw/source/uibase/inc/splittbl.hxx b/sw/source/uibase/inc/splittbl.hxx
index 62d4f4ba9de4..8d32899d0f0a 100644
--- a/sw/source/uibase/inc/splittbl.hxx
+++ b/sw/source/uibase/inc/splittbl.hxx
@@ -24,11 +24,9 @@
 
 class SwWrtShell;
 
-class SwSplitTableDlg
+class SwSplitTableDlg : public weld::GenericDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::RadioButton> m_xHorzBox;
     std::unique_ptr<weld::RadioButton> m_xContentCopyRB;
     std::unique_ptr<weld::RadioButton> m_xBoxAttrCopyWithParaRB;
@@ -43,7 +41,7 @@ private:
 public:
     SwSplitTableDlg(weld::Window *pParent, SwWrtShell &rSh);
 
-    short run()
+    short execute()
     {
         short nRet = m_xDialog->run();
         if (nRet == RET_OK)
diff --git a/sw/source/uibase/inc/tautofmt.hxx b/sw/source/uibase/inc/tautofmt.hxx
index e7870e2c6f17..984554a80467 100644
--- a/sw/source/uibase/inc/tautofmt.hxx
+++ b/sw/source/uibase/inc/tautofmt.hxx
@@ -35,10 +35,8 @@ class SwWrtShell;
 
 enum AutoFormatLine { TOP_LINE, BOTTOM_LINE, LEFT_LINE, RIGHT_LINE };
 
-class SwAutoFormatDlg
+class SwAutoFormatDlg : public weld::GenericDialogController
 {
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::Dialog> m_xDialog;
     std::unique_ptr<weld::TreeView> m_xLbFormat;
     std::unique_ptr<weld::Container> m_xFormatting;
     std::unique_ptr<weld::CheckButton> m_xBtnNumFormat;
@@ -79,11 +77,11 @@ public:
     SwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pShell,
                     bool bSetAutoFormat, const SwTableAutoFormat* pSelFormat);
 
-    short run();
+    short execute();
 
     SwTableAutoFormat* FillAutoFormatOfIndex() const;
 
-    ~SwAutoFormatDlg();
+    virtual ~SwAutoFormatDlg() override;
 };
 
 #endif // SW_AUTOFMT_HXX
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index d1707627f7ef..5fde9cc1f392 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -567,7 +567,7 @@ void SwView::Execute(SfxRequest &rReq)
                     SfxPasswordDialog aPasswdDlg(pParent);
                     aPasswdDlg.SetMinLen(1);
                     //#i69751# the result of Execute() can be ignored
-                    (void)aPasswdDlg.run();
+                    (void)aPasswdDlg.execute();
                     OUString sNewPasswd(aPasswdDlg.GetPassword());
                     Sequence <sal_Int8> aNewPasswd = rIDRA.GetRedlinePassword();
                     SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
@@ -609,7 +609,7 @@ void SwView::Execute(SfxRequest &rReq)
             aPasswdDlg.SetMinLen(1);
             if (!aPasswd.getLength())
                 aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
-            if (aPasswdDlg.run())
+            if (aPasswdDlg.execute())
             {
                 RedlineFlags nOn = RedlineFlags::On;
                 OUString sNewPasswd(aPasswdDlg.GetPassword());
diff --git a/uui/source/sslwarndlg.cxx b/uui/source/sslwarndlg.cxx
index df20f8f71715..6687cfb68f0f 100644
--- a/uui/source/sslwarndlg.cxx
+++ b/uui/source/sslwarndlg.cxx
@@ -39,8 +39,7 @@ IMPL_LINK_NOARG(SSLWarnDialog, ViewCertHdl, weld::Button&, void)
 SSLWarnDialog::SSLWarnDialog(weld::Window* pParent,
     const css::uno::Reference< css::security::XCertificate >& rXCert,
     const css::uno::Reference< css::uno::XComponentContext >& xContext)
-    : m_xBuilder(Application::CreateBuilder(pParent, "uui/ui/sslwarndialog.ui"))
-    , m_xDialog(m_xBuilder->weld_message_dialog("SSLWarnDialog"))
+    : MessageDialogController(pParent, "uui/ui/sslwarndialog.ui", "SSLWarnDialog")
     , m_xView(m_xBuilder->weld_button("view"))
     , m_xContext(xContext)
     , m_rXCert(rXCert)
diff --git a/uui/source/sslwarndlg.hxx b/uui/source/sslwarndlg.hxx
index 9a56314d9f21..598ed08ae035 100644
--- a/uui/source/sslwarndlg.hxx
+++ b/uui/source/sslwarndlg.hxx
@@ -27,11 +27,9 @@
 
 //= Https_WarnDialog
 
-class SSLWarnDialog
+class SSLWarnDialog : public weld::MessageDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::MessageDialog> m_xDialog;
     std::unique_ptr<weld::Button> m_xView;
     const css::uno::Reference< css::uno::XComponentContext >& m_xContext;
     const css::uno::Reference< css::security::XCertificate >& m_rXCert;
@@ -44,9 +42,6 @@ public:
         const css::uno::Reference< css::uno::XComponentContext >& xContext );
 
     void setDescription1Text(const OUString &rText) { m_xDialog->set_primary_text(rText); }
-    void set_title(const OUString &rText) { m_xDialog->set_title(rText); }
-
-    short run() { return m_xDialog->run(); }
 };
 
 #endif // INCLUDED_UUI_SOURCE_SSLWARNDLG_HXX
diff --git a/uui/source/unknownauthdlg.cxx b/uui/source/unknownauthdlg.cxx
index 171d864735cd..fc2738588892 100644
--- a/uui/source/unknownauthdlg.cxx
+++ b/uui/source/unknownauthdlg.cxx
@@ -51,8 +51,8 @@ IMPL_LINK_NOARG(UnknownAuthDialog, ViewCertHdl_Impl, weld::Button&, void)
 UnknownAuthDialog::UnknownAuthDialog(weld::Window* pParent,
     const css::uno::Reference< css::security::XCertificate >& rXCert,
     const css::uno::Reference< css::uno::XComponentContext >& xContext)
-    : m_xBuilder(Application::CreateBuilder(pParent, "uui/ui/unknownauthdialog.ui"))
-    , m_xDialog(m_xBuilder->weld_message_dialog("UnknownAuthDialog"))
+    : MessageDialogController(pParent, "uui/ui/unknownauthdialog.ui",
+            "UnknownAuthDialog")
     , m_xCommandButtonOK(m_xBuilder->weld_button("ok"))
     , m_xView_Certificate(m_xBuilder->weld_button("examine"))
     , m_xOptionButtonAccept(m_xBuilder->weld_radio_button("accept"))
diff --git a/uui/source/unknownauthdlg.hxx b/uui/source/unknownauthdlg.hxx
index 2398dfa26a2e..45ac942daed4 100644
--- a/uui/source/unknownauthdlg.hxx
+++ b/uui/source/unknownauthdlg.hxx
@@ -27,11 +27,9 @@
 
 //= Https_UADialog
 
-class UnknownAuthDialog
+class UnknownAuthDialog : public weld::MessageDialogController
 {
 private:
-    std::unique_ptr<weld::Builder> m_xBuilder;
-    std::unique_ptr<weld::MessageDialog> m_xDialog;
     std::unique_ptr<weld::Button> m_xCommandButtonOK;
     std::unique_ptr<weld::Button> m_xView_Certificate;
     std::unique_ptr<weld::RadioButton> m_xOptionButtonAccept;
@@ -52,8 +50,6 @@ public:
     {
         m_xDialog->set_primary_text(rText);
     }
-
-    short run() { return m_xDialog->run(); }
 };
 
 #endif // INCLUDED_UUI_SOURCE_UNKNOWNAUTHDLG_HXX
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 3f95a7589849..b59122356e47 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1479,6 +1479,12 @@ namespace weld
         , m_xDialog(m_xBuilder->weld_dialog(rDialogId))
     {
     }
+
+    MessageDialogController::MessageDialogController(weld::Widget* pParent, const OUString &rUIFile, const OString& rDialogId)
+        : m_xBuilder(Application::CreateBuilder(pParent, rUIFile))
+        , m_xDialog(m_xBuilder->weld_message_dialog(rDialogId))
+    {
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
index f3a365dd1bd6..e10cdc45d638 100644
--- a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
+++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
@@ -243,7 +243,7 @@ bool MSWorksCalcImportFilter::doImportDocument(librevenge::RVNGInputStream &rInp
         {
             SfxPasswordDialog aPasswdDlg(nullptr);
             aPasswdDlg.SetMinLen(1);
-            if (!aPasswdDlg.run())
+            if (!aPasswdDlg.execute())
                 return false;
             OUString aPasswd = aPasswdDlg.GetPassword();
             aUtf8Passwd = OUStringToOString(aPasswd, RTL_TEXTENCODING_UTF8);
diff --git a/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx b/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx
index 6c0ac8ecf13c..1f3cccaac35f 100644
--- a/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx
+++ b/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx
@@ -47,7 +47,7 @@ bool StarOfficeWriterImportFilter::doImportDocument(librevenge::RVNGInputStream
         {
             SfxPasswordDialog aPasswdDlg(nullptr);
             aPasswdDlg.SetMinLen(0);
-            if (!aPasswdDlg.run())
+            if (!aPasswdDlg.execute())
                 return false;
             OUString aPasswd = aPasswdDlg.GetPassword();
             aUtf8Passwd = OUStringToOString(aPasswd, RTL_TEXTENCODING_UTF8);
diff --git a/writerperfect/source/writer/WordPerfectImportFilter.cxx b/writerperfect/source/writer/WordPerfectImportFilter.cxx
index 1975a7084b1c..4c6fc27060c6 100644
--- a/writerperfect/source/writer/WordPerfectImportFilter.cxx
+++ b/writerperfect/source/writer/WordPerfectImportFilter.cxx
@@ -114,7 +114,7 @@ bool WordPerfectImportFilter::importImpl(const Sequence< css::beans::PropertyVal
         {
             SfxPasswordDialog aPasswdDlg(nullptr);
             aPasswdDlg.SetMinLen(0);
-            if (!aPasswdDlg.run())
+            if (!aPasswdDlg.execute())
                 return false;
             OUString aPasswd = aPasswdDlg.GetPassword();
             aUtf8Passwd = OUStringToOString(aPasswd, RTL_TEXTENCODING_UTF8);


More information about the Libreoffice-commits mailing list