From e5d6133283bacb6bced8cdbedaeae6b3bd2f179e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 25 Jan 2024 10:19:00 +0200 Subject: make insert row dialog async Change-Id: Icb6c2fafe2b47989ff2692956890c87780b117e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162552 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/dialogs/insrc.cxx | 19 +++++++++++++++++-- cui/source/factory/dlgfact.cxx | 2 +- cui/source/inc/insrc.hxx | 17 +++++++++++++++-- 3 files changed, 33 insertions(+), 5 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/insrc.cxx b/cui/source/dialogs/insrc.cxx index 1ff1a14411cb..6c09c8ce4560 100644 --- a/cui/source/dialogs/insrc.cxx +++ b/cui/source/dialogs/insrc.cxx @@ -51,9 +51,24 @@ SvxInsRowColDlg::SvxInsRowColDlg(weld::Window* pParent, bool bColumn, const OUSt m_xDialog->set_help_id(rHelpId); } -short SvxInsRowColDlg::Execute() +short SvxAbstractInsRowColDlg_Impl::Execute() { - return run(); + return m_xDlg->run(); +} + +bool SvxAbstractInsRowColDlg_Impl::StartExecuteAsync(AsyncContext &rCtx) +{ + return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + +bool SvxAbstractInsRowColDlg_Impl::isInsertBefore() const +{ + return m_xDlg->isInsertBefore(); +} + +sal_uInt16 SvxAbstractInsRowColDlg_Impl::getInsertCount() const +{ + return m_xDlg->getInsertCount(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 6979167de569..2392fa46edc6 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1475,7 +1475,7 @@ VclPtr AbstractDialogFactory_Impl::CreateOptionsDialog(weld:: VclPtr AbstractDialogFactory_Impl::CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OUString& rHelpId) { - return VclPtr::Create(pParent, bCol, rHelpId); + return VclPtr::Create(std::make_shared(pParent, bCol, rHelpId)); } VclPtr AbstractDialogFactory_Impl::CreatePasswordToOpenModifyDialog( diff --git a/cui/source/inc/insrc.hxx b/cui/source/inc/insrc.hxx index 597ef172c3e9..9ab7f0fed466 100644 --- a/cui/source/inc/insrc.hxx +++ b/cui/source/inc/insrc.hxx @@ -22,7 +22,7 @@ #include #include -class SvxInsRowColDlg : public SvxAbstractInsRowColDlg, public weld::GenericDialogController +class SvxInsRowColDlg : public weld::GenericDialogController { private: std::unique_ptr m_xCountEdit; @@ -32,8 +32,21 @@ private: public: SvxInsRowColDlg(weld::Window* pParent, bool bCol, const OUString& rHelpId); - virtual short Execute() override; + bool isInsertBefore() const; + sal_uInt16 getInsertCount() const; +}; + +class SvxAbstractInsRowColDlg_Impl final : public SvxAbstractInsRowColDlg +{ + std::shared_ptr m_xDlg; +public: + explicit SvxAbstractInsRowColDlg_Impl(std::shared_ptr p) + : m_xDlg(std::move(p)) + { + } + virtual short Execute() override; + virtual bool StartExecuteAsync(AsyncContext& rCtx) override; virtual bool isInsertBefore() const override; virtual sal_uInt16 getInsertCount() const override; }; -- cgit