[Libreoffice-commits] core.git: 2 commits - include/vcl svtools/source svtools/uiconfig svtools/UIConfig_svt.mk sw/inc sw/source sw/uiconfig vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 20 19:25:21 UTC 2019


 include/vcl/roadmapwizard.hxx                      |    4 
 svtools/UIConfig_svt.mk                            |    1 
 svtools/source/uno/wizard/unowizard.cxx            |   52 --
 svtools/source/uno/wizard/wizardpagecontroller.cxx |    8 
 svtools/source/uno/wizard/wizardpagecontroller.hxx |    2 
 svtools/source/uno/wizard/wizardshell.cxx          |   31 -
 svtools/source/uno/wizard/wizardshell.hxx          |    6 
 svtools/uiconfig/ui/emptypage.ui                   |   16 
 sw/inc/dbmgr.hxx                                   |    5 
 sw/inc/swabstdlg.hxx                               |    2 
 sw/source/ui/dbui/dbtablepreviewdialog.cxx         |   34 -
 sw/source/ui/dbui/dbtablepreviewdialog.hxx         |   12 
 sw/source/ui/dbui/selectdbtabledialog.cxx          |    4 
 sw/source/ui/dialog/swdlgfact.cxx                  |   26 -
 sw/source/ui/dialog/swdlgfact.hxx                  |   10 
 sw/source/ui/envelp/mailmrge.cxx                   |  386 ++++++++-------------
 sw/source/uibase/dbui/dbmgr.cxx                    |   38 --
 sw/source/uibase/inc/mailmrge.hxx                  |  105 ++---
 sw/uiconfig/swriter/ui/mailmerge.ui                |    7 
 sw/uiconfig/swriter/ui/tablepreviewdialog.ui       |   76 +++-
 vcl/source/control/roadmapwizard.cxx               |   13 
 21 files changed, 390 insertions(+), 448 deletions(-)

New commits:
commit 910b8b04325e0103941b6c6d152e4ee5f0388fc2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Sep 15 17:42:39 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 20 21:24:06 2019 +0200

    make WizardShell use RoadmapWizardMachine
    
    Change-Id: Id7e1e163f17cd4866c37bbd6cad73b8c721f4dae
    Reviewed-on: https://gerrit.libreoffice.org/78969
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/roadmapwizard.hxx b/include/vcl/roadmapwizard.hxx
index a720cce8b684..6a55bacadfbc 100644
--- a/include/vcl/roadmapwizard.hxx
+++ b/include/vcl/roadmapwizard.hxx
@@ -157,6 +157,10 @@ namespace vcl
         */
         void    enableState(WizardTypes::WizardState nState, bool _bEnable = true);
 
+        /** returns true if and only if the given state is known in at least one declared path
+        */
+        bool    knowsState(WizardTypes::WizardState nState) const;
+
         // WizardMachine overriables
         virtual void            enterState(WizardTypes::WizardState nState) override;
 
diff --git a/svtools/UIConfig_svt.mk b/svtools/UIConfig_svt.mk
index 44963c37a1ca..dd4744f620b8 100644
--- a/svtools/UIConfig_svt.mk
+++ b/svtools/UIConfig_svt.mk
@@ -12,6 +12,7 @@ $(eval $(call gb_UIConfig_UIConfig,svt))
 $(eval $(call gb_UIConfig_add_uifiles,svt,\
 	svtools/uiconfig/ui/addresstemplatedialog \
 	svtools/uiconfig/ui/datewindow \
+	svtools/uiconfig/ui/emptypage \
 	svtools/uiconfig/ui/fileviewmenu \
 	svtools/uiconfig/ui/graphicexport \
 	svtools/uiconfig/ui/inputbox \
diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx
index d52a69b39e0f..856d0ba3dafc 100644
--- a/svtools/source/uno/wizard/unowizard.cxx
+++ b/svtools/source/uno/wizard/unowizard.cxx
@@ -247,10 +247,10 @@ namespace {
 
     svt::OGenericUnoDialog::Dialog Wizard::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
     {
-        VclPtrInstance<WizardShell> pDialog(VCLUnoHelper::GetWindow(rParent), m_xController, m_aWizardSteps);
-        pDialog->SetHelpId(  lcl_getHelpId( m_sHelpURL ) );
-        pDialog->setTitleBase( m_sTitle );
-        return OGenericUnoDialog::Dialog(pDialog);
+        auto xDialog = std::make_unique<WizardShell>(Application::GetFrameWeld(rParent), m_xController, m_aWizardSteps);
+        xDialog->set_help_id(lcl_getHelpId(m_sHelpURL));
+        xDialog->setTitleBase( m_sTitle );
+        return OGenericUnoDialog::Dialog(std::move(xDialog));
     }
 
     OUString SAL_CALL Wizard::getImplementationName()
@@ -258,26 +258,22 @@ namespace {
         return "com.sun.star.comp.svtools.uno.Wizard";
     }
 
-
     Sequence< OUString > SAL_CALL Wizard::getSupportedServiceNames()
     {
         Sequence< OUString > aServices { "com.sun.star.ui.dialogs.Wizard" };
         return aServices;
     }
 
-
     Reference< XPropertySetInfo > SAL_CALL Wizard::getPropertySetInfo()
     {
         return createPropertySetInfo( getInfoHelper() );
     }
 
-
     ::cppu::IPropertyArrayHelper& SAL_CALL Wizard::getInfoHelper()
     {
         return *getArrayHelper();
     }
 
-
     ::cppu::IPropertyArrayHelper* Wizard::createArrayHelper( ) const
     {
         Sequence< Property > aProps;
@@ -285,7 +281,6 @@ namespace {
         return new ::cppu::OPropertyArrayHelper( aProps );
     }
 
-
     OUString SAL_CALL Wizard::getHelpURL()
     {
         SolarMutexGuard aSolarGuard;
@@ -297,7 +292,6 @@ namespace {
         return lcl_getHelpURL(m_aDialog.get_help_id());
     }
 
-
     void SAL_CALL Wizard::setHelpURL( const OUString& i_HelpURL )
     {
         SolarMutexGuard aSolarGuard;
@@ -309,71 +303,65 @@ namespace {
             m_aDialog.set_help_id(lcl_getHelpId(i_HelpURL));
     }
 
-
     Reference< XWindow > SAL_CALL Wizard::getDialogWindow()
     {
         SolarMutexGuard aSolarGuard;
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        ENSURE_OR_RETURN( m_aDialog.m_xVclDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", nullptr );
-        return Reference< XWindow >( m_aDialog.m_xVclDialog->GetComponentInterface(), UNO_QUERY );
+        ENSURE_OR_RETURN( m_aDialog.m_xWeldDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", nullptr );
+        return m_aDialog.m_xWeldDialog->getDialog()->GetXWindow();
     }
 
-
     void SAL_CALL Wizard::enableButton( ::sal_Int16 i_WizardButton, sal_Bool i_Enable )
     {
         SolarMutexGuard aSolarGuard;
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() );
+        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() );
         ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enableButtons: invalid dialog implementation!" );
 
         pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable );
     }
 
-
     void SAL_CALL Wizard::setDefaultButton( ::sal_Int16 i_WizardButton )
     {
         SolarMutexGuard aSolarGuard;
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() );
+        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() );
         ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::setDefaultButton: invalid dialog implementation!" );
 
         pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) );
     }
 
-
     sal_Bool SAL_CALL Wizard::travelNext(  )
     {
         SolarMutexGuard aSolarGuard;
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() );
+        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() );
         ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelNext: invalid dialog implementation!" );
 
         return pWizardImpl->travelNext();
     }
 
-
     sal_Bool SAL_CALL Wizard::travelPrevious(  )
     {
         SolarMutexGuard aSolarGuard;
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() );
+        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() );
         ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelPrevious: invalid dialog implementation!" );
 
         return pWizardImpl->travelPrevious();
     }
 
-
     void SAL_CALL Wizard::enablePage( ::sal_Int16 i_PageID, sal_Bool i_Enable )
     {
         SolarMutexGuard aSolarGuard;
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() );
+        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() );
         ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enablePage: invalid dialog implementation!" );
 
         if ( !pWizardImpl->knowsPage( i_PageID ) )
@@ -385,55 +373,50 @@ namespace {
         pWizardImpl->enablePage( i_PageID, i_Enable );
     }
 
-
     void SAL_CALL Wizard::updateTravelUI(  )
     {
         SolarMutexGuard aSolarGuard;
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() );
+        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() );
         ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" );
 
         pWizardImpl->updateTravelUI();
     }
 
-
     sal_Bool SAL_CALL Wizard::advanceTo( ::sal_Int16 i_PageId )
     {
         SolarMutexGuard aSolarGuard;
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() );
+        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() );
         ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::advanceTo: invalid dialog implementation!" );
 
         return pWizardImpl->advanceTo( i_PageId );
     }
 
-
     sal_Bool SAL_CALL Wizard::goBackTo( ::sal_Int16 i_PageId )
     {
         SolarMutexGuard aSolarGuard;
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() );
+        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() );
         ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::goBackTo: invalid dialog implementation!" );
 
         return pWizardImpl->goBackTo( i_PageId );
     }
 
-
     Reference< XWizardPage > SAL_CALL Wizard::getCurrentPage(  )
     {
         SolarMutexGuard aSolarGuard;
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() );
+        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() );
         ENSURE_OR_RETURN( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!", Reference< XWizardPage >() );
 
         return pWizardImpl->getCurrentWizardPage();
     }
 
-
     void SAL_CALL Wizard::activatePath( ::sal_Int16 i_PathIndex, sal_Bool i_Final )
     {
         SolarMutexGuard aSolarGuard;
@@ -442,25 +425,22 @@ namespace {
         if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) )
             throw NoSuchElementException( OUString(), *this );
 
-        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xVclDialog.get() );
+        WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_aDialog.m_xWeldDialog.get() );
         ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" );
 
         pWizardImpl->activatePath( i_PathIndex, i_Final );
     }
 
-
     void SAL_CALL Wizard::setTitle( const OUString& i_Title )
     {
         // simply disambiguate
         Wizard_Base::OGenericUnoDialog::setTitle( i_Title );
     }
 
-
     ::sal_Int16 SAL_CALL Wizard::execute(  )
     {
         return Wizard_Base::OGenericUnoDialog::execute();
     }
-
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
diff --git a/svtools/source/uno/wizard/wizardpagecontroller.cxx b/svtools/source/uno/wizard/wizardpagecontroller.cxx
index 5c5a4a725b6a..35f3d171f9aa 100644
--- a/svtools/source/uno/wizard/wizardpagecontroller.cxx
+++ b/svtools/source/uno/wizard/wizardpagecontroller.cxx
@@ -45,7 +45,7 @@ namespace svt { namespace uno
     //= WizardPageController
 
 
-    WizardPageController::WizardPageController( WizardShell& i_rParent, const Reference< XWizardController >& i_rController,
+    WizardPageController::WizardPageController( TabPageParent aParent, const Reference< XWizardController >& i_rController,
             const sal_Int16 i_nPageId )
         :m_xController( i_rController )
         ,m_xWizardPage()
@@ -53,10 +53,8 @@ namespace svt { namespace uno
         ENSURE_OR_THROW( m_xController.is(), "no controller" );
         try
         {
-            m_xWizardPage.set( m_xController->createPage(
-                Reference< XWindow >( i_rParent.GetComponentInterface(), UNO_QUERY_THROW ),
-                i_nPageId
-            ), UNO_SET_THROW );
+            // Plug a toplevel SalFrame into the native page which can host our awt widgetry
+            m_xWizardPage.set(m_xController->createPage(aParent.pPage->CreateChildFrame(), i_nPageId), UNO_SET_THROW);
 
             Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW );
             xPageWindow->setVisible( true );
diff --git a/svtools/source/uno/wizard/wizardpagecontroller.hxx b/svtools/source/uno/wizard/wizardpagecontroller.hxx
index b81421372e82..0ce9f479067d 100644
--- a/svtools/source/uno/wizard/wizardpagecontroller.hxx
+++ b/svtools/source/uno/wizard/wizardpagecontroller.hxx
@@ -38,7 +38,7 @@ namespace svt { namespace uno
     {
     public:
         WizardPageController(
-            WizardShell& i_rParent,
+            TabPageParent aParent,
             const css::uno::Reference< css::ui::dialogs::XWizardController >& i_rController,
             const sal_Int16 i_nPageId
         );
diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx
index 4b8b6e9052a9..6cca7478f0ce 100644
--- a/svtools/source/uno/wizard/wizardshell.cxx
+++ b/svtools/source/uno/wizard/wizardshell.cxx
@@ -50,10 +50,9 @@ namespace svt { namespace uno
         }
     }
 
-
     //= WizardShell
-    WizardShell::WizardShell( vcl::Window* i_pParent, const Reference< XWizardController >& i_rController,
-            const Sequence< Sequence< sal_Int16 > >& i_rPaths )
+    WizardShell::WizardShell(weld::Window* i_pParent, const Reference< XWizardController >& i_rController,
+            const Sequence< Sequence< sal_Int16 > >& i_rPaths)
         :WizardShell_Base( i_pParent )
         ,m_xController( i_rController )
         ,m_nFirstPageID( lcl_determineFirstPageID( i_rPaths ) )
@@ -71,22 +70,19 @@ namespace svt { namespace uno
         }
 
         // create the first page, to know the page size
-        TabPage* pStartPage = GetOrCreatePage( impl_pageIdToState( i_rPaths[0][0] ) );
-        SetPageSizePixel( pStartPage->GetSizePixel() );
+        GetOrCreatePage( impl_pageIdToState( i_rPaths[0][0] ) );
+        m_xAssistant->set_current_page(0);
 
         // some defaults
-        SetRoadmapInteractive( true );
         enableAutomaticNextButtonState();
     }
 
-
-    short WizardShell::Execute()
+    short WizardShell::run()
     {
         ActivatePage();
-        return WizardShell_Base::Execute();
+        return WizardShell_Base::run();
     }
 
-
     sal_Int16 WizardShell::convertCommitReasonToTravelType( const CommitPageReason i_eReason )
     {
         switch ( i_eReason )
@@ -176,14 +172,21 @@ namespace svt { namespace uno
     {
         ENSURE_OR_RETURN( m_xController.is(), "WizardShell::createPage: no WizardController!", nullptr );
 
-        std::shared_ptr< WizardPageController > pController( new WizardPageController( *this, m_xController, impl_stateToPageId( i_nState ) ) );
+        sal_Int16 nPageId = impl_stateToPageId(i_nState);
+
+        OString sIdent(OString::number(nPageId));
+        weld::Container* pPageContainer = m_xAssistant->append_page(sIdent);
+        // TODO eventually pass DialogController as distinct argument instead of bundling into TabPageParent
+        TabPageParent aParent(pPageContainer, this);
+
+        std::shared_ptr< WizardPageController > pController(new WizardPageController(aParent, m_xController, nPageId));
         VclPtr<TabPage> pPage = pController->getTabPage();
         OSL_ENSURE( pPage, "WizardShell::createPage: illegal tab page!" );
-        if ( !pPage )
+        if (!pPage)
         {
             // fallback for ill-behaved clients: empty page
-            pPage = VclPtr<TabPage>::Create( this, 0 );
-            pPage->SetSizePixel(LogicToPixel(Size(280, 185), MapMode(MapUnit::MapAppFont)));
+            pPage = VclPtr<vcl::OWizardPage>::Create(aParent, "svt/ui/emptypage.ui", "EmptyPage");
+            pPage->SetSizePixel(pPage->LogicToPixel(Size(280, 185), MapMode(MapUnit::MapAppFont)));
         }
 
         m_aPageControllers[ pPage ] = pController;
diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx
index f56451397d25..9f6fddc7977a 100644
--- a/svtools/source/uno/wizard/wizardshell.hxx
+++ b/svtools/source/uno/wizard/wizardshell.hxx
@@ -39,18 +39,18 @@ namespace svt { namespace uno
 
     //= WizardShell
 
-    typedef ::vcl::RoadmapWizard    WizardShell_Base;
+    typedef ::vcl::RoadmapWizardMachine WizardShell_Base;
     class WizardShell : public WizardShell_Base
     {
     public:
         WizardShell(
-            vcl::Window* _pParent,
+            weld::Window* pParent,
             const css::uno::Reference< css::ui::dialogs::XWizardController >& i_rController,
             const css::uno::Sequence< css::uno::Sequence< sal_Int16 > >& i_rPaths
         );
 
         // Dialog overridables
-        virtual short   Execute() override;
+        virtual short   run() override;
 
         // OWizardMachine overridables
         virtual VclPtr<TabPage> createPage( WizardState i_nState ) override;
diff --git a/svtools/uiconfig/ui/emptypage.ui b/svtools/uiconfig/ui/emptypage.ui
new file mode 100644
index 000000000000..c793016c20d9
--- /dev/null
+++ b/svtools/uiconfig/ui/emptypage.ui
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="svt">
+  <requires lib="gtk+" version="3.18"/>
+  <object class="GtkBox" id="EmptyPage">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="border_width">6</property>
+    <property name="spacing">6</property>
+    <child>
+      <placeholder/>
+    </child>
+  </object>
+</interface>
diff --git a/vcl/source/control/roadmapwizard.cxx b/vcl/source/control/roadmapwizard.cxx
index b370b4969775..501122245e8d 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -909,6 +909,19 @@ namespace vcl
         return false;
     }
 
+    bool RoadmapWizardMachine::knowsState( WizardTypes::WizardState i_nState ) const
+    {
+        for (auto const& path : m_pImpl->aPaths)
+        {
+            for (auto const& state : path.second)
+            {
+                if ( state == i_nState )
+                    return true;
+            }
+        }
+        return false;
+    }
+
     bool RoadmapWizard::isStateEnabled( WizardTypes::WizardState _nState ) const
     {
         return m_xRoadmapImpl->aDisabledStates.find( _nState ) == m_xRoadmapImpl->aDisabledStates.end();
commit ca7c24dafe7aba7c2d71994d2561f1ae3d59257e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jun 27 11:25:21 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 20 21:23:45 2019 +0200

    weld SwDBTablePreviewDialog and SwMailMergeDlg
    
    Change-Id: Icb7c96b6e9a4d6777fbd0cb4a8eb54547413d390
    Reviewed-on: https://gerrit.libreoffice.org/74798
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index d648ff0fc3f0..c9e69a9861e1 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -312,13 +312,8 @@ public:
     bool            GetTableNames(weld::ComboBox& rBox, const OUString& rDBName);
 
     /// Fill listbox with all column names of a database table.
-    void            GetColumnNames(ListBox* pListBox,
-                            const OUString& rDBName, const OUString& rTableName);
     void            GetColumnNames(weld::ComboBox& rBox,
                             const OUString& rDBName, const OUString& rTableName);
-    static void GetColumnNames(ListBox* pListBox,
-                            css::uno::Reference< css::sdbc::XConnection> const & xConnection,
-                            const OUString& rTableName);
     static void GetColumnNames(weld::ComboBox& rBox,
                             css::uno::Reference< css::sdbc::XConnection> const & xConnection,
                             const OUString& rTableName);
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 37a689cce58b..3d4dd0d7ff29 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -461,7 +461,7 @@ public:
     virtual VclPtr<AbstractJavaEditDialog>     CreateJavaEditDialog(weld::Window* pParent,
         SwWrtShell* pWrtSh) = 0;
     virtual VclPtr<AbstractMailMergeDlg>       CreateMailMergeDlg(
-                                                vcl::Window* pParent, SwWrtShell& rSh,
+                                                weld::Window* pParent, SwWrtShell& rSh,
                                                 const OUString& rSourceName,
                                                 const OUString& rTableName,
                                                 sal_Int32 nCommandType,
diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.cxx b/sw/source/ui/dbui/dbtablepreviewdialog.cxx
index 27110367df53..23e7984623d8 100644
--- a/sw/source/ui/dbui/dbtablepreviewdialog.cxx
+++ b/sw/source/ui/dbui/dbtablepreviewdialog.cxx
@@ -32,38 +32,36 @@ using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::util;
 
-SwDBTablePreviewDialog::SwDBTablePreviewDialog(vcl::Window* pParent, uno::Sequence< beans::PropertyValue> const & rValues ) :
-    SfxModalDialog(pParent, "TablePreviewDialog", "modules/swriter/ui/tablepreviewdialog.ui")
+SwDBTablePreviewDialog::SwDBTablePreviewDialog(weld::Window* pParent, uno::Sequence< beans::PropertyValue> const & rValues)
+    : SfxDialogController(pParent, "modules/swriter/ui/tablepreviewdialog.ui", "TablePreviewDialog")
+    , m_xDescriptionFI(m_xBuilder->weld_label("description"))
+    , m_xBeamerWIN(m_xBuilder->weld_container("beamer"))
 {
-    get(m_pDescriptionFI, "description");
-    get(m_pBeamerWIN, "beamer");
-    Size aSize(LogicToPixel(Size(338, 150), MapMode(MapUnit::MapAppFont)));
-    m_pBeamerWIN->set_width_request(aSize.Width());
-    m_pBeamerWIN->set_height_request(aSize.Height());
+    Size aSize(m_xBeamerWIN->get_approximate_digit_width() * 80,
+               m_xBeamerWIN->get_text_height() * 18);
+    m_xBeamerWIN->set_size_request(aSize.Width(), aSize.Height());
 
     auto pValue = std::find_if(rValues.begin(), rValues.end(),
         [](const beans::PropertyValue& rValue) { return rValue.Name == "Command"; });
     if (pValue != rValues.end())
     {
-        OUString sDescription = m_pDescriptionFI->GetText();
+        OUString sDescription = m_xDescriptionFI->get_label();
         OUString sTemp;
         pValue->Value >>= sTemp;
-        m_pDescriptionFI->SetText(sDescription.replaceFirst("%1", sTemp));
+        m_xDescriptionFI->set_label(sDescription.replaceFirst("%1", sTemp));
     }
 
     try
     {
         // create a frame wrapper for myself
         m_xFrame = frame::Frame::create( comphelper::getProcessComponentContext() );
-        // m_xFrame takes ownership of m_pBeamerWIN
-        m_pUIBuilder->drop_ownership(m_pBeamerWIN);
-        m_xFrame->initialize( VCLUnoHelper::GetInterface( m_pBeamerWIN ) );
+        m_xFrame->initialize(m_xBeamerWIN->CreateChildFrame());
     }
     catch (uno::Exception const &)
     {
         m_xFrame.clear();
     }
-    if(m_xFrame.is())
+    if (m_xFrame.is())
     {
         util::URL aURL;
         aURL.Complete = ".component:DB/DataSourceBrowser";
@@ -71,27 +69,19 @@ SwDBTablePreviewDialog::SwDBTablePreviewDialog(vcl::Window* pParent, uno::Sequen
         if(xD.is())
         {
             xD->dispatch(aURL, rValues);
-            m_pBeamerWIN->Show();
+            m_xBeamerWIN->show();
         }
     }
 }
 
 SwDBTablePreviewDialog::~SwDBTablePreviewDialog()
 {
-    disposeOnce();
-}
-
-void SwDBTablePreviewDialog::dispose()
-{
     if(m_xFrame.is())
     {
         m_xFrame->setComponent(nullptr, nullptr);
         m_xFrame->dispose();
         m_xFrame.clear();
     }
-    m_pDescriptionFI.clear();
-    m_pBeamerWIN.clear();
-    SfxModalDialog::dispose();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.hxx b/sw/source/ui/dbui/dbtablepreviewdialog.hxx
index 1eb3dfd14dc3..ec2c58d92bf3 100644
--- a/sw/source/ui/dbui/dbtablepreviewdialog.hxx
+++ b/sw/source/ui/dbui/dbtablepreviewdialog.hxx
@@ -20,7 +20,6 @@
 #define INCLUDED_SW_SOURCE_UI_DBUI_DBTABLEPREVIEWDIALOG_HXX
 
 #include <sfx2/basedlgs.hxx>
-#include <vcl/fixed.hxx>
 #include <com/sun/star/uno/Sequence.h>
 
 namespace com{ namespace sun{ namespace star{
@@ -28,19 +27,18 @@ namespace com{ namespace sun{ namespace star{
     namespace frame{ class XFrame2;     }
     }}}
 
-class SwDBTablePreviewDialog : public SfxModalDialog
+class SwDBTablePreviewDialog : public SfxDialogController
 {
-    VclPtr<FixedText>      m_pDescriptionFI;
-    VclPtr<vcl::Window>    m_pBeamerWIN;
+    std::unique_ptr<weld::Label> m_xDescriptionFI;
+    std::unique_ptr<weld::Container> m_xBeamerWIN;
 
     css::uno::Reference< css::frame::XFrame2 >         m_xFrame;
 public:
-    SwDBTablePreviewDialog(vcl::Window* pParent,
+    SwDBTablePreviewDialog(weld::Window* pParent,
             css::uno::Sequence< css::beans::PropertyValue> const & rValues  );
     virtual ~SwDBTablePreviewDialog() override;
-    virtual void dispose() override;
-
 };
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dbui/selectdbtabledialog.cxx b/sw/source/ui/dbui/selectdbtabledialog.cxx
index aa5a4263e861..820f74c155cf 100644
--- a/sw/source/ui/dbui/selectdbtabledialog.cxx
+++ b/sw/source/ui/dbui/selectdbtabledialog.cxx
@@ -122,8 +122,8 @@ IMPL_LINK_NOARG(SwSelectDBTableDialog, PreviewHdl, weld::Button&, void)
     pProperties[4].Name = "ShowTreeViewButton";
     pProperties[4].Value <<= false;
 
-    VclPtrInstance< SwDBTablePreviewDialog > pDlg(nullptr, aProperties); //TODO
-    pDlg->Execute();
+    SwDBTablePreviewDialog aDlg(m_xDialog.get(), aProperties);
+    aDlg.run();
 }
 
 OUString SwSelectDBTableDialog::GetSelectedTable(bool& bIsTable)
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index db641e3dbfe8..05dccd0da12a 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -243,7 +243,10 @@ short AbstractJavaEditDialog_Impl::Execute()
     return m_xDlg->run();
 }
 
-IMPL_ABSTDLG_BASE(AbstractMailMergeDlg_Impl);
+short AbstractMailMergeDlg_Impl::Execute()
+{
+    return m_xDlg->run();
+}
 
 short AbstractMailMergeCreateFromDlg_Impl::Execute()
 {
@@ -628,42 +631,42 @@ bool AbstractJavaEditDialog_Impl::IsUpdate() const
 
 DBManagerOptions AbstractMailMergeDlg_Impl::GetMergeType()
 {
-    return pDlg->GetMergeType();
+    return m_xDlg->GetMergeType();
 }
 
 const OUString& AbstractMailMergeDlg_Impl::GetSaveFilter() const
 {
-    return pDlg->GetSaveFilter();
+    return m_xDlg->GetSaveFilter();
 }
 
 css::uno::Sequence< css::uno::Any > AbstractMailMergeDlg_Impl::GetSelection() const
 {
-    return pDlg->GetSelection();
+    return m_xDlg->GetSelection();
 }
 
 uno::Reference< sdbc::XResultSet> AbstractMailMergeDlg_Impl::GetResultSet() const
 {
-    return pDlg->GetResultSet();
+    return m_xDlg->GetResultSet();
 }
 
 bool AbstractMailMergeDlg_Impl::IsSaveSingleDoc() const
 {
-    return pDlg->IsSaveSingleDoc();
+    return m_xDlg->IsSaveSingleDoc();
 }
 
 bool AbstractMailMergeDlg_Impl::IsGenerateFromDataBase() const
 {
-    return pDlg->IsGenerateFromDataBase();
+    return m_xDlg->IsGenerateFromDataBase();
 }
 
 OUString AbstractMailMergeDlg_Impl::GetColumnName() const
 {
-    return pDlg->GetColumnName();
+    return m_xDlg->GetColumnName();
 }
 
 OUString AbstractMailMergeDlg_Impl::GetTargetURL() const
 {
-    return pDlg->GetTargetURL();
+    return m_xDlg->GetTargetURL();
 }
 
 bool AbstractMailMergeCreateFromDlg_Impl::IsThisDocument() const
@@ -1050,14 +1053,13 @@ VclPtr<AbstractJavaEditDialog> SwAbstractDialogFactory_Impl::CreateJavaEditDialo
 }
 
 VclPtr<AbstractMailMergeDlg> SwAbstractDialogFactory_Impl::CreateMailMergeDlg(
-                                                vcl::Window* pParent, SwWrtShell& rSh,
+                                                weld::Window* pParent, SwWrtShell& rSh,
                                                 const OUString& rSourceName,
                                                 const OUString& rTableName,
                                                 sal_Int32 nCommandType,
                                                 const uno::Reference< sdbc::XConnection>& xConnection )
 {
-    VclPtr<SwMailMergeDlg> pDlg = VclPtr<SwMailMergeDlg>::Create( pParent, rSh, rSourceName, rTableName, nCommandType, xConnection, nullptr );
-    return VclPtr<AbstractMailMergeDlg_Impl>::Create( pDlg );
+    return VclPtr<AbstractMailMergeDlg_Impl>::Create(std::make_unique<SwMailMergeDlg>(pParent, rSh, rSourceName, rTableName, nCommandType, xConnection, nullptr));
 }
 
 VclPtr<AbstractMailMergeCreateFromDlg> SwAbstractDialogFactory_Impl::CreateMailMergeCreateFromDlg(weld::Window* pParent)
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index e9f619132948..fb631418ac81 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -524,7 +524,13 @@ public:
 class SwMailMergeDlg;
 class AbstractMailMergeDlg_Impl : public AbstractMailMergeDlg
 {
-    DECL_ABSTDLG_BASE(AbstractMailMergeDlg_Impl,SwMailMergeDlg)
+    std::unique_ptr<SwMailMergeDlg> m_xDlg;
+public:
+    explicit AbstractMailMergeDlg_Impl(std::unique_ptr<SwMailMergeDlg> p)
+        : m_xDlg(std::move(p))
+    {
+    }
+    virtual short Execute() override;
     virtual DBManagerOptions GetMergeType() override ;
     virtual const OUString& GetSaveFilter() const override;
     virtual css::uno::Sequence< css::uno::Any > GetSelection() const override ;
@@ -747,7 +753,7 @@ public:
     virtual VclPtr<AbstractJavaEditDialog>     CreateJavaEditDialog(weld::Window* pParent,
         SwWrtShell* pWrtSh) override;
     virtual VclPtr<AbstractMailMergeDlg>       CreateMailMergeDlg(
-                                                vcl::Window* pParent, SwWrtShell& rSh,
+                                                weld::Window* pParent, SwWrtShell& rSh,
                                                 const OUString& rSourceName,
                                                 const OUString& rTableName,
                                                 sal_Int32 nCommandType,
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx
index 1ab1348eb65d..16478dd81ccf 100644
--- a/sw/source/ui/envelp/mailmrge.cxx
+++ b/sw/source/ui/envelp/mailmrge.cxx
@@ -104,11 +104,11 @@ void SwXSelChgLstnr_Impl::selectionChanged( const EventObject&  )
         rParent.pImpl->xSelSupp->getSelection() >>= aSelection;
 
     bool bEnable = aSelection.hasElements();
-    rParent.m_pMarkedRB->Enable(bEnable);
+    rParent.m_xMarkedRB->set_sensitive(bEnable);
     if(bEnable)
-        rParent.m_pMarkedRB->Check();
-    else if(rParent.m_pMarkedRB->IsChecked()) {
-        rParent.m_pAllRB->Check();
+        rParent.m_xMarkedRB->set_active(true);
+    else if(rParent.m_xMarkedRB->get_active()) {
+        rParent.m_xAllRB->set_active(true);
         rParent.m_aSelection.realloc(0);
     }
 }
@@ -118,89 +118,71 @@ void SwXSelChgLstnr_Impl::disposing( const EventObject&  )
     OSL_FAIL("disposing");
 }
 
-SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell,
+SwMailMergeDlg::SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rShell,
                                const OUString& rSourceName,
                                const OUString& rTableName,
                                sal_Int32 nCommandType,
                                const uno::Reference< XConnection>& _xConnection,
-                               Sequence< Any > const * pSelection) :
-
-    SfxModalDialog(pParent, "MailmergeDialog", "modules/swriter/ui/mailmerge.ui"),
-
-    pImpl           (new SwMailMergeDlg_Impl),
-
-    rSh             (rShell),
-    nMergeType      (DBMGR_MERGE_EMAIL)
+                               Sequence< Any > const * pSelection)
+    : SfxDialogController(pParent, "modules/swriter/ui/mailmerge.ui", "MailmergeDialog")
+    , pImpl(new SwMailMergeDlg_Impl)
+    , rSh(rShell)
+    , nMergeType(DBMGR_MERGE_EMAIL)
+    , m_xBeamerWin(m_xBuilder->weld_container("beamer"))
+    , m_xAllRB(m_xBuilder->weld_radio_button("all"))
+    , m_xMarkedRB(m_xBuilder->weld_radio_button("selected"))
+    , m_xFromRB(m_xBuilder->weld_radio_button("rbfrom"))
+    , m_xFromNF(m_xBuilder->weld_spin_button("from"))
+    , m_xToNF(m_xBuilder->weld_spin_button("to"))
+    , m_xPrinterRB(m_xBuilder->weld_radio_button("printer"))
+    , m_xMailingRB(m_xBuilder->weld_radio_button("electronic"))
+    , m_xFileRB(m_xBuilder->weld_radio_button("file"))
+    , m_xSingleJobsCB(m_xBuilder->weld_check_button("singlejobs"))
+    , m_xSaveMergedDocumentFT(m_xBuilder->weld_label("savemergeddoclabel"))
+    , m_xSaveSingleDocRB(m_xBuilder->weld_radio_button("singledocument"))
+    , m_xSaveIndividualRB(m_xBuilder->weld_radio_button("individualdocuments"))
+    , m_xGenerateFromDataBaseCB(m_xBuilder->weld_check_button("generate"))
+    , m_xColumnFT(m_xBuilder->weld_label("fieldlabel"))
+    , m_xColumnLB(m_xBuilder->weld_combo_box("field"))
+    , m_xPathFT(m_xBuilder->weld_label("pathlabel"))
+    , m_xPathED(m_xBuilder->weld_entry("path"))
+    , m_xPathPB(m_xBuilder->weld_button("pathpb"))
+    , m_xFilterFT(m_xBuilder->weld_label("fileformatlabel"))
+    , m_xFilterLB(m_xBuilder->weld_combo_box("fileformat"))
+    , m_xAddressFieldLB(m_xBuilder->weld_combo_box("address"))
+    , m_xSubjectFT(m_xBuilder->weld_label("subjectlabel"))
+    , m_xSubjectED(m_xBuilder->weld_entry("subject"))
+    , m_xFormatFT(m_xBuilder->weld_label("mailformatlabel"))
+    , m_xAttachFT(m_xBuilder->weld_label("attachmentslabel"))
+    , m_xAttachED(m_xBuilder->weld_entry("attachments"))
+    , m_xAttachPB(m_xBuilder->weld_button("attach"))
+    , m_xFormatHtmlCB(m_xBuilder->weld_check_button("html"))
+    , m_xFormatRtfCB(m_xBuilder->weld_check_button("rtf"))
+    , m_xFormatSwCB(m_xBuilder->weld_check_button("swriter"))
+    , m_xOkBTN(m_xBuilder->weld_button("ok"))
 {
-    Size aDialogSize( GetSizePixel() );
-    get(m_pBeamerWin, "beamer");
-
-    get(m_pAllRB, "all");
-    get(m_pMarkedRB, "selected");
-    get(m_pFromRB, "rbfrom");
-    get(m_pFromNF, "from");
-    get(m_pToNF, "to");
-
-    get(m_pPrinterRB, "printer");
-    get(m_pMailingRB, "electronic");
-    get(m_pFileRB, "file");
-
-    get(m_pSingleJobsCB, "singlejobs");
-
-    get(m_pSaveMergedDocumentFT, "savemergeddoclabel");
-    get(m_pSaveSingleDocRB, "singledocument");
-    get(m_pSaveIndividualRB, "individualdocuments");
-    get(m_pGenerateFromDataBaseCB, "generate");
-
-    get(m_pColumnFT, "fieldlabel");
-    get(m_pColumnLB, "field");
-
-    get(m_pPathFT, "pathlabel");
-    get(m_pPathED, "path");
-    get(m_pPathPB, "pathpb");
-    get(m_pFilterFT, "fileformatlabel");
-    get(m_pFilterLB, "fileformat");
-
-    get(m_pAddressFieldLB, "address");
-    get(m_pSubjectFT, "subjectlabel");
-    get(m_pSubjectED, "subject");
-    get(m_pFormatFT, "mailformatlabel");
-    get(m_pAttachFT, "attachmentslabel");
-    get(m_pAttachED, "attachments");
-    get(m_pAttachPB, "attach");
-    get(m_pFormatHtmlCB, "html");
-    get(m_pFormatRtfCB, "rtf");
-    get(m_pFormatSwCB, "swriter");
-
-    get(m_pOkBTN, "ok");
-
-    m_pSingleJobsCB->Show(false); // not supported in since cws printerpullpages anymore
+    m_xSingleJobsCB->hide(); // not supported in since cws printerpullpages anymore
     //task #97066# mailing of form letters is currently not supported
-    m_pMailingRB->Show(false);
-    m_pSubjectFT->Show(false);
-    m_pSubjectED->Show(false);
-    m_pFormatFT->Show(false);
-    m_pFormatSwCB->Show(false);
-    m_pFormatHtmlCB->Show(false);
-    m_pFormatRtfCB->Show(false);
-    m_pAttachFT->Show(false);
-    m_pAttachED->Show(false);
-    m_pAttachPB->Show(false);
-
-    Point aMailPos = m_pMailingRB->GetPosPixel();
-    Point aFilePos = m_pFileRB->GetPosPixel();
-    aFilePos.AdjustX( -((aFilePos.X() - aMailPos.X()) /2) );
-    m_pFileRB->SetPosPixel(aFilePos);
+    m_xMailingRB->hide();
+    m_xSubjectFT->hide();
+    m_xSubjectED->hide();
+    m_xFormatFT->hide();
+    m_xFormatSwCB->hide();
+    m_xFormatHtmlCB->hide();
+    m_xFormatRtfCB->hide();
+    m_xAttachFT->hide();
+    m_xAttachED->hide();
+    m_xAttachPB->hide();
+
     uno::Reference< lang::XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory();
     if(pSelection) {
         m_aSelection = *pSelection;
-        m_pBeamerWin->Show(false);
+        m_xBeamerWin->hide();
     } else {
         try {
             // create a frame wrapper for myself
             m_xFrame = frame::Frame::create( comphelper::getProcessComponentContext() );
-            m_pUIBuilder->drop_ownership(m_pBeamerWin);
-            m_xFrame->initialize( VCLUnoHelper::GetInterface ( m_pBeamerWin ) );
+            m_xFrame->initialize(m_xBeamerWin->CreateChildFrame());
         } catch (const Exception&) {
             m_xFrame.clear();
         }
@@ -220,7 +202,7 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell,
                 pProperties[2].Name = "CommandType";
                 pProperties[2].Value <<= nCommandType;
                 xD->dispatch(aURL, aProperties);
-                m_pBeamerWin->Show();
+                m_xBeamerWin->show();
             }
             uno::Reference<XController> xController = m_xFrame->getController();
             pImpl->xFController.set(xController, UNO_QUERY);
@@ -238,55 +220,51 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell,
     pModOpt = SW_MOD()->GetModuleConfig();
 
     MailTextFormats nMailingMode(pModOpt->GetMailingFormats());
-    m_pFormatSwCB->Check(bool(nMailingMode & MailTextFormats::OFFICE));
-    m_pFormatHtmlCB->Check(bool(nMailingMode & MailTextFormats::HTML));
-    m_pFormatRtfCB->Check(bool(nMailingMode & MailTextFormats::RTF));
+    m_xFormatSwCB->set_active(bool(nMailingMode & MailTextFormats::OFFICE));
+    m_xFormatHtmlCB->set_active(bool(nMailingMode & MailTextFormats::HTML));
+    m_xFormatRtfCB->set_active(bool(nMailingMode & MailTextFormats::RTF));
 
-    m_pAllRB->Check();
+    m_xAllRB->set_active(true);
 
     // Install handlers
-    Link<Button*,void> aLk = LINK(this, SwMailMergeDlg, ButtonHdl);
-    m_pOkBTN->SetClickHdl(aLk);
+    m_xOkBTN->connect_clicked(LINK(this, SwMailMergeDlg, ButtonHdl));
 
-    m_pPathPB->SetClickHdl(LINK(this, SwMailMergeDlg, InsertPathHdl));
+    m_xPathPB->connect_clicked(LINK(this, SwMailMergeDlg, InsertPathHdl));
 
-    aLk = LINK(this, SwMailMergeDlg, OutputTypeHdl);
-    m_pPrinterRB->SetClickHdl(aLk);
-    m_pFileRB->SetClickHdl(aLk);
+    m_xPrinterRB->connect_toggled(LINK(this, SwMailMergeDlg, OutputTypeHdl));
+    m_xFileRB->connect_toggled(LINK(this, SwMailMergeDlg, OutputTypeHdl));
 
     //#i63267# printing might be disabled
     bool bIsPrintable = !Application::GetSettings().GetMiscSettings().GetDisablePrinting();
-    m_pPrinterRB->Enable(bIsPrintable);
-    OutputTypeHdl(bIsPrintable ? m_pPrinterRB : m_pFileRB);
+    m_xPrinterRB->set_sensitive(bIsPrintable);
+    OutputTypeHdl(bIsPrintable ? *m_xPrinterRB : *m_xFileRB);
 
-    aLk = LINK(this, SwMailMergeDlg, FilenameHdl);
-    m_pGenerateFromDataBaseCB->SetClickHdl( aLk );
+    m_xGenerateFromDataBaseCB->connect_toggled(LINK(this, SwMailMergeDlg, FilenameHdl));
     bool bColumn = pModOpt->IsNameFromColumn();
     if(bColumn)
-        m_pGenerateFromDataBaseCB->Check();
+        m_xGenerateFromDataBaseCB->set_active(true);
 
-    FilenameHdl( m_pGenerateFromDataBaseCB );
-    aLk = LINK(this, SwMailMergeDlg, SaveTypeHdl);
-    m_pSaveSingleDocRB->Check();
-    m_pSaveSingleDocRB->SetClickHdl( aLk );
-    m_pSaveIndividualRB->SetClickHdl( aLk );
-    aLk.Call( m_pSaveSingleDocRB );
+    FilenameHdl(*m_xGenerateFromDataBaseCB);
+    m_xSaveSingleDocRB->set_active(true);
+    m_xSaveSingleDocRB->connect_toggled(LINK(this, SwMailMergeDlg, SaveTypeHdl));
+    m_xSaveIndividualRB->connect_toggled(LINK(this, SwMailMergeDlg, SaveTypeHdl));
+    SaveTypeHdl(*m_xSaveSingleDocRB);
 
-    Link<Edit&,void> aLk2 = LINK(this, SwMailMergeDlg, ModifyHdl);
-    m_pFromNF->SetModifyHdl(aLk2);
-    m_pToNF->SetModifyHdl(aLk2);
-    m_pFromNF->SetMax(SAL_MAX_INT32);
-    m_pToNF->SetMax(SAL_MAX_INT32);
+    Link<weld::SpinButton&,void> aLk2 = LINK(this, SwMailMergeDlg, ModifyHdl);
+    m_xFromNF->connect_value_changed(aLk2);
+    m_xToNF->connect_value_changed(aLk2);
+    m_xFromNF->set_max(SAL_MAX_INT32);
+    m_xToNF->set_max(SAL_MAX_INT32);
 
     SwDBManager* pDBManager = rSh.GetDBManager();
     if(_xConnection.is())
-        SwDBManager::GetColumnNames(m_pAddressFieldLB, _xConnection, rTableName);
+        SwDBManager::GetColumnNames(*m_xAddressFieldLB, _xConnection, rTableName);
     else
-        pDBManager->GetColumnNames(m_pAddressFieldLB, rSourceName, rTableName);
-    for(sal_Int32 nEntry = 0; nEntry < m_pAddressFieldLB->GetEntryCount(); ++nEntry)
-        m_pColumnLB->InsertEntry(m_pAddressFieldLB->GetEntry(nEntry));
+        pDBManager->GetColumnNames(*m_xAddressFieldLB, rSourceName, rTableName);
+    for(sal_Int32 nEntry = 0, nEntryCount = m_xAddressFieldLB->get_count(); nEntry < nEntryCount; ++nEntry)
+        m_xColumnLB->append_text(m_xAddressFieldLB->get_text(nEntry));
 
-    m_pAddressFieldLB->SelectEntry("EMAIL");
+    m_xAddressFieldLB->set_active_text("EMAIL");
 
     OUString sPath(pModOpt->GetMailingPath());
     if(sPath.isEmpty()) {
@@ -295,29 +273,28 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell,
     }
     INetURLObject aURL(sPath);
     if(aURL.GetProtocol() == INetProtocol::File)
-        m_pPathED->SetText(aURL.PathToFileName());
+        m_xPathED->set_text(aURL.PathToFileName());
     else
-        m_pPathED->SetText(aURL.GetFull());
+        m_xPathED->set_text(aURL.GetFull());
 
     if (!bColumn ) {
-        m_pColumnLB->SelectEntry("NAME");
+        m_xColumnLB->set_active_text("NAME");
     } else
-        m_pColumnLB->SelectEntry(pModOpt->GetNameFromColumn());
+        m_xColumnLB->set_active_text(pModOpt->GetNameFromColumn());
 
-    if (m_pAddressFieldLB->GetSelectedEntryCount() == 0)
-        m_pAddressFieldLB->SelectEntryPos(0);
-    if (m_pColumnLB->GetSelectedEntryCount() == 0)
-        m_pColumnLB->SelectEntryPos(0);
+    if (m_xAddressFieldLB->get_active() == -1)
+        m_xAddressFieldLB->set_active(0);
+    if (m_xColumnLB->get_active() == -1)
+        m_xColumnLB->set_active(0);
 
     const bool bEnable = m_aSelection.hasElements();
-    m_pMarkedRB->Enable(bEnable);
+    m_xMarkedRB->set_sensitive(bEnable);
     if (bEnable)
-        m_pMarkedRB->Check();
+        m_xMarkedRB->set_active(true);
     else {
-        m_pAllRB->Check();
-        m_pMarkedRB->Enable(false);
+        m_xAllRB->set_active(true);
+        m_xMarkedRB->set_sensitive(false);
     }
-    SetMinOutputSizePixel(aDialogSize);
     try {
         uno::Reference< container::XNameContainer> xFilterFactory(
             xMSF->createInstance("com.sun.star.document.FilterFactory"), UNO_QUERY_THROW);
@@ -343,136 +320,91 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell,
             if (pProp != aFilterProperties.end())
                 pProp->Value >>= sUIName2;
             if( !sUIName2.isEmpty() ) {
-                const sal_Int32 nFilter = m_pFilterLB->InsertEntry( sUIName2 );
                 if( sFilter == "writer8" )
-                    nODT = nFilter;
-                m_pFilterLB->SetEntryData( nFilter, new OUString( sFilter ) );
+                    nODT = m_xFilterLB->get_count();
+                m_xFilterLB->append(sFilter, sUIName2);
             }
         }
-        m_pFilterLB->SelectEntryPos( nODT );
+        m_xFilterLB->set_active( nODT );
     } catch (const uno::Exception&) {
     }
 }
 
 SwMailMergeDlg::~SwMailMergeDlg()
 {
-    disposeOnce();
-}
-
-void SwMailMergeDlg::dispose()
-{
     if(m_xFrame.is()) {
         m_xFrame->setComponent(nullptr, nullptr);
         m_xFrame->dispose();
     }
-
-    for( sal_Int32 nFilter = 0; nFilter < m_pFilterLB->GetEntryCount(); ++nFilter ) {
-        OUString* pData = static_cast< OUString* >( m_pFilterLB->GetEntryData(nFilter) );
-        delete pData;
-    }
-    pImpl.reset();
-    m_pBeamerWin.clear();
-    m_pAllRB.clear();
-    m_pMarkedRB.clear();
-    m_pFromRB.clear();
-    m_pFromNF.clear();
-    m_pToNF.clear();
-    m_pPrinterRB.clear();
-    m_pMailingRB.clear();
-    m_pFileRB.clear();
-    m_pSingleJobsCB.clear();
-    m_pSaveMergedDocumentFT.clear();
-    m_pSaveSingleDocRB.clear();
-    m_pSaveIndividualRB.clear();
-    m_pGenerateFromDataBaseCB.clear();
-    m_pColumnFT.clear();
-    m_pColumnLB.clear();
-    m_pPathFT.clear();
-    m_pPathED.clear();
-    m_pPathPB.clear();
-    m_pFilterFT.clear();
-    m_pFilterLB.clear();
-    m_pAddressFieldLB.clear();
-    m_pSubjectFT.clear();
-    m_pSubjectED.clear();
-    m_pFormatFT.clear();
-    m_pAttachFT.clear();
-    m_pAttachED.clear();
-    m_pAttachPB.clear();
-    m_pFormatHtmlCB.clear();
-    m_pFormatRtfCB.clear();
-    m_pFormatSwCB.clear();
-    m_pOkBTN.clear();
-    SfxModalDialog::dispose();
 }
 
-IMPL_LINK( SwMailMergeDlg, ButtonHdl, Button *, pBtn, void )
+IMPL_LINK_NOARG(SwMailMergeDlg, ButtonHdl, weld::Button&, void)
 {
-    if (pBtn == m_pOkBTN && ExecQryShell() )
-        EndDialog(RET_OK);
+    if (ExecQryShell())
+        m_xDialog->response(RET_OK);
 }
 
-IMPL_LINK( SwMailMergeDlg, OutputTypeHdl, Button *, pBtn, void )
+IMPL_LINK_NOARG(SwMailMergeDlg, OutputTypeHdl, weld::ToggleButton&, void)
 {
-    bool bPrint = pBtn == m_pPrinterRB;
-    m_pSingleJobsCB->Enable(bPrint);
+    bool bPrint = m_xPrinterRB->get_active();
+    m_xSingleJobsCB->set_sensitive(bPrint);
 
-    m_pSaveMergedDocumentFT->Enable( !bPrint );
-    m_pSaveSingleDocRB->Enable( !bPrint );
-    m_pSaveIndividualRB->Enable( !bPrint );
+    m_xSaveMergedDocumentFT->set_sensitive( !bPrint );
+    m_xSaveSingleDocRB->set_sensitive( !bPrint );
+    m_xSaveIndividualRB->set_sensitive( !bPrint );
 
     if( !bPrint ) {
-        SaveTypeHdl( m_pSaveSingleDocRB->IsChecked() ? m_pSaveSingleDocRB : m_pSaveIndividualRB );
+        SaveTypeHdl( m_xSaveSingleDocRB->get_active() ? *m_xSaveSingleDocRB : *m_xSaveIndividualRB );
     } else {
-        m_pPathFT->Enable(false);
-        m_pPathED->Enable(false);
-        m_pPathPB->Enable(false);
-        m_pColumnFT->Enable(false);
-        m_pColumnLB->Enable(false);
-        m_pFilterFT->Enable(false);
-        m_pFilterLB->Enable(false);
-        m_pGenerateFromDataBaseCB->Enable(false);
+        m_xPathFT->set_sensitive(false);
+        m_xPathED->set_sensitive(false);
+        m_xPathPB->set_sensitive(false);
+        m_xColumnFT->set_sensitive(false);
+        m_xColumnLB->set_sensitive(false);
+        m_xFilterFT->set_sensitive(false);
+        m_xFilterLB->set_sensitive(false);
+        m_xGenerateFromDataBaseCB->set_sensitive(false);
     }
 }
 
-IMPL_LINK( SwMailMergeDlg, SaveTypeHdl, Button*,  pBtn, void )
+IMPL_LINK_NOARG(SwMailMergeDlg, SaveTypeHdl, weld::ToggleButton&, void)
 {
-    bool bIndividual = pBtn == m_pSaveIndividualRB;
+    bool bIndividual = m_xSaveIndividualRB->get_active();
 
-    m_pGenerateFromDataBaseCB->Enable( bIndividual );
+    m_xGenerateFromDataBaseCB->set_sensitive( bIndividual );
     if( bIndividual ) {
-        FilenameHdl( m_pGenerateFromDataBaseCB );
+        FilenameHdl(*m_xGenerateFromDataBaseCB);
     } else {
-        m_pColumnFT->Enable(false);
-        m_pColumnLB->Enable(false);
-        m_pPathFT->Enable( false );
-        m_pPathED->Enable( false );
-        m_pPathPB->Enable( false );
-        m_pFilterFT->Enable( false );
-        m_pFilterLB->Enable( false );
+        m_xColumnFT->set_sensitive(false);
+        m_xColumnLB->set_sensitive(false);
+        m_xPathFT->set_sensitive( false );
+        m_xPathED->set_sensitive( false );
+        m_xPathPB->set_sensitive( false );
+        m_xFilterFT->set_sensitive( false );
+        m_xFilterLB->set_sensitive( false );
     }
 }
 
-IMPL_LINK( SwMailMergeDlg, FilenameHdl, Button*, pBox, void )
+IMPL_LINK( SwMailMergeDlg, FilenameHdl, weld::ToggleButton&, rBox, void )
 {
-    bool bEnable = static_cast<CheckBox*>(pBox)->IsChecked();
-    m_pColumnFT->Enable( bEnable );
-    m_pColumnLB->Enable(bEnable);
-    m_pPathFT->Enable( bEnable );
-    m_pPathED->Enable(bEnable);
-    m_pPathPB->Enable( bEnable );
-    m_pFilterFT->Enable( bEnable );
-    m_pFilterLB->Enable( bEnable );
+    bool bEnable = rBox.get_active();
+    m_xColumnFT->set_sensitive( bEnable );
+    m_xColumnLB->set_sensitive(bEnable);
+    m_xPathFT->set_sensitive( bEnable );
+    m_xPathED->set_sensitive(bEnable);
+    m_xPathPB->set_sensitive( bEnable );
+    m_xFilterFT->set_sensitive( bEnable );
+    m_xFilterLB->set_sensitive( bEnable );
 }
 
-IMPL_LINK_NOARG(SwMailMergeDlg, ModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(SwMailMergeDlg, ModifyHdl, weld::SpinButton&, void)
 {
-    m_pFromRB->Check();
+    m_xFromRB->set_active(true);
 }
 
 bool SwMailMergeDlg::AskUserFilename() const
 {
-    return (m_pSaveSingleDocRB->IsChecked() || !m_pGenerateFromDataBaseCB->IsChecked());
+    return (m_xSaveSingleDocRB->get_active() || !m_xGenerateFromDataBaseCB->get_active());
 }
 
 OUString SwMailMergeDlg::GetURLfromPath() const
@@ -487,7 +419,7 @@ OUString SwMailMergeDlg::GetURLfromPath() const
         aAbs.SetURL( aPathOpt.GetWorkPath() );
     }
     return URIHelper::SmartRel2Abs(
-        aAbs, m_pPathED->GetText(), URIHelper::GetMaybeFileHdl());
+        aAbs, m_xPathED->get_text(), URIHelper::GetMaybeFileHdl());
 }
 
 bool SwMailMergeDlg::ExecQryShell()
@@ -496,34 +428,34 @@ bool SwMailMergeDlg::ExecQryShell()
         pImpl->xSelSupp->removeSelectionChangeListener( pImpl->xChgLstnr );
     }
 
-    if (m_pPrinterRB->IsChecked())
+    if (m_xPrinterRB->get_active())
         nMergeType = DBMGR_MERGE_PRINTER;
     else {
         nMergeType = DBMGR_MERGE_FILE;
         pModOpt->SetMailingPath( GetURLfromPath() );
-        pModOpt->SetIsNameFromColumn(m_pGenerateFromDataBaseCB->IsChecked());
+        pModOpt->SetIsNameFromColumn(m_xGenerateFromDataBaseCB->get_active());
 
         if (!AskUserFilename()) {
-            pModOpt->SetNameFromColumn(m_pColumnLB->GetSelectedEntry());
-            if( m_pFilterLB->GetSelectedEntryPos() != LISTBOX_ENTRY_NOTFOUND)
-                m_sSaveFilter = *static_cast<const OUString*>(m_pFilterLB->GetSelectedEntryData());
+            pModOpt->SetNameFromColumn(m_xColumnLB->get_active_text());
+            if (m_xFilterLB->get_active() != -1)
+                m_sSaveFilter = m_xFilterLB->get_active_id();
             m_sFilename = OUString();
         } else {
             //#i97667# reset column name - otherwise it's remembered from the last run
             pModOpt->SetNameFromColumn(OUString());
             //start save as dialog
             OUString sFilter;
-            m_sFilename = SwMailMergeHelper::CallSaveAsDialog(GetFrameWeld(), sFilter);
+            m_sFilename = SwMailMergeHelper::CallSaveAsDialog(m_xDialog.get(), sFilter);
             if (m_sFilename.isEmpty())
                 return false;
             m_sSaveFilter = sFilter;
         }
     }
 
-    if (m_pFromRB->IsChecked()) {  // Insert list
+    if (m_xFromRB->get_active()) {  // Insert list
         // Safe: the maximal value of the fields is limited
-        sal_Int32 nStart = sal::static_int_cast<sal_Int32>(m_pFromNF->GetValue());
-        sal_Int32 nEnd = sal::static_int_cast<sal_Int32>(m_pToNF->GetValue());
+        sal_Int32 nStart = m_xFromNF->get_value();
+        sal_Int32 nEnd = m_xToNF->get_value();
 
         if (nEnd < nStart)
             std::swap(nEnd, nStart);
@@ -532,7 +464,7 @@ bool SwMailMergeDlg::ExecQryShell()
         Any* pSelection = m_aSelection.getArray();
         for (sal_Int32 i = nStart; i <= nEnd; ++i, ++pSelection)
             *pSelection <<= i;
-    } else if (m_pAllRB->IsChecked() )
+    } else if (m_xAllRB->get_active() )
         m_aSelection.realloc(0);    // Empty selection = insert all
     else {
         if(pImpl->xSelSupp.is()) {
@@ -550,18 +482,18 @@ bool SwMailMergeDlg::ExecQryShell()
     }
     IDocumentDeviceAccess& rIDDA = rSh.getIDocumentDeviceAccess();
     SwPrintData aPrtData( rIDDA.getPrintData() );
-    aPrtData.SetPrintSingleJobs(m_pSingleJobsCB->IsChecked());
+    aPrtData.SetPrintSingleJobs(m_xSingleJobsCB->get_active());
     rIDDA.setPrintData(aPrtData);
 
-    pModOpt->SetSinglePrintJob(m_pSingleJobsCB->IsChecked());
+    pModOpt->SetSinglePrintJob(m_xSingleJobsCB->get_active());
 
     MailTextFormats nMailingMode = MailTextFormats::NONE;
 
-    if (m_pFormatSwCB->IsChecked())
+    if (m_xFormatSwCB->get_active())
         nMailingMode |= MailTextFormats::OFFICE;
-    if (m_pFormatHtmlCB->IsChecked())
+    if (m_xFormatHtmlCB->get_active())
         nMailingMode |= MailTextFormats::HTML;
-    if (m_pFormatRtfCB->IsChecked())
+    if (m_xFormatRtfCB->get_active())
         nMailingMode |= MailTextFormats::RTF;
     pModOpt->SetMailingFormats(nMailingMode);
     return true;
@@ -581,7 +513,7 @@ OUString SwMailMergeDlg::GetTargetURL() const
     return sPath;
 }
 
-IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl, Button*, void)
+IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl, weld::Button&, void)
 {
     uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
     uno::Reference < XFolderPicker2 > xFP = FolderPicker::create(xContext);
@@ -589,9 +521,9 @@ IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl, Button*, void)
     if( xFP->execute() == RET_OK ) {
         INetURLObject aURL(xFP->getDirectory());
         if(aURL.GetProtocol() == INetProtocol::File)
-            m_pPathED->SetText(aURL.PathToFileName());
+            m_xPathED->set_text(aURL.PathToFileName());
         else
-            m_pPathED->SetText(aURL.GetFull());
+            m_xPathED->set_text(aURL.GetFull());
     }
 }
 
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index cb1fff7214ee..b79aeb6e7c0d 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -749,24 +749,6 @@ bool SwDBManager::GetTableNames(weld::ComboBox& rBox, const OUString& rDBName)
 }
 
 // fill Listbox with column names of a database
-void SwDBManager::GetColumnNames(ListBox* pListBox,
-                             const OUString& rDBName, const OUString& rTableName)
-{
-    SwDBData aData;
-    aData.sDataSource = rDBName;
-    aData.sCommand = rTableName;
-    aData.nCommandType = -1;
-    SwDSParam* pParam = FindDSData(aData, false);
-    uno::Reference< sdbc::XConnection> xConnection;
-    if(pParam && pParam->xConnection.is())
-        xConnection = pParam->xConnection;
-    else
-    {
-        xConnection = RegisterConnection( rDBName );
-    }
-    GetColumnNames(pListBox, xConnection, rTableName);
-}
-
 void SwDBManager::GetColumnNames(weld::ComboBox& rBox,
                              const OUString& rDBName, const OUString& rTableName)
 {
@@ -785,24 +767,6 @@ void SwDBManager::GetColumnNames(weld::ComboBox& rBox,
     GetColumnNames(rBox, xConnection, rTableName);
 }
 
-void SwDBManager::GetColumnNames(ListBox* pListBox,
-        uno::Reference< sdbc::XConnection> const & xConnection,
-        const OUString& rTableName)
-{
-    pListBox->Clear();
-    uno::Reference< sdbcx::XColumnsSupplier> xColsSupp = SwDBManager::GetColumnSupplier(xConnection, rTableName);
-    if(xColsSupp.is())
-    {
-        uno::Reference<container::XNameAccess> xCols = xColsSupp->getColumns();
-        const uno::Sequence<OUString> aColNames = xCols->getElementNames();
-        for (const OUString& rColName : aColNames)
-        {
-            pListBox->InsertEntry(rColName);
-        }
-        ::comphelper::disposeComponent( xColsSupp );
-    }
-}
-
 void SwDBManager::GetColumnNames(weld::ComboBox& rBox,
         uno::Reference< sdbc::XConnection> const & xConnection,
         const OUString& rTableName)
@@ -3046,7 +3010,7 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh,
         pFound = FindDSConnection(sDataSource, true);
     }
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-    m_pImpl->pMergeDialog = pFact->CreateMailMergeDlg( &rSh.GetView().GetViewFrame()->GetWindow(), rSh,
+    m_pImpl->pMergeDialog = pFact->CreateMailMergeDlg(rSh.GetView().GetViewFrame()->GetWindow().GetFrameWeld(), rSh,
                                                      sDataSource,
                                                      sDataTableOrQuery,
                                                      nCmdType,
diff --git a/sw/source/uibase/inc/mailmrge.hxx b/sw/source/uibase/inc/mailmrge.hxx
index 0452a9af13e9..a70318ee25b7 100644
--- a/sw/source/uibase/inc/mailmrge.hxx
+++ b/sw/source/uibase/inc/mailmrge.hxx
@@ -49,51 +49,10 @@ namespace com{namespace sun{namespace star{
     }
 }}}
 
-class SwMailMergeDlg : public SfxModalDialog
+class SwMailMergeDlg : public SfxDialogController
 {
     friend class SwXSelChgLstnr_Impl;
 
-    VclPtr<vcl::Window>     m_pBeamerWin;
-
-    VclPtr<RadioButton>     m_pAllRB;
-    VclPtr<RadioButton>     m_pMarkedRB;
-    VclPtr<RadioButton>     m_pFromRB;
-    VclPtr<NumericField>    m_pFromNF;
-    VclPtr<NumericField>    m_pToNF;
-
-    VclPtr<RadioButton>     m_pPrinterRB;
-    VclPtr<RadioButton>     m_pMailingRB;
-    VclPtr<RadioButton>     m_pFileRB;
-
-    VclPtr<CheckBox>        m_pSingleJobsCB;
-
-    VclPtr<FixedText>       m_pSaveMergedDocumentFT;
-    VclPtr<RadioButton>     m_pSaveSingleDocRB;
-    VclPtr<RadioButton>     m_pSaveIndividualRB;
-
-    VclPtr<CheckBox>        m_pGenerateFromDataBaseCB;
-
-    VclPtr<FixedText>       m_pColumnFT;
-    VclPtr<ListBox>         m_pColumnLB;
-    VclPtr<FixedText>       m_pPathFT;
-    VclPtr<Edit>            m_pPathED;
-    VclPtr<PushButton>      m_pPathPB;
-    VclPtr<FixedText>       m_pFilterFT;
-    VclPtr<ListBox>         m_pFilterLB;
-
-    VclPtr<ListBox>         m_pAddressFieldLB;
-    VclPtr<FixedText>       m_pSubjectFT;
-    VclPtr<Edit>            m_pSubjectED;
-    VclPtr<FixedText>       m_pFormatFT;
-    VclPtr<FixedText>       m_pAttachFT;
-    VclPtr<Edit>            m_pAttachED;
-    VclPtr<PushButton>      m_pAttachPB;
-    VclPtr<CheckBox>        m_pFormatHtmlCB;
-    VclPtr<CheckBox>        m_pFormatRtfCB;
-    VclPtr<CheckBox>        m_pFormatSwCB;
-
-    VclPtr<OKButton>        m_pOkBTN;
-
     std::unique_ptr<SwMailMergeDlg_Impl> pImpl;
 
     SwWrtShell&     rSh;
@@ -106,32 +65,72 @@ class SwMailMergeDlg : public SfxModalDialog
     OUString m_sSaveFilter;
     OUString m_sFilename;
 
-    DECL_LINK( ButtonHdl, Button*, void );
-    DECL_LINK( InsertPathHdl, Button*, void );
-    DECL_LINK( OutputTypeHdl, Button*, void );
-    DECL_LINK( FilenameHdl, Button*, void );
-    DECL_LINK( ModifyHdl, Edit&, void );
-    DECL_LINK( SaveTypeHdl, Button*, void );
+    std::unique_ptr<weld::Container> m_xBeamerWin;
+
+    std::unique_ptr<weld::RadioButton> m_xAllRB;
+    std::unique_ptr<weld::RadioButton> m_xMarkedRB;
+    std::unique_ptr<weld::RadioButton> m_xFromRB;
+    std::unique_ptr<weld::SpinButton> m_xFromNF;
+    std::unique_ptr<weld::SpinButton> m_xToNF;
+
+    std::unique_ptr<weld::RadioButton> m_xPrinterRB;
+    std::unique_ptr<weld::RadioButton> m_xMailingRB;
+    std::unique_ptr<weld::RadioButton> m_xFileRB;
+
+    std::unique_ptr<weld::CheckButton> m_xSingleJobsCB;
+
+    std::unique_ptr<weld::Label> m_xSaveMergedDocumentFT;
+    std::unique_ptr<weld::RadioButton> m_xSaveSingleDocRB;
+    std::unique_ptr<weld::RadioButton> m_xSaveIndividualRB;
+
+    std::unique_ptr<weld::CheckButton> m_xGenerateFromDataBaseCB;
+
+    std::unique_ptr<weld::Label> m_xColumnFT;
+    std::unique_ptr<weld::ComboBox> m_xColumnLB;
+    std::unique_ptr<weld::Label> m_xPathFT;
+    std::unique_ptr<weld::Entry> m_xPathED;
+    std::unique_ptr<weld::Button> m_xPathPB;
+    std::unique_ptr<weld::Label> m_xFilterFT;
+    std::unique_ptr<weld::ComboBox> m_xFilterLB;
+
+    std::unique_ptr<weld::ComboBox> m_xAddressFieldLB;
+    std::unique_ptr<weld::Label> m_xSubjectFT;
+    std::unique_ptr<weld::Entry> m_xSubjectED;
+    std::unique_ptr<weld::Label> m_xFormatFT;
+    std::unique_ptr<weld::Label> m_xAttachFT;
+    std::unique_ptr<weld::Entry> m_xAttachED;
+    std::unique_ptr<weld::Button> m_xAttachPB;
+    std::unique_ptr<weld::CheckButton> m_xFormatHtmlCB;
+    std::unique_ptr<weld::CheckButton> m_xFormatRtfCB;
+    std::unique_ptr<weld::CheckButton> m_xFormatSwCB;
+
+    std::unique_ptr<weld::Button> m_xOkBTN;
+
+    DECL_LINK( ButtonHdl, weld::Button&, void );
+    DECL_LINK( InsertPathHdl, weld::Button&, void );
+    DECL_LINK( OutputTypeHdl, weld::ToggleButton&, void );
+    DECL_LINK( FilenameHdl, weld::ToggleButton&, void );
+    DECL_LINK( ModifyHdl, weld::SpinButton&, void );
+    DECL_LINK( SaveTypeHdl, weld::ToggleButton&, void );
 
     bool            ExecQryShell();
     bool            AskUserFilename() const;
     OUString        GetURLfromPath() const;
 
 public:
-    SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rSh,
+    SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rSh,
         const OUString& rSourceName,
         const OUString& rTableName,
         sal_Int32 nCommandType,
         const css::uno::Reference< css::sdbc::XConnection>& xConnection,
         css::uno::Sequence< css::uno::Any > const * pSelection);
     virtual ~SwMailMergeDlg() override;
-    virtual void dispose() override;
 
     DBManagerOptions GetMergeType() { return nMergeType; }
 
-    bool IsSaveSingleDoc() const { return m_pSaveSingleDocRB->IsChecked(); }
-    bool IsGenerateFromDataBase() const { return m_pGenerateFromDataBaseCB->IsChecked(); }
-    OUString GetColumnName() const { return m_pColumnLB->GetSelectedEntry(); }
+    bool IsSaveSingleDoc() const { return m_xSaveSingleDocRB->get_active(); }
+    bool IsGenerateFromDataBase() const { return m_xGenerateFromDataBaseCB->get_active(); }
+    OUString GetColumnName() const { return m_xColumnLB->get_active_text(); }
     OUString GetTargetURL() const;
 
     const OUString& GetSaveFilter() const {return m_sSaveFilter;}
diff --git a/sw/uiconfig/swriter/ui/mailmerge.ui b/sw/uiconfig/swriter/ui/mailmerge.ui
index 623976f6d6e2..aa97299752ab 100644
--- a/sw/uiconfig/swriter/ui/mailmerge.ui
+++ b/sw/uiconfig/swriter/ui/mailmerge.ui
@@ -14,6 +14,9 @@
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
     <property name="title" translatable="yes" context="mailmerge|MailmergeDialog">Mail Merge</property>
+    <property name="modal">True</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
     <child>
       <placeholder/>
@@ -22,7 +25,7 @@
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
+        <property name="spacing">12</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
@@ -89,7 +92,7 @@
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
-              <object class="GtkDrawingArea" id="beamer">
+              <object class="GtkBox" id="beamer">
                 <property name="height_request">150</property>
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
diff --git a/sw/uiconfig/swriter/ui/tablepreviewdialog.ui b/sw/uiconfig/swriter/ui/tablepreviewdialog.ui
index a655d1b5e714..2b07864a06af 100644
--- a/sw/uiconfig/swriter/ui/tablepreviewdialog.ui
+++ b/sw/uiconfig/swriter/ui/tablepreviewdialog.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="GtkDialog" id="TablePreviewDialog">
@@ -7,12 +7,18 @@
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="tablepreviewdialog|TablePreviewDialog">Mail Merge Recipients</property>
     <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
+        <property name="spacing">12</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
@@ -43,29 +49,61 @@
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="description">
+          <object class="GtkBox">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="halign">start</property>
-            <property name="label" translatable="yes" context="tablepreviewdialog|description">The list below shows the contents of: %1</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkDrawingArea" id="beamer">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <property name="vexpand">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="description">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="label" translatable="yes" context="tablepreviewdialog|description">The list below shows the contents of: %1</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="hscrollbar_policy">never</property>
+                <property name="vscrollbar_policy">never</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkViewport">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <child>
+                      <object class="GtkBox" id="beamer">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">2</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>


More information about the Libreoffice-commits mailing list