diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-01-31 10:22:38 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-01-31 17:21:59 +0100 |
commit | 09c29b56fe8af1f3428a96017fec4d921e023906 (patch) | |
tree | 0eff94cd371f9cc4db8c61043698ccee6e4ca44b /sw | |
parent | dcbcc12b9f9db99ba18811c7249917916748e2a7 (diff) |
make field-edit dialog async
Change-Id: Ib24166fe0370a27357adf1611deafda2686a14aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162805
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldedt.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/inc/fldedt.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/textfld.cxx | 11 |
4 files changed, 14 insertions, 11 deletions
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 742608f3e871..219beb1c4bb8 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -1202,7 +1202,11 @@ VclPtr<AbstractSwFieldDlg> SwAbstractDialogFactory_Impl::CreateSwFieldDlg(SfxBin VclPtr<SfxAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwFieldEditDlg(SwView& rVw) { - return VclPtr<SwAbstractSfxController_Impl>::Create(std::make_unique<SwFieldEditDlg>(rVw)); + auto xDlg = std::make_shared<SwFieldEditDlg>(rVw); + // without TabPage no dialog + if (!xDlg->GetTabPage()) + return nullptr; + return VclPtr<SwAbstractSfxController_Impl>::Create(std::move(xDlg)); } VclPtr<AbstractSwRenameXNamedDlg> SwAbstractDialogFactory_Impl::CreateSwRenameXNamedDlg(weld::Widget* pParent, diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index c947c064e5d4..cfa614b712ab 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -252,12 +252,6 @@ IMPL_LINK_NOARG(SwFieldEditDlg, OKHdl, weld::Button&, void) } } -short SwFieldEditDlg::run() -{ - // without TabPage no dialog - return GetTabPage() ? SfxSingleTabDialogController::run() : static_cast<short>(RET_CANCEL); -} - // Traveling between fields of the same type IMPL_LINK(SwFieldEditDlg, NextPrevHdl, weld::Button&, rButton, void) { diff --git a/sw/source/uibase/inc/fldedt.hxx b/sw/source/uibase/inc/fldedt.hxx index 7692e1256137..635065580985 100644 --- a/sw/source/uibase/inc/fldedt.hxx +++ b/sw/source/uibase/inc/fldedt.hxx @@ -48,8 +48,6 @@ public: DECL_LINK(OKHdl, weld::Button&, void); - virtual short run() override; - void EnableInsert(bool bEnable); void InsertHdl(); }; diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index ac28d14bd079..efb60c197a3c 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -164,8 +164,15 @@ void SwTextShell::ExecField(SfxRequest &rReq) default: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateSwFieldEditDlg( GetView() )); - pDlg->Execute(); + VclPtr<SfxAbstractDialog> pDlg(pFact->CreateSwFieldEditDlg( GetView() )); + // without TabPage no dialog + if (pDlg) + pDlg->StartExecuteAsync( + [pDlg] (sal_Int32 /*nResult*/)->void + { + pDlg->disposeOnce(); + } + ); } } } |