[Libreoffice-commits] core.git: chart2/source dbaccess/source include/vcl sw/source sw/uiconfig vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 23 14:29:14 UTC 2019


 chart2/source/controller/dialogs/dlg_CreationWizard.cxx |    8 -
 chart2/source/controller/inc/dlg_CreationWizard.hxx     |    2 
 dbaccess/source/ui/dlg/dbwizsetup.cxx                   |    8 -
 dbaccess/source/ui/inc/dbwizsetup.hxx                   |    1 
 include/vcl/roadmapwizard.hxx                           |    5 
 sw/source/ui/dbui/mailmergewizard.cxx                   |   62 ++++++----
 sw/source/ui/dbui/mmaddressblockpage.cxx                |    9 -
 sw/source/ui/dbui/mmaddressblockpage.hxx                |    4 
 sw/source/ui/dbui/mmdocselectpage.cxx                   |    9 -
 sw/source/ui/dbui/mmdocselectpage.hxx                   |    3 
 sw/source/ui/dbui/mmgreetingspage.hxx                   |    2 
 sw/source/ui/dbui/mmlayoutpage.cxx                      |    1 
 sw/source/ui/dbui/mmlayoutpage.hxx                      |    2 
 sw/source/ui/dbui/mmoutputtypepage.cxx                  |    8 -
 sw/source/ui/dbui/mmoutputtypepage.hxx                  |    3 
 sw/source/ui/dialog/swdlgfact.cxx                       |   19 +--
 sw/source/ui/dialog/swdlgfact.hxx                       |   10 -
 sw/source/uibase/inc/mailmergewizard.hxx                |   12 --
 sw/uiconfig/swriter/ui/mmaddressblockpage.ui            |   91 ++--------------
 sw/uiconfig/swriter/ui/mmoutputtypepage.ui              |   12 +-
 sw/uiconfig/swriter/ui/mmsalutationpage.ui              |    4 
 vcl/source/app/salvtables.cxx                           |   26 ++--
 vcl/source/control/wizardmachine.cxx                    |   14 +-
 vcl/unx/gtk3/gtk3gtkinst.cxx                            |   86 ++++++---------
 24 files changed, 150 insertions(+), 251 deletions(-)

New commits:
commit 693d9ff29e7838bafcad5faa7a4e7355807c54cb
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Aug 22 09:15:51 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Aug 23 16:28:12 2019 +0200

    weld SwMailMergeWizard
    
    Change-Id: I03a7fd1f7676792387155db986d710a001887c8d
    Reviewed-on: https://gerrit.libreoffice.org/77977
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
index 58a744980556..85f263b1c21f 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -80,14 +80,6 @@ CreationWizard::CreationWizard(weld::Window* pParent, const uno::Reference<frame
     m_xAssistant->set_current_page(0);
 }
 
-short CreationWizard::run()
-{
-    int nRet = vcl::RoadmapWizardMachine::run();
-    if (nRet == static_cast<int>(WizardButtonFlags::FINISH))
-        return ui::dialogs::ExecutableDialogResults::OK;
-    return ui::dialogs::ExecutableDialogResults::CANCEL;
-}
-
 CreationWizard::~CreationWizard() = default;
 
 VclPtr<TabPage> CreationWizard::createPage(WizardState nState)
diff --git a/chart2/source/controller/inc/dlg_CreationWizard.hxx b/chart2/source/controller/inc/dlg_CreationWizard.hxx
index 8562d6365020..db64d9d1cb9d 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard.hxx
@@ -50,8 +50,6 @@ public:
     virtual void setInvalidPage(TabPage * pTabPage) override;
     virtual void setValidPage(TabPage * pTabPage) override;
 
-    virtual short run() override;
-
 protected:
     virtual bool leaveState( WizardState _nState ) override;
     virtual WizardState determineNextState(WizardState nCurrentState) const override;
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index bc1bd79c581e..cc901bd84817 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -174,14 +174,6 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent
     m_xAssistant->set_current_page(0);
 }
 
-short ODbTypeWizDialogSetup::run()
-{
-    int nRet = vcl::RoadmapWizardMachine::run();
-    if (nRet == static_cast<int>(WizardButtonFlags::FINISH))
-        return ui::dialogs::ExecutableDialogResults::OK;
-    return ui::dialogs::ExecutableDialogResults::CANCEL;
-}
-
 void ODbTypeWizDialogSetup::declareAuthDepPath( const OUString& _sURL, PathId _nPathId, const vcl::RoadmapWizardTypes::WizardPath& _rPaths)
 {
     bool bHasAuthentication = DataSourceMetaData::getAuthentication( _sURL ) != AuthNone;
diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx
index 171c58bfbba1..16969b467ee3 100644
--- a/dbaccess/source/ui/inc/dbwizsetup.hxx
+++ b/dbaccess/source/ui/inc/dbwizsetup.hxx
@@ -118,7 +118,6 @@ public:
     */
     bool IsTableWizardToBeStarted() const;
 
-    virtual short run() override;
 private:
     /// to override to create new pages
     virtual VclPtr<TabPage> createPage(WizardState _nState) override;
diff --git a/include/vcl/roadmapwizard.hxx b/include/vcl/roadmapwizard.hxx
index de70169fdbcc..b94b89f61a38 100644
--- a/include/vcl/roadmapwizard.hxx
+++ b/include/vcl/roadmapwizard.hxx
@@ -344,11 +344,6 @@ namespace vcl
         */
         virtual OUString  getStateDisplayName( WizardState _nState ) const;
 
-        /** asks for a new label of the wizard page
-
-         */
-        void    updateRoadmapItemLabel( WizardState _nState );
-
     private:
         DECL_DLLPRIVATE_LINK( OnRoadmapItemSelected, const OString&, bool );
 
diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx
index 6ca8822cbfc3..f7b6362ddbf0 100644
--- a/sw/source/ui/dbui/mailmergewizard.cxx
+++ b/sw/source/ui/dbui/mailmergewizard.cxx
@@ -38,27 +38,27 @@
 using namespace svt;
 using namespace ::com::sun::star;
 
-SwMailMergeWizard::SwMailMergeWizard(SwView& rView, std::shared_ptr<SwMailMergeConfigItem> const & rItem) :
-        RoadmapWizard(&rView.GetViewFrame()->GetWindow()),
-        m_pSwView(&rView),
-        m_bDocumentLoad( false ),
-        m_xConfigItem(rItem),
-        m_sStarting(        SwResId( ST_STARTING      )),
-        m_sDocumentType(    SwResId( ST_DOCUMENTTYPE   )),
-        m_sAddressBlock(    SwResId( ST_ADDRESSBLOCK   )),
-        m_sAddressList(     SwResId( ST_ADDRESSLIST )),
-        m_sGreetingsLine(   SwResId( ST_GREETINGSLINE   )),
-        m_sLayout(          SwResId( ST_LAYOUT        )),
-        m_nRestartPage( MM_DOCUMENTSELECTPAGE )
+SwMailMergeWizard::SwMailMergeWizard(SwView& rView, std::shared_ptr<SwMailMergeConfigItem> const & rItem)
+    : RoadmapWizardMachine(rView.GetFrameWeld())
+    , m_pSwView(&rView)
+    , m_bDocumentLoad(false)
+    , m_xConfigItem(rItem)
+    , m_sStarting(SwResId(ST_STARTING))
+    , m_sDocumentType(SwResId(ST_DOCUMENTTYPE))
+    , m_sAddressBlock(SwResId(ST_ADDRESSBLOCK))
+    , m_sAddressList(SwResId(ST_ADDRESSLIST))
+    , m_sGreetingsLine(SwResId(ST_GREETINGSLINE))
+    , m_sLayout(SwResId(ST_LAYOUT))
+    , m_nRestartPage(MM_DOCUMENTSELECTPAGE)
 {
     defaultButton(WizardButtonFlags::NEXT);
     enableButtons(WizardButtonFlags::FINISH, false);
 
-    setTitleBase(SwResId( ST_MMWTITLE ) );
+    setTitleBase(SwResId(ST_MMWTITLE));
 
-    m_pFinish->SetText(SwResId( ST_FINISH ));
-    m_pNextPage->SetHelpId(HID_MM_NEXT_PAGE);
-    m_pPrevPage->SetHelpId(HID_MM_PREV_PAGE);
+    m_xFinish->set_label(SwResId( ST_FINISH ));
+    m_xNextPage->set_help_id(HID_MM_NEXT_PAGE);
+    m_xPrevPage->set_help_id(HID_MM_PREV_PAGE);
 
     //#i51949# no output type page visible if e-Mail is not supported
     if (m_xConfigItem->IsMailAvailable())
@@ -80,6 +80,7 @@ SwMailMergeWizard::SwMailMergeWizard(SwView& rView, std::shared_ptr<SwMailMergeC
         );
 
     ActivatePage();
+    m_xAssistant->set_current_page(0);
     UpdateRoadmap();
 }
 
@@ -89,11 +90,16 @@ SwMailMergeWizard::~SwMailMergeWizard()
 
 VclPtr<TabPage> SwMailMergeWizard::createPage(WizardState _nState)
 {
+    OString sIdent(OString::number(_nState));
+    weld::Container* pPageContainer = m_xAssistant->append_page(sIdent);
+    // TODO eventually pass DialogController as distinct argument instead of bundling into TabPageParent
+    TabPageParent aParent(pPageContainer, this);
+
     VclPtr<vcl::OWizardPage> pRet;
     switch(_nState)
     {
         case MM_DOCUMENTSELECTPAGE :
-            pRet = VclPtr<SwMailMergeDocSelectPage>::Create(this, TabPageParent(this));
+            pRet = VclPtr<SwMailMergeDocSelectPage>::Create(this, aParent);
 
             /* tdf#52986 Set help ID using SetRoadmapHelpId for all pages
             so that when by default the focus is on the left side pane of
@@ -102,29 +108,33 @@ VclPtr<TabPage> SwMailMergeWizard::createPage(WizardState _nState)
             SetRoadmapHelpId("modules/swriter/ui/mmselectpage/MMSelectPage");
         break;
         case MM_OUTPUTTYPETPAGE    :
-            pRet = VclPtr<SwMailMergeOutputTypePage>::Create(this, TabPageParent(this));
+            pRet = VclPtr<SwMailMergeOutputTypePage>::Create(this, aParent);
             SetRoadmapHelpId("modules/swriter/ui/mmoutputtypepage/MMOutputTypePage");
         break;
         case MM_ADDRESSBLOCKPAGE   :
-            pRet = VclPtr<SwMailMergeAddressBlockPage>::Create(this, TabPageParent(this));
+            pRet = VclPtr<SwMailMergeAddressBlockPage>::Create(this, aParent);
             SetRoadmapHelpId("modules/swriter/ui/mmaddressblockpage/MMAddressBlockPage");
         break;
         case MM_GREETINGSPAGE      :
-            pRet = VclPtr<SwMailMergeGreetingsPage>::Create(this, TabPageParent(this));
+            pRet = VclPtr<SwMailMergeGreetingsPage>::Create(this, aParent);
             SetRoadmapHelpId("modules/swriter/ui/mmsalutationpage/MMSalutationPage");
         break;
         case MM_LAYOUTPAGE         :
-            pRet = VclPtr<SwMailMergeLayoutPage>::Create(this, TabPageParent(this));
+            pRet = VclPtr<SwMailMergeLayoutPage>::Create(this, aParent);
             SetRoadmapHelpId("modules/swriter/ui/mmlayoutpage/MMLayoutPage");
         break;
     }
+
+    m_xAssistant->set_page_title(sIdent, getStateDisplayName(_nState));
+
+
     OSL_ENSURE(pRet, "no page created in ::createPage");
     return pRet;
 }
 
 void SwMailMergeWizard::enterState( WizardState _nState )
 {
-    ::vcl::RoadmapWizard::enterState( _nState );
+    ::vcl::RoadmapWizardMachine::enterState( _nState );
 
     if (m_xConfigItem->GetTargetView())
     {
@@ -132,7 +142,7 @@ void SwMailMergeWizard::enterState( WizardState _nState )
         m_nRestartPage = _nState;
         //set ResultSet back to start
         m_xConfigItem->MoveResultSet(1);
-        EndDialog(RET_REMOVE_TARGET);
+        m_xAssistant->response(RET_REMOVE_TARGET);
         return;
     }
     bool bEnablePrev = true;
@@ -188,7 +198,7 @@ void SwMailMergeWizard::UpdateRoadmap()
 */
 
     // enableState( <page id>, false );
-    const sal_uInt16 nCurPage = GetCurLevel();
+    const sal_uInt16 nCurPage = m_xAssistant->get_current_page();
     TabPage* pCurPage = GetPage( nCurPage );
     if(!pCurPage)
         return;
@@ -224,6 +234,8 @@ void SwMailMergeWizard::UpdateRoadmap()
             break;
             case MM_ADDRESSBLOCKPAGE:
                 bEnable = !m_bDocumentLoad && bEnableOutputTypePage;
+                // update page title for email vs letter
+                m_xAssistant->set_page_title(OString::number(MM_ADDRESSBLOCKPAGE), getStateDisplayName(MM_ADDRESSBLOCKPAGE));
             break;
             case MM_GREETINGSPAGE:
                 bEnable = !m_bDocumentLoad && bEnableOutputTypePage &&
@@ -240,7 +252,7 @@ void SwMailMergeWizard::UpdateRoadmap()
     }
 }
 
-short SwMailMergeWizard::Execute()
+short SwMailMergeWizard::run()
 {
     OSL_FAIL("SwMailMergeWizard cannot be executed via Dialog::Execute!\n"
                "It creates a thread (MailDispatcher instance) that will call"
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index b95d4344a402..51d00b0b53da 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -73,7 +73,7 @@ SwMailMergeAddressBlockPage::SwMailMergeAddressBlockPage(SwMailMergeWizard* pWiz
     , m_xDocumentIndexFI(m_xBuilder->weld_label("documentindex"))
     , m_xPrevSetIB(m_xBuilder->weld_button("prev"))
     , m_xNextSetIB(m_xBuilder->weld_button("next"))
-    , m_xDifferentlist(m_xBuilder->weld_label("differentlist"))
+    , m_xDifferentlist(m_xBuilder->weld_button("differentlist"))
     , m_xSettings(new SwAddressPreview(m_xBuilder->weld_scrolled_window("settingspreviewwin")))
     , m_xPreview(new SwAddressPreview(m_xBuilder->weld_scrolled_window("addresspreviewwin")))
     , m_xSettingsWIN(new weld::CustomWeld(*m_xBuilder, "settingspreview", *m_xSettings))
@@ -111,7 +111,6 @@ void SwMailMergeAddressBlockPage::dispose()
     m_xPreview.reset();
     m_xSettings.reset();
 
-    m_pWizard.clear();
     vcl::OWizardPage::dispose();
 }
 
@@ -210,7 +209,7 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AssignHdl_Impl, weld::Button&, void
     SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
     const sal_uInt16 nSel = m_xSettings->GetSelectedAddress();
     const uno::Sequence< OUString> aBlocks = rConfigItem.GetAddressBlocks();
-    SwAssignFieldsDialog aDlg(m_pWizard->GetFrameWeld(), m_pWizard->GetConfigItem(), aBlocks[nSel], true);
+    SwAssignFieldsDialog aDlg(m_pWizard->getDialog(), m_pWizard->GetConfigItem(), aBlocks[nSel], true);
     if(RET_OK == aDlg.run())
     {
         //preview update
@@ -263,7 +262,7 @@ void SwMailMergeAddressBlockPage::InsertDataHdl(weld::Button* pButton)
 {
     //if no pButton is given, the first set has to be pre-set
     SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem();
-    m_pWizard->EnterWait();
+    std::unique_ptr<weld::WaitObject> xWaitObj(new weld::WaitObject(m_pWizard->getDialog()));
     if(!pButton)
     {
         rConfig.GetResultSet();
@@ -274,7 +273,7 @@ void SwMailMergeAddressBlockPage::InsertDataHdl(weld::Button* pButton)
         sal_Int32 nPos = rConfig.GetResultSetPosition();
         rConfig.MoveResultSet( bNext ? ++nPos : --nPos);
     }
-    m_pWizard->LeaveWait();
+    xWaitObj.reset();
     sal_Int32 nPos = rConfig.GetResultSetPosition();
     bool bEnable = true;
     if(nPos < 1)
diff --git a/sw/source/ui/dbui/mmaddressblockpage.hxx b/sw/source/ui/dbui/mmaddressblockpage.hxx
index 4d50cfaa4961..910110814740 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.hxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.hxx
@@ -38,7 +38,7 @@ class SwMailMergeAddressBlockPage : public vcl::OWizardPage
     OUString            m_sCurrentAddress;
     OUString            m_sChangeAddress;
 
-    VclPtr<SwMailMergeWizard>  m_pWizard;
+    SwMailMergeWizard*  m_pWizard;
 
     std::unique_ptr<weld::Button> m_xAddressListPB;
     std::unique_ptr<weld::Label> m_xCurrentAddressFI;
@@ -58,7 +58,7 @@ class SwMailMergeAddressBlockPage : public vcl::OWizardPage
     std::unique_ptr<weld::Button> m_xPrevSetIB;
     std::unique_ptr<weld::Button> m_xNextSetIB;
 
-    std::unique_ptr<weld::Label> m_xDifferentlist;
+    std::unique_ptr<weld::Button> m_xDifferentlist;
 
     std::unique_ptr<SwAddressPreview> m_xSettings;
     std::unique_ptr<SwAddressPreview> m_xPreview;
diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx
index ee22935376e3..d7ef4d37f336 100644
--- a/sw/source/ui/dbui/mmdocselectpage.cxx
+++ b/sw/source/ui/dbui/mmdocselectpage.cxx
@@ -88,13 +88,6 @@ SwMailMergeDocSelectPage::SwMailMergeDocSelectPage(SwMailMergeWizard* pWizard, T
 
 SwMailMergeDocSelectPage::~SwMailMergeDocSelectPage()
 {
-    disposeOnce();
-}
-
-void SwMailMergeDocSelectPage::dispose()
-{
-    m_pWizard.clear();
-    vcl::OWizardPage::dispose();
 }
 
 IMPL_LINK_NOARG(SwMailMergeDocSelectPage, DocSelectHdl, weld::ToggleButton&, void)
@@ -194,7 +187,7 @@ bool SwMailMergeDocSelectPage::commitPage( ::vcl::WizardTypes::CommitPageReason
             if(!sReloadDocument.isEmpty())
                 m_pWizard->SetReloadDocument( sReloadDocument );
             m_pWizard->SetRestartPage(MM_OUTPUTTYPETPAGE);
-            m_pWizard->EndDialog(RET_LOAD_DOC);
+            m_pWizard->response(RET_LOAD_DOC);
         }
     }
     return bReturn;
diff --git a/sw/source/ui/dbui/mmdocselectpage.hxx b/sw/source/ui/dbui/mmdocselectpage.hxx
index 0a7afb45f240..ef35e5c8f2e4 100644
--- a/sw/source/ui/dbui/mmdocselectpage.hxx
+++ b/sw/source/ui/dbui/mmdocselectpage.hxx
@@ -29,7 +29,7 @@ class SwMailMergeDocSelectPage : public vcl::OWizardPage
     OUString            m_sLoadFileName;
     OUString            m_sLoadTemplateName;
 
-    VclPtr<SwMailMergeWizard>  m_pWizard;
+    SwMailMergeWizard*  m_pWizard;
 
     std::unique_ptr<weld::RadioButton> m_xCurrentDocRB;
     std::unique_ptr<weld::RadioButton> m_xNewDocRB;
@@ -48,7 +48,6 @@ class SwMailMergeDocSelectPage : public vcl::OWizardPage
 public:
     SwMailMergeDocSelectPage(SwMailMergeWizard* pWizard, TabPageParent pParent);
     virtual ~SwMailMergeDocSelectPage() override;
-    virtual void dispose() override;
 };
 
 #endif
diff --git a/sw/source/ui/dbui/mmgreetingspage.hxx b/sw/source/ui/dbui/mmgreetingspage.hxx
index b3e241a9fa82..e3560986a947 100644
--- a/sw/source/ui/dbui/mmgreetingspage.hxx
+++ b/sw/source/ui/dbui/mmgreetingspage.hxx
@@ -31,7 +31,7 @@ class SwMailMergeWizard;
 class SwGreetingsHandler
 {
 protected:
-    VclPtr<SwMailMergeWizard>  m_pWizard;
+    SwMailMergeWizard*  m_pWizard;
     /// The mail merge state, available even when m_pWizard is nullptr.
     SwMailMergeConfigItem& m_rConfigItem;
     bool m_bIsTabPage;
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx
index ef464a8a6648..95a27bf16615 100644
--- a/sw/source/ui/dbui/mmlayoutpage.cxx
+++ b/sw/source/ui/dbui/mmlayoutpage.cxx
@@ -159,7 +159,6 @@ SwMailMergeLayoutPage::~SwMailMergeLayoutPage()
 void SwMailMergeLayoutPage::dispose()
 {
     File::remove( m_sExampleURL );
-    m_pWizard.clear();
     vcl::OWizardPage::dispose();
 }
 
diff --git a/sw/source/ui/dbui/mmlayoutpage.hxx b/sw/source/ui/dbui/mmlayoutpage.hxx
index 6ce46554b993..6e63992f1b65 100644
--- a/sw/source/ui/dbui/mmlayoutpage.hxx
+++ b/sw/source/ui/dbui/mmlayoutpage.hxx
@@ -40,7 +40,7 @@ class SwMailMergeLayoutPage : public vcl::OWizardPage
 
     bool                m_bIsGreetingInserted;
 
-    VclPtr<SwMailMergeWizard>  m_pWizard;
+    SwMailMergeWizard*  m_pWizard;
 
     css::uno::Reference< css::beans::XPropertySet >  m_xViewProperties;
 
diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx
index c470a9f1a9e0..d74a7a0c85b1 100644
--- a/sw/source/ui/dbui/mmoutputtypepage.cxx
+++ b/sw/source/ui/dbui/mmoutputtypepage.cxx
@@ -62,13 +62,6 @@ SwMailMergeOutputTypePage::SwMailMergeOutputTypePage(SwMailMergeWizard* pWizard,
 
 SwMailMergeOutputTypePage::~SwMailMergeOutputTypePage()
 {
-    disposeOnce();
-}
-
-void SwMailMergeOutputTypePage::dispose()
-{
-    m_pWizard.clear();
-    vcl::OWizardPage::dispose();
 }
 
 IMPL_LINK_NOARG(SwMailMergeOutputTypePage, TypeHdl_Impl, weld::ToggleButton&, void)
@@ -77,7 +70,6 @@ IMPL_LINK_NOARG(SwMailMergeOutputTypePage, TypeHdl_Impl, weld::ToggleButton&, vo
     m_xLetterHint->set_visible(bLetter);
     m_xMailHint->set_visible(!bLetter);
     m_pWizard->GetConfigItem().SetOutputToLetter(bLetter);
-    m_pWizard->updateRoadmapItemLabel( MM_ADDRESSBLOCKPAGE );
     m_pWizard->UpdateRoadmap();
 }
 
diff --git a/sw/source/ui/dbui/mmoutputtypepage.hxx b/sw/source/ui/dbui/mmoutputtypepage.hxx
index 5b2f2ab1c17c..73346dfe8bde 100644
--- a/sw/source/ui/dbui/mmoutputtypepage.hxx
+++ b/sw/source/ui/dbui/mmoutputtypepage.hxx
@@ -25,7 +25,7 @@ class SwMailMergeWizard;
 
 class SwMailMergeOutputTypePage : public vcl::OWizardPage
 {
-    VclPtr<SwMailMergeWizard>  m_pWizard;
+    SwMailMergeWizard*  m_pWizard;
 
     std::unique_ptr<weld::RadioButton> m_xLetterRB;
     std::unique_ptr<weld::RadioButton> m_xMailRB;
@@ -37,7 +37,6 @@ class SwMailMergeOutputTypePage : public vcl::OWizardPage
 public:
     SwMailMergeOutputTypePage(SwMailMergeWizard* pWizard, TabPageParent pParent);
     virtual ~SwMailMergeOutputTypePage() override;
-    virtual void dispose() override;
 };
 #endif
 
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index b4da2613af55..dbcc97b426fb 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -739,13 +739,6 @@ void AbstractSwWordCountFloatDlg_Impl::SetCounts(const SwDocStat &rCurrCnt, cons
 
 AbstractMailMergeWizard_Impl::~AbstractMailMergeWizard_Impl()
 {
-    disposeOnce();
-}
-
-void AbstractMailMergeWizard_Impl::dispose()
-{
-    pDlg.disposeAndClear();
-    AbstractMailMergeWizard::dispose();
 }
 
 bool AbstractMailMergeWizard_Impl::StartExecuteAsync(AsyncContext &rCtx)
@@ -753,27 +746,27 @@ bool AbstractMailMergeWizard_Impl::StartExecuteAsync(AsyncContext &rCtx)
     // SwMailMergeWizardExecutor wants to run the lifecycle of this dialog
     // so clear mxOwner here and leave it up to SwMailMergeWizardExecutor
     rCtx.mxOwner.clear();
-    return pDlg->StartExecuteAsync(rCtx);
+    return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
 }
 
 short AbstractMailMergeWizard_Impl::Execute()
 {
-    return pDlg->Execute();
+    return m_xDlg->run();
 }
 
 OUString AbstractMailMergeWizard_Impl::GetReloadDocument() const
 {
-    return pDlg->GetReloadDocument();
+    return m_xDlg->GetReloadDocument();
 }
 
 void AbstractMailMergeWizard_Impl::ShowPage( sal_uInt16 nLevel )
 {
-    pDlg->skipUntil(nLevel);
+    m_xDlg->skipUntil(nLevel);
 }
 
 sal_uInt16 AbstractMailMergeWizard_Impl::GetRestartPage() const
 {
-    return pDlg->GetRestartPage();
+    return m_xDlg->GetRestartPage();
 }
 
 VclPtr<AbstractSwInsertAbstractDlg> SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg(weld::Window* pParent)
@@ -1149,7 +1142,7 @@ VclPtr<AbstractMailMergeWizard> SwAbstractDialogFactory_Impl::CreateMailMergeWiz
                                     SwView& rView, std::shared_ptr<SwMailMergeConfigItem>& rConfigItem)
 {
 #if HAVE_FEATURE_DBCONNECTIVITY
-    return VclPtr<AbstractMailMergeWizard_Impl>::Create( VclPtr<SwMailMergeWizard>::Create(rView, rConfigItem));
+    return VclPtr<AbstractMailMergeWizard_Impl>::Create(std::make_unique<SwMailMergeWizard>(rView, rConfigItem));
 #else
     (void) rView;
     (void) rConfigItem;
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index d149f5ce9e5b..656de1e57e3e 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -637,14 +637,14 @@ public:
 class SwMailMergeWizard;
 class AbstractMailMergeWizard_Impl : public AbstractMailMergeWizard
 {
-    VclPtr<SwMailMergeWizard> pDlg;
+    std::shared_ptr<SwMailMergeWizard> m_xDlg;
 
 public:
-    explicit AbstractMailMergeWizard_Impl( SwMailMergeWizard* p )
-     : pDlg(p)
-     {}
+    explicit AbstractMailMergeWizard_Impl(std::unique_ptr<SwMailMergeWizard> p)
+        : m_xDlg(std::move(p))
+    {
+    }
     virtual         ~AbstractMailMergeWizard_Impl() override;
-    virtual void    dispose() override;
     virtual bool    StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
     virtual short   Execute() override;
 
diff --git a/sw/source/uibase/inc/mailmergewizard.hxx b/sw/source/uibase/inc/mailmergewizard.hxx
index c6865a280e96..96407c14d2f2 100644
--- a/sw/source/uibase/inc/mailmergewizard.hxx
+++ b/sw/source/uibase/inc/mailmergewizard.hxx
@@ -31,7 +31,7 @@ class SwMailMergeConfigItem;
 #define MM_GREETINGSPAGE        3
 #define MM_LAYOUTPAGE           4
 
-class SwMailMergeWizard : public ::vcl::RoadmapWizard
+class SwMailMergeWizard : public ::vcl::RoadmapWizardMachine
 {
     SwView* const           m_pSwView;
     OUString                sDocumentURL;
@@ -48,14 +48,12 @@ class SwMailMergeWizard : public ::vcl::RoadmapWizard
 
     sal_uInt16              m_nRestartPage;
 
-    using vcl::OWizardMachine::skipUntil;
+    using vcl::WizardMachine::skipUntil;
 
 protected:
     virtual VclPtr<TabPage>         createPage( WizardState _nState ) override;
     virtual void                    enterState( WizardState _nState ) override;
 
-// roadmap feature ??
-//    virtual sal_Bool            prepareLeaveCurrentState( CommitPageReason _eReason );
     virtual OUString                getStateDisplayName( WizardState _nState ) const override;
 
 public:
@@ -77,11 +75,9 @@ public:
     void                    SetRestartPage(sal_uInt16 nPage) { m_nRestartPage = nPage;}
 
     bool                skipUntil( sal_uInt16 nPage)
-                                {return ::vcl::RoadmapWizard::skipUntil(WizardState(nPage));}
+                                {return ::vcl::RoadmapWizardMachine::skipUntil(WizardState(nPage));}
 
-    using vcl::RoadmapWizard::updateRoadmapItemLabel;
-
-    virtual short           Execute() override;
+    virtual short           run() override;
 };
 #endif
 
diff --git a/sw/uiconfig/swriter/ui/mmaddressblockpage.ui b/sw/uiconfig/swriter/ui/mmaddressblockpage.ui
index ebecf2aad090..a79532185440 100644
--- a/sw/uiconfig/swriter/ui/mmaddressblockpage.ui
+++ b/sw/uiconfig/swriter/ui/mmaddressblockpage.ui
@@ -1,18 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
-  <requires lib="LibreOffice" version="1.0"/>
   <object class="GtkImage" id="image1">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="stock">gtk-media-previous</property>
+    <property name="stock">gtk-go-back</property>
     <property name="icon_size">1</property>
   </object>
   <object class="GtkImage" id="image2">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="stock">gtk-media-next</property>
+    <property name="stock">gtk-go-forward</property>
     <property name="icon_size">1</property>
   </object>
   <object class="GtkBox" id="MMAddressBlockPage">
@@ -68,8 +67,6 @@
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -83,30 +80,25 @@
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">1</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="currentaddress">
                         <property name="can_focus">False</property>
                         <property name="no_show_all">True</property>
-                        <property name="xalign">1</property>
                         <property name="label" translatable="yes" context="mmaddressblockpage|currentaddress">Current address list: %1</property>
+                        <property name="xalign">1</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">1</property>
                         <property name="width">2</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -120,48 +112,40 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="hexpand">True</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
                             <property name="label" translatable="yes" context="mmaddressblockpage|label2">Select the address list containing the address data you want to use. This data is needed to create the address block.</property>
                             <property name="wrap">True</property>
                             <property name="max_width_chars">56</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkLabel" id="label3">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="label" translatable="yes" context="mmaddressblockpage|label3">1.</property>
                             <property name="xalign">0</property>
                             <property name="yalign">0</property>
-                            <property name="label" translatable="yes" context="mmaddressblockpage|label3">1.</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -182,8 +166,6 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -197,48 +179,40 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="hexpand">True</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
                             <property name="label" translatable="yes" context="mmaddressblockpage|label4">Match the field name used in the mail merge to the column headers in your data source.</property>
                             <property name="wrap">True</property>
                             <property name="max_width_chars">56</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkLabel" id="settingsft1">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="label" translatable="yes" context="mmaddressblockpage|settingsft1">3.</property>
                             <property name="xalign">0</property>
                             <property name="yalign">0</property>
-                            <property name="label" translatable="yes" context="mmaddressblockpage|settingsft1">3.</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -253,14 +227,13 @@
                       <object class="GtkLabel" id="settingsft">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="label" translatable="yes" context="mmaddressblockpage|settingsft">2.</property>
                         <property name="xalign">0</property>
                         <property name="yalign">0</property>
-                        <property name="label" translatable="yes" context="mmaddressblockpage|settingsft">2.</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
                         <property name="height">2</property>
                       </packing>
                     </child>
@@ -277,8 +250,6 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -314,8 +285,6 @@
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -344,16 +313,12 @@
                                   <packing>
                                     <property name="left_attach">0</property>
                                     <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
                                 <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
                               </packing>
                             </child>
                             <child>
@@ -369,8 +334,6 @@
                               <packing>
                                 <property name="left_attach">0</property>
                                 <property name="top_attach">1</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
                               </packing>
                             </child>
                           </object>
@@ -379,16 +342,12 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -438,8 +397,6 @@
                               <packing>
                                 <property name="left_attach">0</property>
                                 <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
                               </packing>
                             </child>
                             <child>
@@ -458,8 +415,6 @@
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -473,8 +428,6 @@
                                   <packing>
                                     <property name="left_attach">2</property>
                                     <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -482,22 +435,18 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="hexpand">True</property>
-                                    <property name="xalign">1</property>
                                     <property name="label" translatable="yes" context="mmaddressblockpage|documentindex">Document: %1</property>
+                                    <property name="xalign">1</property>
                                   </object>
                                   <packing>
                                     <property name="left_attach">0</property>
                                     <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
                                 <property name="top_attach">1</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
                               </packing>
                             </child>
                           </object>
@@ -506,8 +455,6 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -521,48 +468,40 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="hexpand">True</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
                             <property name="label" translatable="yes" context="mmaddressblockpage|label6">Check if the address data matches correctly.</property>
                             <property name="wrap">True</property>
                             <property name="max_width_chars">56</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkLabel" id="settingsft2">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="label" translatable="yes" context="mmaddressblockpage|settingsft2">4.</property>
                             <property name="xalign">0</property>
                             <property name="yalign">0</property>
-                            <property name="label" translatable="yes" context="mmaddressblockpage|settingsft2">4.</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">3</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
                   </packing>
                 </child>
               </object>
diff --git a/sw/uiconfig/swriter/ui/mmoutputtypepage.ui b/sw/uiconfig/swriter/ui/mmoutputtypepage.ui
index e5b1a366be91..1b70c6211b58 100644
--- a/sw/uiconfig/swriter/ui/mmoutputtypepage.ui
+++ b/sw/uiconfig/swriter/ui/mmoutputtypepage.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkBox" id="MMOutputTypePage">
@@ -40,11 +40,12 @@
                     <property name="can_focus">False</property>
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
-                    <property name="xalign">0</property>
-                    <property name="yalign">0</property>
                     <property name="label" translatable="yes" context="mmoutputtypepage|letterft">Send letters to a group of recipients. The letters can contain an address block and a salutation. The letters can be personalized for each recipient.</property>
                     <property name="wrap">True</property>
+                    <property name="width_chars">72</property>
                     <property name="max_width_chars">72</property>
+                    <property name="xalign">0</property>
+                    <property name="yalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -57,11 +58,12 @@
                     <property name="can_focus">False</property>
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
-                    <property name="xalign">0</property>
-                    <property name="yalign">0</property>
                     <property name="label" translatable="yes" context="mmoutputtypepage|emailft">Send email messages to a group of recipients. The email messages can contain a salutation. The email messages can be personalized for each recipient.</property>
                     <property name="wrap">True</property>
+                    <property name="width_chars">72</property>
                     <property name="max_width_chars">72</property>
+                    <property name="xalign">0</property>
+                    <property name="yalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
diff --git a/sw/uiconfig/swriter/ui/mmsalutationpage.ui b/sw/uiconfig/swriter/ui/mmsalutationpage.ui
index d2c33bdfd286..46c6ebd53d8a 100644
--- a/sw/uiconfig/swriter/ui/mmsalutationpage.ui
+++ b/sw/uiconfig/swriter/ui/mmsalutationpage.ui
@@ -5,13 +5,13 @@
   <object class="GtkImage" id="image1">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="stock">gtk-media-previous</property>
+    <property name="stock">gtk-go-back</property>
     <property name="icon_size">1</property>
   </object>
   <object class="GtkImage" id="image2">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="stock">gtk-media-next</property>
+    <property name="stock">gtk-go-forward</property>
     <property name="icon_size">1</property>
   </object>
   <object class="GtkBox" id="MMSalutationPage">
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 547bac4170c1..b13ecb37645f 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1553,10 +1553,18 @@ public:
         // take the first shown page as the size for all pages
         if (m_xWizard->GetPageSizePixel().Width() == 0)
         {
-            TabPage* pPage = m_xWizard->GetPage(m_aIds[nPage]);
-            assert(pPage);
-            Size aPageSize(pPage->get_preferred_size());
-            m_xWizard->SetPageSizePixel(aPageSize);
+            Size aFinalSize;
+            for (int i = 0, nPages = get_n_pages(); i < nPages; ++i)
+            {
+                TabPage* pPage = m_xWizard->GetPage(m_aIds[i]);
+                assert(pPage);
+                Size aPageSize(pPage->get_preferred_size());
+                if (aPageSize.Width() > aFinalSize.Width())
+                    aFinalSize.setWidth(aPageSize.Width());
+                if (aPageSize.Height() > aFinalSize.Height())
+                    aFinalSize.setHeight(aPageSize.Height());
+            }
+            m_xWizard->SetPageSizePixel(aFinalSize);
         }
 
         m_xWizard->ShowPage(m_aIds[nPage]);
@@ -2238,15 +2246,15 @@ weld::Button* SalInstanceDialog::weld_widget_for_response(int nResponse)
 weld::Button* SalInstanceAssistant::weld_widget_for_response(int nResponse)
 {
     PushButton* pButton = nullptr;
-    if (nResponse == static_cast<int>(WizardButtonFlags::NEXT))
+    if (nResponse == RET_YES)
         pButton = m_xWizard->m_pNextPage;
-    else if (nResponse == static_cast<int>(WizardButtonFlags::PREVIOUS))
+    else if (nResponse == RET_NO)
         pButton = m_xWizard->m_pPrevPage;
-    else if (nResponse == static_cast<int>(WizardButtonFlags::FINISH))
+    else if (nResponse == RET_OK)
         pButton = m_xWizard->m_pFinish;
-    else if (nResponse == static_cast<int>(WizardButtonFlags::CANCEL))
+    else if (nResponse == RET_CANCEL)
         pButton = m_xWizard->m_pCancel;
-    else if (nResponse == static_cast<int>(WizardButtonFlags::HELP))
+    else if (nResponse == RET_HELP)
         pButton = m_xWizard->m_pHelp;
     if (pButton)
         return new SalInstanceButton(pButton, nullptr, false);
diff --git a/vcl/source/control/wizardmachine.cxx b/vcl/source/control/wizardmachine.cxx
index 8f291ce40c38..8082df6ab39a 100644
--- a/vcl/source/control/wizardmachine.cxx
+++ b/vcl/source/control/wizardmachine.cxx
@@ -688,11 +688,11 @@ namespace vcl
         : AssistantController(pParent, "vcl/ui/wizard.ui", "Wizard")
         , m_nCurState(0)
         , m_pFirstPage(nullptr)
-        , m_xFinish(m_xAssistant->weld_widget_for_response(static_cast<int>(WizardButtonFlags::FINISH)))
-        , m_xCancel(m_xAssistant->weld_widget_for_response(static_cast<int>(WizardButtonFlags::CANCEL)))
-        , m_xNextPage(m_xAssistant->weld_widget_for_response(static_cast<int>(WizardButtonFlags::NEXT)))
-        , m_xPrevPage(m_xAssistant->weld_widget_for_response(static_cast<int>(WizardButtonFlags::PREVIOUS)))
-        , m_xHelp(m_xAssistant->weld_widget_for_response(static_cast<int>(WizardButtonFlags::HELP)))
+        , m_xFinish(m_xAssistant->weld_widget_for_response(RET_OK))
+        , m_xCancel(m_xAssistant->weld_widget_for_response(RET_CANCEL))
+        , m_xNextPage(m_xAssistant->weld_widget_for_response(RET_YES))
+        , m_xPrevPage(m_xAssistant->weld_widget_for_response(RET_NO))
+        , m_xHelp(m_xAssistant->weld_widget_for_response(RET_HELP))
         , m_pImpl(new WizardMachineImplData)
     {
         implConstruct(nButtonFlags);
@@ -892,7 +892,7 @@ namespace vcl
 
     bool WizardMachine::onFinish()
     {
-        return Finish(static_cast<int>(WizardButtonFlags::FINISH));
+        return Finish(RET_OK);
     }
 
     IMPL_LINK_NOARG(WizardMachine, OnFinish, weld::Button&, void)
@@ -909,7 +909,7 @@ namespace vcl
 
     IMPL_LINK_NOARG(WizardMachine, OnCancel, weld::Button&, void)
     {
-        m_xAssistant->response(static_cast<int>(WizardButtonFlags::CANCEL));
+        m_xAssistant->response(RET_CANCEL);
     }
 
     WizardMachine::WizardState WizardMachine::determineNextState( WizardState _nCurrentState ) const
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index fc0ccc8184fe..1d6216958c71 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3010,7 +3010,7 @@ struct DialogRunner
     }
 
     static void signal_response(GtkDialog*, gint nResponseId, gpointer data);
-    static void signal_cancel(GtkDialog*, gpointer data);
+    static void signal_cancel(GtkAssistant*, gpointer data);
 
     static gboolean signal_delete(GtkDialog* pDialog, GdkEventAny*, gpointer data)
     {
@@ -3159,6 +3159,7 @@ private:
     std::function<void(sal_Int32)> m_aFunc;
     gulong m_nCloseSignalId;
     gulong m_nResponseSignalId;
+    gulong m_nCancelSignalId;
     gulong m_nSignalDeleteId;
 
     // for calc ref dialog that shrink to range selection widgets and resize back
@@ -3185,12 +3186,25 @@ private:
         pThis->asyncresponse(ret);
     }
 
-    static gboolean signalAsyncDelete(GtkDialog*, GdkEventAny*, gpointer)
+    static void signalAsyncCancel(GtkAssistant*, gpointer widget)
     {
+        GtkInstanceDialog* pThis = static_cast<GtkInstanceDialog*>(widget);
+        // make esc in an assistant act as if cancel button was pressed
+        pThis->close(false);
+    }
+
+    static gboolean signalAsyncDelete(GtkWidget* pDialog, GdkEventAny*, gpointer widget)
+    {
+        GtkInstanceDialog* pThis = static_cast<GtkInstanceDialog*>(widget);
+        if (GTK_IS_ASSISTANT(pThis->m_pDialog))
+        {
+            // An assistant isn't a dialog, but we want to treat it like one
+            signalAsyncResponse(pDialog, GTK_RESPONSE_DELETE_EVENT, widget);
+        }
         return true; /* Do not destroy */
     }
 
-    virtual int GtkToVcl(int ret)
+    static int GtkToVcl(int ret)
     {
         if (ret == GTK_RESPONSE_OK)
             ret = RET_OK;
@@ -3204,10 +3218,12 @@ private:
             ret = RET_YES;
         else if (ret == GTK_RESPONSE_NO)
             ret = RET_NO;
+        else if (ret == GTK_RESPONSE_HELP)
+            ret = RET_HELP;
         return ret;
     }
 
-    virtual int VclToGtk(int nResponse)
+    static int VclToGtk(int nResponse)
     {
         if (nResponse == RET_OK)
             return GTK_RESPONSE_OK;
@@ -3233,6 +3249,7 @@ public:
         , m_aDialogRun(pDialog, this)
         , m_nCloseSignalId(g_signal_connect(m_pDialog, "close", G_CALLBACK(signalClose), this))
         , m_nResponseSignalId(0)
+        , m_nCancelSignalId(0)
         , m_nSignalDeleteId(0)
         , m_pRefEdit(nullptr)
         , m_nOldEditWidth(0)
@@ -3243,7 +3260,7 @@ public:
 
     virtual bool runAsync(std::shared_ptr<weld::DialogController> rDialogController, const std::function<void(sal_Int32)>& func) override
     {
-        assert(!m_nResponseSignalId);
+        assert(!m_nResponseSignalId && !m_nCancelSignalId);
 
         m_xDialogController = rDialogController;
         m_aFunc = func;
@@ -3252,7 +3269,8 @@ public:
             m_aDialogRun.inc_modal_count();
         show();
 
-        m_nResponseSignalId = g_signal_connect(m_pDialog, "response", G_CALLBACK(signalAsyncResponse), this);
+        m_nResponseSignalId = GTK_IS_DIALOG(m_pDialog) ? g_signal_connect(m_pDialog, "response", G_CALLBACK(signalAsyncResponse), this) : 0;
+        m_nCancelSignalId = GTK_IS_ASSISTANT(m_pDialog) ? g_signal_connect(m_pDialog, "cancel", G_CALLBACK(signalAsyncCancel), this) : 0;
         m_nSignalDeleteId = g_signal_connect(m_pDialog, "delete-event", G_CALLBACK(signalAsyncDelete), this);
 
         return true;
@@ -3261,7 +3279,7 @@ public:
     virtual bool runAsync(std::shared_ptr<Dialog> const & rxSelf, const std::function<void(sal_Int32)>& func) override
     {
         assert( rxSelf.get() == this );
-        assert(!m_nResponseSignalId);
+        assert(!m_nResponseSignalId && !m_nCancelSignalId);
 
         // In order to store a shared_ptr to ourself, we have to have been constructed by make_shared,
         // which is that rxSelf enforces.
@@ -3272,7 +3290,8 @@ public:
             m_aDialogRun.inc_modal_count();
         show();
 
-        m_nResponseSignalId = g_signal_connect(m_pDialog, "response", G_CALLBACK(signalAsyncResponse), this);
+        m_nResponseSignalId = GTK_IS_DIALOG(m_pDialog) ? g_signal_connect(m_pDialog, "response", G_CALLBACK(signalAsyncResponse), this) : 0;
+        m_nCancelSignalId = GTK_IS_ASSISTANT(m_pDialog) ? g_signal_connect(m_pDialog, "cancel", G_CALLBACK(signalAsyncCancel), this) : 0;
         m_nSignalDeleteId = g_signal_connect(m_pDialog, "delete-event", G_CALLBACK(signalAsyncDelete), this);
 
         return true;
@@ -3442,6 +3461,8 @@ public:
         g_signal_handler_disconnect(m_pDialog, m_nCloseSignalId);
         if (m_nResponseSignalId)
             g_signal_handler_disconnect(m_pDialog, m_nResponseSignalId);
+        if (m_nCancelSignalId)
+            g_signal_handler_disconnect(m_pDialog, m_nCancelSignalId);
         if (m_nSignalDeleteId)
             g_signal_handler_disconnect(m_pDialog, m_nSignalDeleteId);
     }
@@ -3462,7 +3483,7 @@ void DialogRunner::signal_response(GtkDialog*, gint nResponseId, gpointer data)
     pThis->loop_quit();
 }
 
-void DialogRunner::signal_cancel(GtkDialog*, gpointer data)
+void DialogRunner::signal_cancel(GtkAssistant*, gpointer data)
 {
     DialogRunner* pThis = static_cast<DialogRunner*>(data);
 
@@ -3630,40 +3651,6 @@ private:
         return -1;
     }
 
-    virtual int GtkToVcl(int ret) override
-    {
-        if (ret == GTK_RESPONSE_OK)
-            ret = static_cast<int>(WizardButtonFlags::FINISH);
-        else if (ret == GTK_RESPONSE_CANCEL)
-            ret = static_cast<int>(WizardButtonFlags::CANCEL);
-        else if (ret == GTK_RESPONSE_DELETE_EVENT)
-            ret = static_cast<int>(WizardButtonFlags::CANCEL);
-        else if (ret == GTK_RESPONSE_CLOSE)
-            ret = static_cast<int>(WizardButtonFlags::CANCEL);
-        else if (ret == GTK_RESPONSE_ACCEPT)
-            ret = static_cast<int>(WizardButtonFlags::NEXT);
-        else if (ret == GTK_RESPONSE_REJECT)
-            ret = static_cast<int>(WizardButtonFlags::PREVIOUS);
-        else if (ret == GTK_RESPONSE_HELP)
-            ret = static_cast<int>(WizardButtonFlags::HELP);
-        return ret;
-    }
-
-    virtual int VclToGtk(int nResponse) override
-    {
-        if (nResponse == static_cast<int>(WizardButtonFlags::NEXT))
-            return GTK_RESPONSE_ACCEPT;
-        if (nResponse == static_cast<int>(WizardButtonFlags::PREVIOUS))
-            return GTK_RESPONSE_REJECT;
-        else if (nResponse == static_cast<int>(WizardButtonFlags::FINISH))
-            return GTK_RESPONSE_OK;
-        else if (nResponse == static_cast<int>(WizardButtonFlags::CANCEL))
-            return GTK_RESPONSE_CANCEL;
-        else if (nResponse == static_cast<int>(WizardButtonFlags::HELP))
-            return GTK_RESPONSE_HELP;
-        return nResponse;
-    }
-
     static void wrap_sidebar_label(GtkWidget *pWidget, gpointer /*user_data*/)
     {
         if (GTK_IS_LABEL(pWidget))
@@ -3851,9 +3838,9 @@ public:
     virtual GtkButton* get_widget_for_response(int nGtkResponse) override
     {
         GtkButton* pButton = nullptr;
-        if (nGtkResponse == GTK_RESPONSE_ACCEPT)
+        if (nGtkResponse == GTK_RESPONSE_YES)
             pButton = m_pNext;
-        else if (nGtkResponse == GTK_RESPONSE_REJECT)
+        else if (nGtkResponse == GTK_RESPONSE_NO)
             pButton = m_pBack;
         else if (nGtkResponse == GTK_RESPONSE_OK)
             pButton = m_pFinish;
@@ -5212,8 +5199,13 @@ void GtkInstanceDialog::response(int nResponse)
         gtk_dialog_response(GTK_DIALOG(m_pDialog), nGtkResponse);
     else if (GTK_IS_ASSISTANT(m_pDialog))
     {
-        m_aDialogRun.m_nResponseId = nGtkResponse;
-        m_aDialogRun.loop_quit();
+        if (!m_aDialogRun.loop_is_running())
+            asyncresponse(nGtkResponse);
+        else
+        {
+            m_aDialogRun.m_nResponseId = nGtkResponse;
+            m_aDialogRun.loop_quit();
+        }
     }
 }
 


More information about the Libreoffice-commits mailing list