From 817a06d857bff5be35f8eb7bf830b75871556bc5 Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Wed, 30 Sep 2020 10:49:12 +0200 Subject: Make Split Table Cell dialog async MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4efbb24f721aa50cc4dbbe78ae1e7e6087f8c876 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103670 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105594 Tested-by: Jenkins --- cui/source/dialogs/splitcelldlg.cxx | 35 ++++++++++++++++++++++++++++++----- cui/source/factory/dlgfact.cxx | 2 +- cui/source/inc/splitcelldlg.hxx | 20 ++++++++++++++++++-- 3 files changed, 49 insertions(+), 8 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/splitcelldlg.cxx b/cui/source/dialogs/splitcelldlg.cxx index 58d6b7e4f8a0..f58b8cc0ece5 100644 --- a/cui/source/dialogs/splitcelldlg.cxx +++ b/cui/source/dialogs/splitcelldlg.cxx @@ -74,15 +74,40 @@ tools::Long SvxSplitTableDlg::GetCount() const return m_xCountEdit->get_value(); } -short SvxSplitTableDlg::Execute() -{ - return run(); -} - void SvxSplitTableDlg::SetSplitVerticalByDefault() { if( mnMaxVertical >= 2 ) m_xVertBox->set_active(true); // tdf#60242 } +bool SvxAbstractSplitTableDialog_Impl::IsHorizontal() const +{ + return m_xDlg->IsHorizontal(); +} + +bool SvxAbstractSplitTableDialog_Impl::IsProportional() const +{ + return m_xDlg->IsProportional(); +} + +tools::Long SvxAbstractSplitTableDialog_Impl::GetCount() const +{ + return m_xDlg->GetCount(); +} + +void SvxAbstractSplitTableDialog_Impl::SetSplitVerticalByDefault() +{ + m_xDlg->SetSplitVerticalByDefault(); +} + +short SvxAbstractSplitTableDialog_Impl::Execute() +{ + return m_xDlg->run(); +} + +bool SvxAbstractSplitTableDialog_Impl::StartExecuteAsync(AsyncContext& rContext) +{ + return weld::DialogController::runAsync(m_xDlg, rContext.maEndDialogFn); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index ea2675694f07..e43b027602c4 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1602,7 +1602,7 @@ VclPtr AbstractDialogFactory_Impl::CreateSvxFormatCellsDia VclPtr AbstractDialogFactory_Impl::CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, tools::Long nMaxVertical) { - return VclPtr::Create( pParent, bIsTableVertical, nMaxVertical, 99 ); + return VclPtr::Create( std::make_shared(pParent, bIsTableVertical, nMaxVertical, 99 )); } std::shared_ptr AbstractDialogFactory_Impl::CreateSvxNewTableDialog(weld::Window* pParent) diff --git a/cui/source/inc/splitcelldlg.hxx b/cui/source/inc/splitcelldlg.hxx index 88b1de85c9a7..5085c1938917 100644 --- a/cui/source/inc/splitcelldlg.hxx +++ b/cui/source/inc/splitcelldlg.hxx @@ -21,7 +21,7 @@ #include #include -class SvxSplitTableDlg : public SvxAbstractSplitTableDialog, public weld::GenericDialogController +class SvxSplitTableDlg : public weld::GenericDialogController { private: std::unique_ptr m_xCountEdit; @@ -37,12 +37,28 @@ public: DECL_LINK(ClickHdl, weld::Button&, void); + virtual bool IsHorizontal() const; + virtual bool IsProportional() const; + virtual tools::Long GetCount() const; + + virtual void SetSplitVerticalByDefault(); +}; + +class SvxAbstractSplitTableDialog_Impl : public SvxAbstractSplitTableDialog +{ + std::shared_ptr m_xDlg; + +public: + SvxAbstractSplitTableDialog_Impl(std::shared_ptr pDlg) : m_xDlg(std::move(pDlg)) {} + virtual bool IsHorizontal() const override; virtual bool IsProportional() const override; virtual tools::Long GetCount() const override; - virtual short Execute() override; virtual void SetSplitVerticalByDefault() override; + + virtual short Execute() override; + virtual bool StartExecuteAsync(AsyncContext& rContext) override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit