[Libreoffice-commits] core.git: include/sfx2 include/vcl sfx2/source sw/inc sw/source sw/uiconfig

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 22 13:21:33 UTC 2019


 include/sfx2/tabdlg.hxx                          |    2 
 include/vcl/abstdlg.hxx                          |    2 
 sfx2/source/dialog/tabdlg.cxx                    |   29 ++++
 sw/inc/swabstdlg.hxx                             |   11 -
 sw/source/ui/dialog/swdlgfact.cxx                |   49 ++++---
 sw/source/ui/dialog/swdlgfact.hxx                |   20 ++-
 sw/source/ui/fldui/DropDownFieldDialog.cxx       |    2 
 sw/source/ui/fldui/DropDownFormFieldDialog.cxx   |    2 
 sw/source/ui/fldui/fldpage.cxx                   |   10 -
 sw/source/ui/fldui/fldref.cxx                    |    2 
 sw/source/ui/fldui/fldtdlg.cxx                   |  149 ++++++++---------------
 sw/source/ui/fldui/inpdlg.cxx                    |    2 
 sw/source/uibase/fldui/fldmgr.cxx                |    2 
 sw/source/uibase/fldui/fldwrap.cxx               |   15 +-
 sw/source/uibase/inc/DropDownFieldDialog.hxx     |    2 
 sw/source/uibase/inc/DropDownFormFieldDialog.hxx |    2 
 sw/source/uibase/inc/fldmgr.hxx                  |    4 
 sw/source/uibase/inc/fldtdlg.hxx                 |   32 ++--
 sw/source/uibase/inc/fldwrap.hxx                 |    8 -
 sw/source/uibase/inc/inpdlg.hxx                  |    2 
 sw/source/uibase/inc/wrtsh.hxx                   |    4 
 sw/source/uibase/shells/textfld.cxx              |   18 +-
 sw/source/uibase/wrtsh/wrtsh2.cxx                |    4 
 sw/uiconfig/swriter/ui/fielddialog.ui            |   40 +++---
 sw/uiconfig/swriter/ui/flddbpage.ui              |    5 
 sw/uiconfig/swriter/ui/flddocumentpage.ui        |    6 
 26 files changed, 217 insertions(+), 207 deletions(-)

New commits:
commit fbd79c6125fd302dde9af2d76171dd5ca794af4d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Mar 20 11:56:03 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Mar 22 14:21:02 2019 +0100

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

diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index e2395fd4fe1f..3b858cf4a7f5 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -223,6 +223,7 @@ private:
 protected:
     virtual short               Ok();
     virtual void                RefreshInputSet();
+    virtual SfxItemSet*         CreateInputItemSet(const OString& rName);
     virtual void                PageCreated(const OString &rName, SfxTabPage &rPage);
 
     std::unique_ptr<SfxItemSet> m_xExampleSet;
@@ -261,6 +262,7 @@ public:
     void                RemoveTabPage( const OString& rName ); // Name of the label for the page in the notebook .ui
 
     void                SetCurPageId(const OString& rName);
+    void                ShowPage(const OString& rName);  // SetCurPageId + call Activate on it
     OString             GetCurPageId() const;
     SfxTabPage*         GetCurTabPage() const { return GetTabPage(GetCurPageId()); }
 
diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx
index 71369c92057b..4e9f72d218a3 100644
--- a/include/vcl/abstdlg.hxx
+++ b/include/vcl/abstdlg.hxx
@@ -62,7 +62,7 @@ public:
         // for the case where the dialog is welded, and is running async without a DialogController
         std::shared_ptr<weld::Dialog> mxOwnerSelf;
         std::function<void(sal_Int32)> maEndDialogFn;
-        bool isSet() { return !!maEndDialogFn; }
+        bool isSet() const { return !!maEndDialogFn; }
     };
 
     bool StartExecuteAsync(const std::function<void(sal_Int32)> &rEndDialogFn)
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 3ccc31662287..4fcc3cc25653 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -1938,6 +1938,17 @@ void SfxTabDialogController::AddTabPage(const OString &rName, const OUString& rR
     AddTabPage(rName, nPageCreateId);
 }
 
+/*  [Description]
+
+    Default implementation of the virtual Method.
+    This is called when pages create their sets onDemand.
+*/
+SfxItemSet* SfxTabDialogController::CreateInputItemSet(const OString&)
+{
+    SAL_WARN( "sfx.dialog", "CreateInputItemSet not implemented" );
+    return new SfxAllItemSet(SfxGetpApp()->GetPool());
+}
+
 void SfxTabDialogController::CreatePages()
 {
     for (auto pDataObject : m_pImpl->aData)
@@ -1946,9 +1957,13 @@ void SfxTabDialogController::CreatePages()
            continue;
         weld::Container* pPage = m_xTabCtrl->get_page(pDataObject->sId);
         // TODO eventually pass DialogController as distinct argument instead of bundling into TabPageParent
-        pDataObject->pTabPage = (pDataObject->fnCreatePage)(TabPageParent(pPage, this), m_pSet.get());
-        pDataObject->pTabPage->SetDialogController(this);
 
+        TabPageParent aParent(pPage, this);
+        if (m_pSet)
+            pDataObject->pTabPage = (pDataObject->fnCreatePage)(aParent, m_pSet.get());
+        else
+            pDataObject->pTabPage = (pDataObject->fnCreatePage)(aParent, CreateInputItemSet(pDataObject->sId));
+        pDataObject->pTabPage->SetDialogController(this);
         OUString sConfigId = OStringToOUString(pDataObject->pTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8);
         SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId);
         OUString sUserData;
@@ -2058,6 +2073,16 @@ void SfxTabDialogController::SetCurPageId(const OString& rIdent)
     m_xTabCtrl->set_current_page(m_sAppPageId);
 }
 
+/*  [Description]
+
+    The TabPage is activated with the specified Id.
+*/
+void SfxTabDialogController::ShowPage(const OString& rIdent)
+{
+    SetCurPageId(rIdent);
+    ActivatePageHdl(rIdent);
+}
+
 OString SfxTabDialogController::GetCurPageId() const
 {
     return m_xTabCtrl->get_current_page_ident();
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index e6f3a5e714e3..647c5c903925 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -305,12 +305,11 @@ class AbstractSwFieldDlg : public SfxAbstractTabDialog
 protected:
     virtual ~AbstractSwFieldDlg() override = default;
 public:
-    virtual void                Start() = 0;  //this method from sfxtabdialog
     virtual void                Initialize(SfxChildWinInfo *pInfo) = 0;
     virtual void                ReInitDlg() = 0;
     virtual void                ActivateDatabasePage() = 0;
     virtual void                ShowReferencePage() = 0;
-    virtual vcl::Window *            GetWindow() = 0; //this method is added for return a Window type pointer
+    virtual std::shared_ptr<SfxDialogController> GetController() = 0;
 };
 
 class AbstractSwRenameXNamedDlg : public VclAbstractDialog
@@ -388,9 +387,9 @@ public:
         const SwDBData& rData) = 0;
     virtual VclPtr<SfxAbstractTabDialog> CreateSwFootNoteOptionDlg(weld::Window *pParent, SwWrtShell &rSh) = 0;
 
-    virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Window* pParent, SwWrtShell &rSh,
+    virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Widget* pParent, SwWrtShell &rSh,
         SwField* pField, bool bPrevButton, bool bNextButton) = 0;
-    virtual VclPtr<VclAbstractDialog> CreateDropDownFormFieldDialog(weld::Window* pParent, sw::mark::IFieldmark* pDropDownField) = 0;
+    virtual VclPtr<VclAbstractDialog> CreateDropDownFormFieldDialog(weld::Widget* pParent, sw::mark::IFieldmark* pDropDownField) = 0;
     virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) = 0;
 
     virtual VclPtr<AbstractSwLabDlg> CreateSwLabDlg(weld::Window* pParent, const SfxItemSet& rSet,
@@ -423,7 +422,7 @@ public:
     virtual VclPtr<SfxAbstractTabDialog> CreateSwTableTabDlg(weld::Window* pParent,
         const SfxItemSet* pItemSet, SwWrtShell* pSh) = 0;
 
-    virtual VclPtr<AbstractSwFieldDlg> CreateSwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, vcl::Window *pParent) = 0;
+    virtual VclPtr<AbstractSwFieldDlg> CreateSwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, weld::Window *pParent) = 0;
     virtual VclPtr<SfxAbstractDialog>   CreateSwFieldEditDlg ( SwView& rVw ) = 0;
     virtual VclPtr<AbstractSwRenameXNamedDlg> CreateSwRenameXNamedDlg(weld::Window* pParent,
         css::uno::Reference< css::container::XNamed > & xNamed,
@@ -448,7 +447,7 @@ public:
     virtual VclPtr<AbstractGlossaryDlg>        CreateGlossaryDlg(SfxViewFrame* pViewFrame,
                                                 SwGlossaryHdl* pGlosHdl,
                                                 SwWrtShell *pWrtShell) = 0;
-    virtual VclPtr<AbstractFieldInputDlg>        CreateFieldInputDlg(weld::Window *pParent,
+    virtual VclPtr<AbstractFieldInputDlg>        CreateFieldInputDlg(weld::Widget *pParent,
         SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) = 0;
     virtual VclPtr<AbstractInsFootNoteDlg>     CreateInsFootNoteDlg(weld::Window * pParent,
         SwWrtShell &rSh, bool bEd = false) = 0;
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index fb764f190916..7d36a5e527e1 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -196,7 +196,10 @@ short AbstractSwAutoFormatDlg_Impl::Execute()
     return m_xDlg->run();
 }
 
-IMPL_ABSTDLG_BASE(AbstractSwFieldDlg_Impl);
+short AbstractSwFieldDlg_Impl::Execute()
+{
+    return m_xDlg->run();
+}
 
 short AbstractSwRenameXNamedDlg_Impl::Execute()
 {
@@ -441,57 +444,62 @@ SwTableAutoFormat* AbstractSwAutoFormatDlg_Impl::FillAutoFormatOfIndex() const
 
 void AbstractSwFieldDlg_Impl::SetCurPageId( const OString &rName )
 {
-    pDlg->SetCurPageId( rName );
+    m_xDlg->SetCurPageId( rName );
 }
 
 const SfxItemSet* AbstractSwFieldDlg_Impl::GetOutputItemSet() const
 {
-    return pDlg->GetOutputItemSet();
+    return m_xDlg->GetOutputItemSet();
 }
 
 const sal_uInt16* AbstractSwFieldDlg_Impl::GetInputRanges(const SfxItemPool& pItem )
 {
-    return pDlg->GetInputRanges( pItem );
+    return m_xDlg->GetInputRanges( pItem );
 }
 
 void AbstractSwFieldDlg_Impl::SetInputSet( const SfxItemSet* pInSet )
 {
-     pDlg->SetInputSet( pInSet );
+     m_xDlg->SetInputSet( pInSet );
 }
 
 void AbstractSwFieldDlg_Impl::SetText( const OUString& rStr )
 {
-    pDlg->SetText( rStr );
+    m_xDlg->set_title(rStr);
 }
 
-void AbstractSwFieldDlg_Impl::Start()
+bool AbstractSwFieldDlg_Impl::StartExecuteAsync(AsyncContext &rCtx)
 {
-    pDlg->Start();
+    auto xDlg = m_xDlg;
+    return SfxTabDialogController::runAsync(m_xDlg, [=](sal_Int32 nResult){
+        xDlg->Close();
+        if (rCtx.isSet())
+            rCtx.maEndDialogFn(nResult);
+    });
 }
 
 void AbstractSwFieldDlg_Impl::Initialize(SfxChildWinInfo *pInfo)
 {
-    pDlg->Initialize( pInfo );
+    m_xDlg->Initialize( pInfo );
 }
 
 void AbstractSwFieldDlg_Impl::ReInitDlg()
 {
-    pDlg->ReInitDlg();
+    m_xDlg->ReInitDlg();
 }
 
 void AbstractSwFieldDlg_Impl::ActivateDatabasePage()
 {
-    pDlg->ActivateDatabasePage();
+    m_xDlg->ActivateDatabasePage();
 }
 
-vcl::Window* AbstractSwFieldDlg_Impl::GetWindow()
+void AbstractSwFieldDlg_Impl::ShowReferencePage()
 {
-    return static_cast<vcl::Window*>(pDlg);
+    m_xDlg->ShowReferencePage();
 }
 
-void AbstractSwFieldDlg_Impl::ShowReferencePage()
+std::shared_ptr<SfxDialogController> AbstractSwFieldDlg_Impl::GetController()
 {
-    pDlg->ShowReferencePage();
+    return m_xDlg;
 }
 
 void AbstractSwRenameXNamedDlg_Impl::SetForbiddenChars( const OUString& rSet )
@@ -835,13 +843,13 @@ VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwFootNoteOptio
     return VclPtr<AbstractTabController_Impl>::Create(std::make_unique<SwFootNoteOptionDlg>(pParent, rSh));
 }
 
-VclPtr<AbstractDropDownFieldDialog> SwAbstractDialogFactory_Impl::CreateDropDownFieldDialog(weld::Window *pParent,
+VclPtr<AbstractDropDownFieldDialog> SwAbstractDialogFactory_Impl::CreateDropDownFieldDialog(weld::Widget *pParent,
     SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton)
 {
     return VclPtr<AbstractDropDownFieldDialog_Impl>::Create(std::make_unique<sw::DropDownFieldDialog>(pParent, rSh, pField, bPrevButton, bNextButton));
 }
 
-VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateDropDownFormFieldDialog(weld::Window *pParent, sw::mark::IFieldmark* pDropDownField)
+VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateDropDownFormFieldDialog(weld::Widget *pParent, sw::mark::IFieldmark* pDropDownField)
 {
     return VclPtr<AbstractDropDownFormFieldDialog_Impl>::Create(std::make_unique<sw::DropDownFormFieldDialog>(pParent, pDropDownField));
 }
@@ -931,10 +939,9 @@ VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwTableTabDlg(w
     return VclPtr<AbstractTabController_Impl>::Create(std::make_unique<SwTableTabDlg>(pParent, pItemSet, pSh));
 }
 
-VclPtr<AbstractSwFieldDlg> SwAbstractDialogFactory_Impl::CreateSwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, vcl::Window *pParent)
+VclPtr<AbstractSwFieldDlg> SwAbstractDialogFactory_Impl::CreateSwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, weld::Window *pParent)
 {
-    VclPtr<SwFieldDlg> pDlg = VclPtr<SwFieldDlg>::Create(pB, pCW, pParent);
-    return VclPtr<AbstractSwFieldDlg_Impl>::Create(pDlg);
+    return VclPtr<AbstractSwFieldDlg_Impl>::Create(std::make_unique<SwFieldDlg>(pB, pCW, pParent));
 }
 
 VclPtr<SfxAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwFieldEditDlg(SwView& rVw)
@@ -988,7 +995,7 @@ VclPtr<AbstractGlossaryDlg> SwAbstractDialogFactory_Impl::CreateGlossaryDlg(SfxV
     return VclPtr<AbstractGlossaryDlg_Impl>::Create( pDlg );
 }
 
-VclPtr<AbstractFieldInputDlg> SwAbstractDialogFactory_Impl::CreateFieldInputDlg(weld::Window *pParent,
+VclPtr<AbstractFieldInputDlg> SwAbstractDialogFactory_Impl::CreateFieldInputDlg(weld::Widget *pParent,
     SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton)
 {
     return VclPtr<AbstractFieldInputDlg_Impl>::Create(std::make_unique<SwFieldInputDlg>(pParent, rSh, pField, bPrevButton, bNextButton));
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index d17ccab6a473..dfb5925b7a5e 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -349,19 +349,25 @@ public:
 
 class AbstractSwFieldDlg_Impl : public AbstractSwFieldDlg
 {
-    DECL_ABSTDLG_BASE(AbstractSwFieldDlg_Impl,SwFieldDlg )
+    std::shared_ptr<SwFieldDlg> m_xDlg;
+public:
+    explicit AbstractSwFieldDlg_Impl(std::unique_ptr<SwFieldDlg> p)
+        : m_xDlg(std::move(p))
+    {
+    }
+    virtual short Execute() override;
+    virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
     virtual void                SetCurPageId( const OString &rName ) override;
     virtual const SfxItemSet*   GetOutputItemSet() const override;
     virtual const sal_uInt16*   GetInputRanges( const SfxItemPool& pItem ) override;
     virtual void                SetInputSet( const SfxItemSet* pInSet ) override;
         //From class Window.
     virtual void                SetText( const OUString& rStr ) override;
-    virtual void                Start() override;  //this method from SfxTabDialog
     virtual void                ShowReferencePage() override;
     virtual void                Initialize(SfxChildWinInfo *pInfo) override;
     virtual void                ReInitDlg() override;
     virtual void                ActivateDatabasePage() override;
-    virtual vcl::Window *            GetWindow() override; //this method is added for return a Window type pointer
+    virtual std::shared_ptr<SfxDialogController> GetController() override;
 };
 
 class AbstractSwRenameXNamedDlg_Impl : public AbstractSwRenameXNamedDlg
@@ -611,9 +617,9 @@ public:
         const SwDBData& rData) override;
     virtual VclPtr<SfxAbstractTabDialog> CreateSwFootNoteOptionDlg(weld::Window *pParent, SwWrtShell &rSh) override;
 
-    virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Window* pParent, SwWrtShell &rSh,
+    virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Widget* pParent, SwWrtShell &rSh,
         SwField* pField, bool bPrevButton, bool bNextButton) override;
-    virtual VclPtr<VclAbstractDialog> CreateDropDownFormFieldDialog(weld::Window* pParent, sw::mark::IFieldmark* pDropDownField) override;
+    virtual VclPtr<VclAbstractDialog> CreateDropDownFormFieldDialog(weld::Widget* pParent, sw::mark::IFieldmark* pDropDownField) override;
     virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) override;
     virtual VclPtr<AbstractSwLabDlg> CreateSwLabDlg(weld::Window* pParent, const SfxItemSet& rSet,
                                                      SwDBManager* pDBManager, bool bLabel) override;
@@ -641,7 +647,7 @@ public:
     virtual VclPtr<VclAbstractDialog> CreateSwTableWidthDlg(weld::Window *pParent, SwTableFUNC &rFnc) override;
     virtual VclPtr<SfxAbstractTabDialog> CreateSwTableTabDlg(weld::Window* pParent,
         const SfxItemSet* pItemSet, SwWrtShell* pSh) override;
-    virtual VclPtr<AbstractSwFieldDlg> CreateSwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, vcl::Window *pParent) override;
+    virtual VclPtr<AbstractSwFieldDlg> CreateSwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, weld::Window *pParent) override;
     virtual VclPtr<SfxAbstractDialog>   CreateSwFieldEditDlg ( SwView& rVw ) override;
     virtual VclPtr<AbstractSwRenameXNamedDlg> CreateSwRenameXNamedDlg(weld::Window* pParent,
         css::uno::Reference< css::container::XNamed > & xNamed,
@@ -664,7 +670,7 @@ public:
     virtual VclPtr<AbstractGlossaryDlg>        CreateGlossaryDlg(SfxViewFrame* pViewFrame,
                                                 SwGlossaryHdl* pGlosHdl,
                                                 SwWrtShell *pWrtShell) override;
-    virtual VclPtr<AbstractFieldInputDlg>        CreateFieldInputDlg(weld::Window *pParent,
+    virtual VclPtr<AbstractFieldInputDlg>        CreateFieldInputDlg(weld::Widget *pParent,
         SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) override;
     virtual VclPtr<AbstractInsFootNoteDlg>     CreateInsFootNoteDlg(
         weld::Window * pParent, SwWrtShell &rSh, bool bEd = false) override;
diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx
index 387bccc39490..46d6f9d9b041 100644
--- a/sw/source/ui/fldui/DropDownFieldDialog.cxx
+++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx
@@ -28,7 +28,7 @@
 using namespace ::com::sun::star;
 
 // edit insert-field
-sw::DropDownFieldDialog::DropDownFieldDialog(weld::Window *pParent, SwWrtShell &rS,
+sw::DropDownFieldDialog::DropDownFieldDialog(weld::Widget *pParent, SwWrtShell &rS,
                               SwField* pField, bool bPrevButton, bool bNextButton)
     : GenericDialogController(pParent, "modules/swriter/ui/dropdownfielddialog.ui", "DropdownFieldDialog")
     , m_rSh( rS )
diff --git a/sw/source/ui/fldui/DropDownFormFieldDialog.cxx b/sw/source/ui/fldui/DropDownFormFieldDialog.cxx
index 42312bca3693..66dd8302543e 100644
--- a/sw/source/ui/fldui/DropDownFormFieldDialog.cxx
+++ b/sw/source/ui/fldui/DropDownFormFieldDialog.cxx
@@ -14,7 +14,7 @@
 
 namespace sw
 {
-DropDownFormFieldDialog::DropDownFormFieldDialog(weld::Window* pParent,
+DropDownFormFieldDialog::DropDownFormFieldDialog(weld::Widget* pParent,
                                                  mark::IFieldmark* pDropDownField)
     : GenericDialogController(pParent, "modules/swriter/ui/dropdownformfielddialog.ui",
                               "DropDownFormFieldDialog")
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
index 365df5c361a4..3cbd9a6743a7 100644
--- a/sw/source/ui/fldui/fldpage.cxx
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -67,7 +67,7 @@ void SwFieldPage::Init()
     SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current());
     bool bNewMode = 0 != (::GetHtmlMode(pDocSh) & HTMLMODE_ON);
 
-    m_bFieldEdit = nullptr == GetTabDialog();
+    m_bFieldEdit = nullptr == dynamic_cast<SwFieldDlg*>(GetDialogController());
 
     // newly initialise FieldManager. important for
     // Dok-Switch (fldtdlg:ReInitTabPage)
@@ -127,7 +127,7 @@ void SwFieldPage::InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUS
     {
         SwInsertField_Data aData(nTypeId, nSubType, rPar1, rPar2, nFormatId, nullptr, cSeparator, bIsAutomaticLanguage );
         //#i26566# provide parent for SwWrtShell::StartInputFieldDlg
-        aData.m_pParent = &GetTabDialog()->GetOKButton();
+        aData.m_pParent = &GetDialogController()->GetOKButton();
         m_aMgr.InsertField( aData );
 
         uno::Reference< frame::XDispatchRecorder > xRecorder =
@@ -307,8 +307,7 @@ IMPL_LINK( SwFieldPage, TreeViewInsertHdl, weld::TreeView&, rBox, void )
 
 void SwFieldPage::InsertHdl(weld::Widget* pBtn)
 {
-    SwFieldDlg *pDlg = static_cast<SwFieldDlg*>(GetTabDialog());
-    if (pDlg)
+    if (SwFieldDlg *pDlg = dynamic_cast<SwFieldDlg*>(GetDialogController()))
     {
         pDlg->InsertHdl();
 
@@ -325,8 +324,7 @@ void SwFieldPage::InsertHdl(weld::Widget* pBtn)
 // enable/disable "Insert"-Button
 void SwFieldPage::EnableInsert(bool bEnable)
 {
-    SwFieldDlg *pDlg = static_cast<SwFieldDlg*>(GetTabDialog());
-    if (pDlg)
+    if (SwFieldDlg *pDlg = dynamic_cast<SwFieldDlg*>(GetDialogController()))
     {
         if (pDlg->GetCurTabPage() == this)
             pDlg->EnableInsert(bEnable);
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index d9e084f01413..2b5d2eac20ee 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -391,7 +391,7 @@ IMPL_LINK_NOARG(SwFieldRefPage, TypeHdl, weld::TreeView&, void)
         default:
             if( REFFLDFLAG & nTypeId )
             {
-                const sal_uInt16 nOldId = m_xTypeLB->get_id(nOld).toUInt32();
+                const sal_uInt16 nOldId = nOld != -1 ? m_xTypeLB->get_id(nOld).toUInt32() : 0;
                 if( nOldId & REFFLDFLAG || nOldId == TYP_GETREFFLD )
                     // then the old one stays
                     nFieldDlgFormatSel = m_xFormatLB->get_selected_index();
diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
index c031883746e3..cade4bbc0bd1 100644
--- a/sw/source/ui/fldui/fldtdlg.cxx
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -46,33 +46,26 @@
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 
 // carrier of the dialog
-SwFieldDlg::SwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, vcl::Window *pParent)
-    : SfxTabDialog(pParent, "FieldDialog", "modules/swriter/ui/fielddialog.ui")
+SwFieldDlg::SwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, weld::Window *pParent)
+    : SfxTabDialogController(pParent, "modules/swriter/ui/fielddialog.ui", "FieldDialog")
     , m_pChildWin(pCW)
     , m_pBindings(pB)
     , m_bDataBaseMode(false)
-    , m_nDokId(0)
-    , m_nVarId(0)
-    , m_nDokInf(0)
-    , m_nRefId(0)
-    , m_nFuncId(0)
-    , m_nDbId(0)
+    , m_bClosing(false)
 {
-    SetStyle(GetStyle()|WB_STDMODELESS);
     m_bHtmlMode = (::GetHtmlMode(static_cast<SwDocShell*>(SfxObjectShell::Current())) & HTMLMODE_ON) != 0;
 
-    GetCancelButton().SetClickHdl(LINK(this, SwFieldDlg, CancelHdl));
+    GetCancelButton().connect_clicked(LINK(this, SwFieldDlg, CancelHdl));
+    GetOKButton().connect_clicked(LINK(this, SwFieldDlg, OKHdl));
 
-    GetOKButton().SetClickHdl(LINK(this, SwFieldDlg, OKHdl));
-
-    m_nDokId = AddTabPage("document", SwFieldDokPage::Create);
-    m_nVarId = AddTabPage("variables", SwFieldVarPage::Create);
-    m_nDokInf = AddTabPage("docinfo", SwFieldDokInfPage::Create);
+    AddTabPage("document", SwFieldDokPage::Create, nullptr);
+    AddTabPage("variables", SwFieldVarPage::Create, nullptr);
+    AddTabPage("docinfo", SwFieldDokInfPage::Create, nullptr);
 
     if (!m_bHtmlMode)
     {
-        m_nRefId = AddTabPage("ref", SwFieldRefPage::Create);
-        m_nFuncId = AddTabPage("functions", SwFieldFuncPage::Create);
+        AddTabPage("ref", SwFieldRefPage::Create, nullptr);
+        AddTabPage("functions", SwFieldFuncPage::Create, nullptr);
 
         utl::OConfigurationTreeRoot aCfgRoot
             = utl::OConfigurationTreeRoot::createWithComponentContext(
@@ -87,7 +80,7 @@ SwFieldDlg::SwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, vcl::Window *pPa
             OUString("DatabaseFields")) >>= bDatabaseFields;
 
         if (bDatabaseFields)
-            m_nDbId = AddTabPage("database", SwFieldDBPage::Create);
+            AddTabPage("database", SwFieldDBPage::Create, nullptr);
         else
 #endif
             RemoveTabPage("database");
@@ -104,64 +97,34 @@ SwFieldDlg::~SwFieldDlg()
 {
 }
 
-bool SwFieldDlg::Close()
+void SwFieldDlg::EndDialog()
+{
+    m_bClosing = true;
+    SfxTabDialogController::EndDialog();
+    m_bClosing = false;
+}
+
+void SwFieldDlg::Close()
 {
+    if (m_bClosing)
+        return;
     m_pBindings->GetDispatcher()->
         Execute(m_bDataBaseMode ? FN_INSERT_FIELD_DATA_ONLY : FN_INSERT_FIELD,
-        SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
-    return true;
+        SfxCallMode::SYNCHRON|SfxCallMode::RECORD);
 }
 
 void SwFieldDlg::Initialize(SfxChildWinInfo const *pInfo)
 {
-    Point aPos;
-    Size aSize;
-
-    if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 )
-    {
-        aPos = pInfo->aPos;
-        if ( GetStyle() & WB_SIZEABLE )
-            SetSizePixel( pInfo->aSize );
-
-        // remember initial size from pInfo
-        aSize = GetSizePixel();
-
-        // should the FloatingWindow get zoomed?
-        if ( pInfo->nFlags & SfxChildWindowFlags::ZOOMIN )
-            RollUp();
-    }
-    else
-    {
-        // remember initial size from resource or ctor
-        aSize = GetSizePixel();
-
-        Size aParentSize = GetParent()->GetOutputSizePixel();
-        aPos.AdjustX(( aParentSize.Width() - aSize.Width() ) / 2 );
-        aPos.AdjustY(( aParentSize.Height() - aSize.Height() ) / 2 );
-    }
-
-    Point aPoint;
-    tools::Rectangle aRect = GetDesktopRectPixel();
-    aPoint.setX( aRect.Right() - aSize.Width() );
-    aPoint.setY( aRect.Bottom() - aSize.Height() );
-
-    aPoint = OutputToScreenPixel( aPoint );
-
-    if ( aPos.X() > aPoint.X() )
-        aPos.setX( aPoint.X() ) ;
-    if ( aPos.Y() > aPoint.Y() )
-        aPos.setY( aPoint.Y() );
-
-    if ( aPos.X() < 0 ) aPos.setX( 0 );
-    if ( aPos.Y() < 0 ) aPos.setY( 0 );
-
-    SetPosPixel( aPos );
+    OString aWinState = pInfo->aWinState;
+    if (aWinState.isEmpty())
+        return;
+    m_xDialog->set_window_state(aWinState);
 }
 
-SfxItemSet* SwFieldDlg::CreateInputItemSet( sal_uInt16 nID  )
+SfxItemSet* SwFieldDlg::CreateInputItemSet(const OString& rID)
 {
     SwDocShell *const pDocSh(static_cast<SwDocShell*>(SfxObjectShell::Current()));
-    if (nID == m_nDokInf && pDocSh) // might not have a shell if the dialog is restored on startup
+    if (rID == "docinfo" && pDocSh) // might not have a shell if the dialog is restored on startup
     {
         SfxItemSet* pISet = new SfxItemSet( pDocSh->GetPool(), svl::Items<SID_DOCINFO, SID_DOCINFO>{} );
         using namespace ::com::sun::star;
@@ -180,18 +143,18 @@ SfxItemSet* SwFieldDlg::CreateInputItemSet( sal_uInt16 nID  )
 }
 
 // kick off inserting of new fields
-IMPL_LINK_NOARG(SwFieldDlg, OKHdl, Button*, void)
+IMPL_LINK_NOARG(SwFieldDlg, OKHdl, weld::Button&, void)
 {
-    if (GetOKButton().IsEnabled())
+    if (GetOKButton().get_sensitive())
     {
         SfxTabPage* pPage = GetTabPage(GetCurPageId());
         pPage->FillItemSet(nullptr);
 
-        GetOKButton().GrabFocus();  // because of InputField-Dlg
+        GetOKButton().grab_focus();  // because of InputField-Dlg
     }
 }
 
-IMPL_LINK_NOARG(SwFieldDlg, CancelHdl, Button*, void)
+IMPL_LINK_NOARG(SwFieldDlg, CancelHdl, weld::Button&, void)
 {
     Close();
 }
@@ -213,48 +176,50 @@ void SwFieldDlg::ReInitDlg()
     if(!pActiveView)
         return;
     const SwWrtShell& rSh = pActiveView->GetWrtShell();
-    GetOKButton().Enable( !rSh.IsReadOnlyAvailable() ||
-                          !rSh.HasReadonlySel() );
+    GetOKButton().set_sensitive(!rSh.IsReadOnlyAvailable() ||
+                                !rSh.HasReadonlySel());
 
-    ReInitTabPage(m_nDokId);
-    ReInitTabPage(m_nVarId);
-    ReInitTabPage(m_nDokInf);
+    ReInitTabPage("document");
+    ReInitTabPage("variables");
+    ReInitTabPage("docinfo");
 
     if (!m_bHtmlMode)
     {
-        ReInitTabPage(m_nRefId);
-        ReInitTabPage(m_nFuncId);
-        ReInitTabPage(m_nDbId);
+        ReInitTabPage("ref");
+        ReInitTabPage("functions");
+        ReInitTabPage("database");
     }
 
     m_pChildWin->SetOldDocShell(pDocSh);
 }
 
 // newly initialise TabPage after Doc-Switch
-void SwFieldDlg::ReInitTabPage( sal_uInt16 nPageId, bool bOnlyActivate )
+void SwFieldDlg::ReInitTabPage(const OString& rPageId, bool bOnlyActivate)
 {
-    SwFieldPage* pPage = static_cast<SwFieldPage* >(GetTabPage(nPageId));
-    if ( pPage )
+    SwFieldPage* pPage = static_cast<SwFieldPage*>(GetTabPage(rPageId));
+    if (pPage)
         pPage->EditNewField( bOnlyActivate );   // newly initialise TabPage
 }
 
 // newly initialise after activation of a few TabPages
 void SwFieldDlg::Activate()
 {
+    fprintf(stderr, "SwFieldDlg::Activate()\n");
+
     SwView* pView = ::GetActiveView();
     if( pView )
     {
         bool bHtmlMode = (::GetHtmlMode(static_cast<SwDocShell*>(SfxObjectShell::Current())) & HTMLMODE_ON) != 0;
         const SwWrtShell& rSh = pView->GetWrtShell();
-        GetOKButton().Enable( !rSh.IsReadOnlyAvailable() ||
-                              !rSh.HasReadonlySel() );
+        GetOKButton().set_sensitive(!rSh.IsReadOnlyAvailable() ||
+                                    !rSh.HasReadonlySel());
 
-        ReInitTabPage(m_nVarId, true);
+        ReInitTabPage("variables", true);
 
         if( !bHtmlMode )
         {
-            ReInitTabPage(m_nRefId, true);
-            ReInitTabPage(m_nFuncId, true);
+            ReInitTabPage("ref", true);
+            ReInitTabPage("functions", true);
         }
     }
 }
@@ -270,20 +235,20 @@ void SwFieldDlg::EnableInsert(bool bEnable)
                     pView->GetWrtShell().HasReadonlySel()) )
             bEnable = false;
     }
-    GetOKButton().Enable(bEnable);
+    GetOKButton().set_sensitive(bEnable);
 }
 
 void SwFieldDlg::InsertHdl()
 {
-    GetOKButton().Click();
+    GetOKButton().clicked();
 }
 
 void SwFieldDlg::ActivateDatabasePage()
 {
 #if HAVE_FEATURE_DBCONNECTIVITY
     m_bDataBaseMode = true;
-    ShowPage(m_nDbId);
-    SfxTabPage* pDBPage = GetTabPage(m_nDbId);
+    ShowPage("database");
+    SfxTabPage* pDBPage = GetTabPage("database");
     if( pDBPage )
     {
         static_cast<SwFieldDBPage*>(pDBPage)->ActivateMailMergeAddress();
@@ -299,13 +264,13 @@ void SwFieldDlg::ActivateDatabasePage()
 
 void SwFieldDlg::ShowReferencePage()
 {
-    ShowPage(m_nRefId);
+    ShowPage("ref");
 }
 
-void SwFieldDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
+void SwFieldDlg::PageCreated(const OString& rId, SfxTabPage& rPage)
 {
 #if HAVE_FEATURE_DBCONNECTIVITY
-    if (nId == m_nDbId)
+    if (rId == "database")
     {
         SfxDispatcher* pDispatch = m_pBindings->GetDispatcher();
         SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : nullptr;
diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx
index f2bc3de52fe2..a614361058f9 100644
--- a/sw/source/ui/fldui/inpdlg.cxx
+++ b/sw/source/ui/fldui/inpdlg.cxx
@@ -27,7 +27,7 @@
 #include <fldmgr.hxx>
 
 // edit field-insert
-SwFieldInputDlg::SwFieldInputDlg(weld::Window *pParent, SwWrtShell &rS,
+SwFieldInputDlg::SwFieldInputDlg(weld::Widget *pParent, SwWrtShell &rS,
                                  SwField* pField, bool bPrevButton, bool bNextButton)
     : GenericDialogController(pParent, "modules/swriter/ui/inputfielddialog.ui", "InputFieldDialog")
     , rSh( rS )
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx
index cb94e102aa88..fe594b39ed3f 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -1508,7 +1508,7 @@ bool SwFieldMgr::InsertField(
         // start dialog, not before the field is inserted tdf#99529
         pCurShell->Left(CRSR_SKIP_CHARS,
                 false, (INP_VAR == (nSubType & 0xff)) ? 1 : 2, false );
-        pCurShell->StartInputFieldDlg(pField.get(), false, true, rData.m_pParent ? rData.m_pParent->GetFrameWeld() : nullptr);
+        pCurShell->StartInputFieldDlg(pField.get(), false, true, rData.m_pParent);
 
         pCurShell->Pop(SwCursorShell::PopMode::DeleteCurrent);
     }
diff --git a/sw/source/uibase/fldui/fldwrap.cxx b/sw/source/uibase/fldui/fldwrap.cxx
index 7b56883414ac..c65c1d1b17d0 100644
--- a/sw/source/uibase/fldui/fldwrap.cxx
+++ b/sw/source/uibase/fldui/fldwrap.cxx
@@ -45,7 +45,7 @@ SwChildWinWrapper::SwChildWinWrapper(vcl::Window *pParentWindow, sal_uInt16 nId)
 
 IMPL_LINK_NOARG(SwChildWinWrapper, UpdateHdl, Timer *, void)
 {
-    GetWindow()->Activate();    // update dialog
+    GetController()->Activate();    // update dialog
 }
 
 // newly initialise dialog after Doc switch
@@ -67,7 +67,6 @@ bool SwChildWinWrapper::ReInitDlg(SwDocShell *)
 SfxChildWinInfo SwFieldDlgWrapper::GetInfo() const
 {
     SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
-    aInfo.aPos = GetWindow()->OutputToAbsoluteScreenPixel(aInfo.aPos);
     return aInfo;
 }
 
@@ -77,9 +76,9 @@ SwFieldDlgWrapper::SwFieldDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId,
     : SwChildWinWrapper( _pParent, nId )
 {
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-    pDlgInterface = pFact->CreateSwFieldDlg(pB, this, _pParent);
-    SetWindow( pDlgInterface->GetWindow() );
-    pDlgInterface->Start();
+    pDlgInterface = pFact->CreateSwFieldDlg(pB, this, _pParent->GetFrameWeld());
+    SetController(pDlgInterface->GetController());
+    pDlgInterface->StartExecuteAsync(nullptr);
 }
 
 // newly initialise dialog after Doc switch
@@ -116,11 +115,11 @@ SwFieldDataOnlyDlgWrapper::SwFieldDataOnlyDlgWrapper( vcl::Window* _pParent, sal
     : SwChildWinWrapper( _pParent, nId )
 {
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-    pDlgInterface = pFact->CreateSwFieldDlg(pB, this, _pParent);
+    pDlgInterface = pFact->CreateSwFieldDlg(pB, this, _pParent->GetFrameWeld());
 
-    SetWindow( pDlgInterface->GetWindow() );
+    SetController(pDlgInterface->GetController());
     pDlgInterface->ActivateDatabasePage();
-    pDlgInterface->Start();
+    pDlgInterface->StartExecuteAsync(nullptr);
     pDlgInterface->Initialize( pInfo );
 }
 
diff --git a/sw/source/uibase/inc/DropDownFieldDialog.hxx b/sw/source/uibase/inc/DropDownFieldDialog.hxx
index 73b7d9fd15c1..f1d36c39f3d6 100644
--- a/sw/source/uibase/inc/DropDownFieldDialog.hxx
+++ b/sw/source/uibase/inc/DropDownFieldDialog.hxx
@@ -46,7 +46,7 @@ class DropDownFieldDialog : public weld::GenericDialogController
     void    Apply();
     DECL_LINK(DoubleClickHdl, weld::TreeView&, void);
 public:
-    DropDownFieldDialog(weld::Window *pParent, SwWrtShell &rSh,
+    DropDownFieldDialog(weld::Widget *pParent, SwWrtShell &rSh,
                         SwField* pField, bool bPrevButton, bool bNextButton);
     virtual ~DropDownFieldDialog() override;
     bool PrevButtonPressed() const;
diff --git a/sw/source/uibase/inc/DropDownFormFieldDialog.hxx b/sw/source/uibase/inc/DropDownFormFieldDialog.hxx
index aee5c5232845..697357624a97 100644
--- a/sw/source/uibase/inc/DropDownFormFieldDialog.hxx
+++ b/sw/source/uibase/inc/DropDownFormFieldDialog.hxx
@@ -50,7 +50,7 @@ private:
     void Apply();
 
 public:
-    DropDownFormFieldDialog(weld::Window* pParent, mark::IFieldmark* pDropDownField);
+    DropDownFormFieldDialog(weld::Widget* pParent, mark::IFieldmark* pDropDownField);
     virtual ~DropDownFormFieldDialog() override;
 
     virtual short run() override
diff --git a/sw/source/uibase/inc/fldmgr.hxx b/sw/source/uibase/inc/fldmgr.hxx
index 46612d031f4c..4b8a2707ef01 100644
--- a/sw/source/uibase/inc/fldmgr.hxx
+++ b/sw/source/uibase/inc/fldmgr.hxx
@@ -44,7 +44,7 @@ class SbModule;
 class SvxMacroItem;
 class SvNumberFormatter;
 namespace vcl { class Window; }
-namespace weld { class Window; }
+namespace weld { class Widget; class Window; }
 enum class SwFieldIds : sal_uInt16;
 
 // the groups of fields
@@ -79,7 +79,7 @@ struct SwInsertField_Data
     css::uno::Any const m_aDBDataSource;
     css::uno::Any m_aDBConnection;
     css::uno::Any m_aDBColumn;
-    VclPtr<vcl::Window> m_pParent; // parent dialog used for SwWrtShell::StartInputFieldDlg()
+    weld::Widget* m_pParent; // parent widget used for SwWrtShell::StartInputFieldDlg()
 
     SwInsertField_Data(sal_uInt16 nType, sal_uInt16 nSub, const OUString& rPar1, const OUString& rPar2,
                     sal_uInt32 nFormatId, SwWrtShell* pShell = nullptr, sal_Unicode cSep = ' ', bool bIsAutoLanguage = true) :
diff --git a/sw/source/uibase/inc/fldtdlg.hxx b/sw/source/uibase/inc/fldtdlg.hxx
index 65552b29c9d3..159881ed1192 100644
--- a/sw/source/uibase/inc/fldtdlg.hxx
+++ b/sw/source/uibase/inc/fldtdlg.hxx
@@ -25,33 +25,26 @@ class SfxTabPage;
 class SwChildWinWrapper;
 struct SfxChildWinInfo;
 
-class SwFieldDlg: public SfxTabDialog
+class SwFieldDlg : public SfxTabDialogController
 {
     SwChildWinWrapper*  m_pChildWin;
     SfxBindings*        m_pBindings;
-    bool            m_bHtmlMode;
-    bool            m_bDataBaseMode;
-    sal_uInt16          m_nDokId;
-    sal_uInt16          m_nVarId;
-    sal_uInt16          m_nDokInf;
-    sal_uInt16          m_nRefId;
-    sal_uInt16          m_nFuncId;
-    sal_uInt16          m_nDbId;
+    bool                m_bHtmlMode;
+    bool                m_bDataBaseMode;
+    bool                m_bClosing;
 
-    virtual bool    Close() override;
-    virtual SfxItemSet* CreateInputItemSet( sal_uInt16 nId ) override;
-    virtual void        Activate() override;
-    virtual void        PageCreated(sal_uInt16 nId, SfxTabPage& rPage) override;
+    virtual SfxItemSet* CreateInputItemSet(const OString& rId) override;
+    virtual void        PageCreated(const OString& rId, SfxTabPage& rPage) override;
 
-    void                ReInitTabPage( sal_uInt16 nPageId,
-                                       bool bOnlyActivate = false );
+    void                ReInitTabPage(const OString& rPageId,
+                                      bool bOnlyActivate = false);
 
 public:
-    SwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, vcl::Window *pParent);
+    SwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, weld::Window *pParent);
     virtual ~SwFieldDlg() override;
 
-    DECL_LINK(OKHdl, Button*, void);
-    DECL_LINK(CancelHdl, Button*, void);
+    DECL_LINK(OKHdl, weld::Button&, void);
+    DECL_LINK(CancelHdl, weld::Button&, void);
 
     void                Initialize(SfxChildWinInfo const *pInfo);
     void                ReInitDlg();
@@ -59,6 +52,9 @@ public:
     void                InsertHdl();
     void                ActivateDatabasePage();
     void                ShowReferencePage();
+    virtual void        Close() override;
+    virtual void        EndDialog() override;
+    virtual void        Activate() override;
 };
 
 #endif
diff --git a/sw/source/uibase/inc/fldwrap.hxx b/sw/source/uibase/inc/fldwrap.hxx
index a7706144080c..3d0cd3a8a9d9 100644
--- a/sw/source/uibase/inc/fldwrap.hxx
+++ b/sw/source/uibase/inc/fldwrap.hxx
@@ -26,8 +26,8 @@ class SwFieldDlgWrapper : public SwChildWinWrapper
 {
     ScopedVclPtr<AbstractSwFieldDlg> pDlgInterface;
 public:
-    SwFieldDlgWrapper( vcl::Window* pParent, sal_uInt16 nId,
-                        SfxBindings* pBindings, SfxChildWinInfo* pInfo );
+    SwFieldDlgWrapper(vcl::Window* pParent, sal_uInt16 nId,
+                      SfxBindings* pBindings, SfxChildWinInfo* pInfo);
 
     SFX_DECL_CHILDWINDOW_WITHID(SwFieldDlgWrapper);
 
@@ -40,8 +40,8 @@ class SwFieldDataOnlyDlgWrapper : public SwChildWinWrapper
 {
     ScopedVclPtr<AbstractSwFieldDlg> pDlgInterface;
 public:
-    SwFieldDataOnlyDlgWrapper( vcl::Window* pParent, sal_uInt16 nId,
-                        SfxBindings* pBindings, SfxChildWinInfo* pInfo );
+    SwFieldDataOnlyDlgWrapper(vcl::Window* pParent, sal_uInt16 nId,
+                              SfxBindings* pBindings, SfxChildWinInfo* pInfo);
 
     SFX_DECL_CHILDWINDOW(SwFieldDataOnlyDlgWrapper);
 
diff --git a/sw/source/uibase/inc/inpdlg.hxx b/sw/source/uibase/inc/inpdlg.hxx
index b85e52663366..01905312b4af 100644
--- a/sw/source/uibase/inc/inpdlg.hxx
+++ b/sw/source/uibase/inc/inpdlg.hxx
@@ -54,7 +54,7 @@ class SwFieldInputDlg : public weld::GenericDialogController
     DECL_LINK(PrevHdl, weld::Button&, void);
 
 public:
-    SwFieldInputDlg(weld::Window *pParent, SwWrtShell &rSh,
+    SwFieldInputDlg(weld::Widget *pParent, SwWrtShell &rSh,
                     SwField* pField, bool bPrevButton, bool bNextButton);
     virtual short run() override
     {
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index e99c89542482..0a9ee03e3876 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -395,9 +395,9 @@ typedef bool (SwWrtShell:: *FNSimpleMove)();
     void    MoveCursor( bool bWithSelect = false );
 
     // update input fields
-    bool    StartInputFieldDlg(SwField*, bool bPrevButton, bool bNextButton, weld::Window* pParentWin, FieldDialogPressedButton* pPressedButton = nullptr);
+    bool    StartInputFieldDlg(SwField*, bool bPrevButton, bool bNextButton, weld::Widget* pParentWin, FieldDialogPressedButton* pPressedButton = nullptr);
     // update DropDown fields
-    bool    StartDropDownFieldDlg(SwField*, bool bPrevButton, bool bNextButton, weld::Window* pParentWin, FieldDialogPressedButton* pPressedButton = nullptr);
+    bool    StartDropDownFieldDlg(SwField*, bool bPrevButton, bool bNextButton, weld::Widget* pParentWin, FieldDialogPressedButton* pPressedButton = nullptr);
 
     //"Handler" for changes at DrawView - for controls.
     virtual void DrawSelChanged( ) override;
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index c172b613339d..9f809738f12e 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -293,15 +293,17 @@ void SwTextShell::ExecField(SfxRequest &rReq)
                     bRes = aFieldMgr.InsertField( aData );
                 }
                 else
-                        //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
-                        if(!GetView().GetViewFrame()->IsInModalMode())
                 {
-                    SfxViewFrame* pVFrame = GetView().GetViewFrame();
-                    pVFrame->ToggleChildWindow(FN_INSERT_FIELD);
-                    bRes = pVFrame->GetChildWindow( nSlot ) != nullptr;
-                    Invalidate(rReq.GetSlot());
-                    Invalidate(FN_INSERT_FIELD_CTRL);
-                    rReq.Ignore();
+                    //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
+                    if(!GetView().GetViewFrame()->IsInModalMode())
+                    {
+                        SfxViewFrame* pVFrame = GetView().GetViewFrame();
+                        pVFrame->ToggleChildWindow(FN_INSERT_FIELD);
+                        bRes = pVFrame->GetChildWindow( nSlot ) != nullptr;
+                        Invalidate(rReq.GetSlot());
+                        Invalidate(FN_INSERT_FIELD_CTRL);
+                        rReq.Ignore();
+                    }
                 }
                 rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
             }
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 5fccd756bae9..b63cf4ed2870 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -252,7 +252,7 @@ class FieldDeletionModify : public SwModify
 
 // Start input dialog for a specific field
 bool SwWrtShell::StartInputFieldDlg(SwField* pField, bool bPrevButton, bool bNextButton,
-                                    weld::Window* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton)
+                                    weld::Widget* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton)
 {
 
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
@@ -279,7 +279,7 @@ bool SwWrtShell::StartInputFieldDlg(SwField* pField, bool bPrevButton, bool bNex
 }
 
 bool SwWrtShell::StartDropDownFieldDlg(SwField* pField, bool bPrevButton, bool bNextButton,
-                                       weld::Window* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton)
+                                       weld::Widget* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton)
 {
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     ScopedVclPtr<AbstractDropDownFieldDialog> pDlg(pFact->CreateDropDownFieldDialog(pParentWin, *this, pField, bPrevButton, bNextButton));
diff --git a/sw/uiconfig/swriter/ui/fielddialog.ui b/sw/uiconfig/swriter/ui/fielddialog.ui
index 9330d37ae351..9de3847ebfae 100644
--- a/sw/uiconfig/swriter/ui/fielddialog.ui
+++ b/sw/uiconfig/swriter/ui/fielddialog.ui
@@ -1,12 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="FieldDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="fielddialog|FieldDialog">Fields</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>
@@ -17,14 +22,12 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="ok">
-                <property name="label" translatable="yes" context="fielddialog|ok">_Insert</property>
-                <property name="visible">True</property>
+              <object class="GtkButton" id="reset">
+                <property name="label">gtk-revert-to-saved</property>
                 <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_underline">True</property>
+                <property name="no_show_all">True</property>
+                <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -33,12 +36,14 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="cancel">
-                <property name="label">gtk-close</property>
+              <object class="GtkButton" id="ok">
+                <property name="label" translatable="yes" context="fielddialog|ok">_Insert</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
+                <property name="use_underline">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -47,8 +52,8 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="help">
-                <property name="label">gtk-help</property>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-close</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -58,21 +63,21 @@
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">2</property>
-                <property name="secondary">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="reset">
-                <property name="label">gtk-revert-to-saved</property>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="no_show_all">True</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">3</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -89,7 +94,6 @@
             <property name="can_focus">True</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
-            <property name="scrollable">True</property>
             <property name="enable_popup">True</property>
             <child>
               <object class="GtkGrid">
@@ -379,10 +383,10 @@
       </object>
     </child>
     <action-widgets>
+      <action-widget response="101">reset</action-widget>
       <action-widget response="-5">ok</action-widget>
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
-      <action-widget response="0">reset</action-widget>
     </action-widgets>
   </object>
 </interface>
diff --git a/sw/uiconfig/swriter/ui/flddbpage.ui b/sw/uiconfig/swriter/ui/flddbpage.ui
index 49672192e0cf..f7e55f31677f 100644
--- a/sw/uiconfig/swriter/ui/flddbpage.ui
+++ b/sw/uiconfig/swriter/ui/flddbpage.ui
@@ -243,6 +243,7 @@
                             <property name="headers_visible">False</property>
                             <property name="search_column">1</property>
                             <property name="enable_tree_lines">True</property>
+                            <property name="show_expanders">True</property>
                             <child internal-child="selection">
                               <object class="GtkTreeSelection" id="Macro Library List-selection1"/>
                             </child>
@@ -389,8 +390,9 @@
                             <property name="can_focus">False</property>
                             <child>
                               <object class="GtkComboBoxText" id="format">
-                                <property name="can_focus">False</property>
+                                <property name="can_focus">True</property>
                                 <property name="no_show_all">True</property>
+                                <property name="hexpand">True</property>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
@@ -403,7 +405,6 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="hexpand">True</property>
-                                <property name="vexpand">True</property>
                                 <accessibility>
                                   <relation type="labelled-by" target="userdefinedcb"/>
                                 </accessibility>
diff --git a/sw/uiconfig/swriter/ui/flddocumentpage.ui b/sw/uiconfig/swriter/ui/flddocumentpage.ui
index 906649d07cd2..8f463ed1b229 100644
--- a/sw/uiconfig/swriter/ui/flddocumentpage.ui
+++ b/sw/uiconfig/swriter/ui/flddocumentpage.ui
@@ -9,6 +9,11 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">1000000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkTreeStore" id="liststore1">
     <columns>
       <!-- column-name text -->
@@ -367,6 +372,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="activates_default">True</property>
+                <property name="adjustment">adjustment2</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>


More information about the Libreoffice-commits mailing list