sw/inc/swabstdlg.hxx | 1 + sw/source/ui/dialog/swdlgfact.cxx | 3 ++- sw/source/uibase/inc/DropDownFieldDialog.hxx | 2 +- sw/source/uibase/inc/wrtsh.hxx | 2 ++ sw/source/uibase/wrtsh/wrtsh2.cxx | 22 +++++++++++++++++++++- 5 files changed, 27 insertions(+), 3 deletions(-)
New commits: commit 63b690ee20722081eb18563d0ffba33d7dcee908 Author: Caolán McNamara <[email protected]> AuthorDate: Mon Dec 15 16:59:53 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Dec 15 20:19:03 2025 +0100 make simple activate case of DropDownFieldDialog async Change-Id: If3a36540976014774b4cbf84f52e2d3de28b96b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195679 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 48d806486d3c..bac073b696b1 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -299,6 +299,7 @@ protected: public: virtual bool PrevButtonPressed() const = 0; virtual bool NextButtonPressed() const = 0; + virtual void Apply() = 0; }; class AbstractSwLabDlg : public SfxAbstractTabDialog diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index c1fec98137b7..e6217486002f 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -458,10 +458,11 @@ VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwFootNoteOptio namespace { class AbstractDropDownFieldDialog_Impl - : public vcl::AbstractDialogImpl_Sync<AbstractDropDownFieldDialog, sw::DropDownFieldDialog> + : public vcl::AbstractDialogImpl_Async<AbstractDropDownFieldDialog, sw::DropDownFieldDialog> { public: using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; + void Apply() override { m_pDlg->Apply(); } bool PrevButtonPressed() const override { return m_pDlg->PrevButtonPressed(); } bool NextButtonPressed() const override { return m_pDlg->NextButtonPressed(); } }; diff --git a/sw/source/uibase/inc/DropDownFieldDialog.hxx b/sw/source/uibase/inc/DropDownFieldDialog.hxx index b8b60f20c293..07b9e494d0a6 100644 --- a/sw/source/uibase/inc/DropDownFieldDialog.hxx +++ b/sw/source/uibase/inc/DropDownFieldDialog.hxx @@ -43,7 +43,6 @@ class DropDownFieldDialog final : public weld::GenericDialogController DECL_LINK(EditHdl, weld::Button&, void); DECL_LINK(PrevHdl, weld::Button&, void); DECL_LINK(NextHdl, weld::Button&, void); - void Apply(); DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); public: DropDownFieldDialog(weld::Widget *pParent, SwWrtShell &rSh, @@ -51,6 +50,7 @@ public: virtual ~DropDownFieldDialog() override; bool PrevButtonPressed() const; bool NextButtonPressed() const; + void Apply(); virtual short run() override { short nRet = GenericDialogController::run(); diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index 5e387dd30171..f623299e3ac6 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -427,6 +427,8 @@ typedef bool (SwWrtShell::*FNSimpleMove)(); bool StartInputFieldDlg(SwField*, bool bPrevButton, bool bNextButton, weld::Widget* pParentWin, FieldDialogPressedButton* pPressedButton = nullptr); // update DropDown fields bool StartDropDownFieldDlg(SwField*, bool bPrevButton, bool bNextButton, weld::Widget* pParentWin, FieldDialogPressedButton* pPressedButton = nullptr); + // update single DropDown field + void EditDropDownFieldDlg(SwField*, weld::Widget* pParentWin); //"Handler" for changes at DrawView - for controls. virtual void DrawSelChanged( ) override; diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index ddf3d5966ec0..3e61f3430702 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -304,6 +304,26 @@ bool SwWrtShell::StartInputFieldDlg(SwField* pField, bool bPrevButton, bool bNex return bRet; } +void SwWrtShell::EditDropDownFieldDlg(SwField* pField, weld::Widget* pParentWin) +{ + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); + VclPtr<AbstractDropDownFieldDialog> pDlg(pFact->CreateDropDownFieldDialog(pParentWin, *this, pField, false, false)); + + pDlg->StartExecuteAsync([pDlg, this](sal_Int32 nRet) { + if (nRet == RET_OK) + pDlg->Apply(); + + pDlg->disposeOnce(); + + GetWin()->PaintImmediately(); + + if (nRet == RET_YES) + { + GetView().GetViewFrame().GetDispatcher()->Execute(FN_EDIT_FIELD, SfxCallMode::SYNCHRON); + } + }); +} + bool SwWrtShell::StartDropDownFieldDlg(SwField* pField, bool bPrevButton, bool bNextButton, weld::Widget* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton) { @@ -513,7 +533,7 @@ void SwWrtShell::ClickToField(const SwField& rField, bool bExecHyperlinks) StartInputFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld()); break; case SwFieldIds::Dropdown : - StartDropDownFieldDlg(const_cast<SwField*>(&rField), false, false, GetView().GetFrameWeld()); + EditDropDownFieldDlg(const_cast<SwField*>(&rField), GetView().GetFrameWeld()); break; default: SAL_WARN_IF(rField.IsClickable(), "sw", "unhandled clickable field!");
