diff options
author | Skyler Grey <skyler3665@gmail.com> | 2022-08-12 10:31:42 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2022-11-21 11:17:21 +0100 |
commit | 19d02a1267cfa1e7a950af31a77d4a7888594630 (patch) | |
tree | 453da7c3314b9f683289a6f4e7518c2889e0770b /sw/source/ui | |
parent | 4b4e7ac74e2b72833de6b464b25b077b7541f43a (diff) |
Make the number format dialog an async jsdialog
- The dialog needs to be async in order for multiple people to be able
to use it at once
- If we don't make the item set a shared pointer, we will crash out with
an error when we try to copy it after the OK button is pressed
- As the dialog is tabbed, we need to enable the dialog for all UI files
that the dialog uses rather than just the main dialog UI file
Change-Id: I8d684e9e9ad49b8a85ee940864d7219b4115a6e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138270
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142990
Tested-by: Jenkins
Diffstat (limited to 'sw/source/ui')
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 22 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 14 |
2 files changed, 35 insertions, 1 deletions
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 68135716fcb9..56bce661390d 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -110,6 +110,16 @@ short SwAbstractSfxController_Impl::Execute() return m_xDlg->run(); } +short AbstractNumFormatDlg_Impl::Execute() +{ + return m_xDlg->run(); +} + +bool AbstractNumFormatDlg_Impl::StartExecuteAsync(AsyncContext &rCtx) +{ + return SfxSingleTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + short AbstractSwAsciiFilterDlg_Impl::Execute() { return m_xDlg->run(); @@ -356,11 +366,21 @@ const SfxItemSet* SwAbstractSfxController_Impl::GetOutputItemSet() const return m_xDlg->GetOutputItemSet(); } +const SfxItemSet* AbstractNumFormatDlg_Impl::GetOutputItemSet() const +{ + return m_xDlg->GetOutputItemSet(); +} + void SwAbstractSfxController_Impl::SetText(const OUString& rStr) { m_xDlg->set_title(rStr); } +void AbstractNumFormatDlg_Impl::SetText(const OUString& rStr) +{ + m_xDlg->set_title(rStr); +} + void AbstractSwAsciiFilterDlg_Impl::FillOptions( SwAsciiOptions& rOptions ) { m_xDlg->FillOptions(rOptions); @@ -833,7 +853,7 @@ VclPtr<SfxAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwBackgroundDialog VclPtr<SfxAbstractDialog> SwAbstractDialogFactory_Impl::CreateNumFormatDialog(weld::Widget* pParent, const SfxItemSet& rSet) { - return VclPtr<SwAbstractSfxController_Impl>::Create(std::make_unique<SwNumFormatDlg>(pParent, rSet)); + return VclPtr<AbstractNumFormatDlg_Impl>::Create(std::make_shared<SwNumFormatDlg>(pParent, rSet)); } VclPtr<AbstractSwAsciiFilterDlg> SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg(weld::Window* pParent, diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index c0326249a15b..5e110dfbdd59 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -126,6 +126,20 @@ public: virtual void SetText(const OUString& rStr) override; }; +class AbstractNumFormatDlg_Impl : public SfxAbstractDialog +{ + std::shared_ptr<SfxSingleTabDialogController> m_xDlg; +public: + explicit AbstractNumFormatDlg_Impl(std::shared_ptr<SfxSingleTabDialogController> p) + : m_xDlg(std::move(p)) + { + } + virtual short Execute() override; + virtual bool StartExecuteAsync(AsyncContext &rCtx) override; + virtual const SfxItemSet* GetOutputItemSet() const override; + virtual void SetText(const OUString& rStr) override; +}; + class AbstractSwAsciiFilterDlg_Impl : public AbstractSwAsciiFilterDlg { std::unique_ptr<SwAsciiFilterDlg> m_xDlg; |