diff options
-rw-r--r-- | sw/inc/swabstdlg.hxx | 9 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 10 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 10 | ||||
-rw-r--r-- | sw/source/ui/table/rowht.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/inc/rowht.hxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/shells/tabsh.cxx | 11 |
6 files changed, 32 insertions, 21 deletions
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 621ac8cd666f..c8974620060e 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -436,6 +436,13 @@ public: virtual void Apply() = 0; }; +class AbstractSwTableHeightDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractSwTableHeightDlg() override = default; +public: + virtual void Apply() = 0; +}; class SwAbstractDialogFactory { @@ -497,7 +504,7 @@ public: virtual VclPtr<AbstractSwSelGlossaryDlg> CreateSwSelGlossaryDlg(weld::Window *pParent, const OUString &rShortName) = 0; virtual VclPtr<AbstractSwSortDlg> CreateSwSortingDialog(weld::Window *pParent, SwWrtShell &rSh) = 0; - virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) = 0; + virtual VclPtr<AbstractSwTableHeightDlg> CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) = 0; virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(weld::Window *pParent, SwWrtShell &rSh) = 0; virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) = 0; diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 66a77db67b4b..46825f29a320 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -155,7 +155,13 @@ bool AbstractSwTableWidthDlg_Impl::StartExecuteAsync(AsyncContext &rCtx) short AbstractSwTableHeightDlg_Impl::Execute() { - return m_xDlg->run(); + assert(false); + return -1; +} + +bool AbstractSwTableHeightDlg_Impl::StartExecuteAsync(AsyncContext &rCtx) +{ + return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); } short AbstractSwMergeTableDlg_Impl::Execute() @@ -1128,7 +1134,7 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwColumnDialog(wel return VclPtr<AbstractGenericDialog_Impl>::Create(std::make_shared<SwColumnDlg>(pParent, rSh)); } -VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) +VclPtr<AbstractSwTableHeightDlg> SwAbstractDialogFactory_Impl::CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) { return VclPtr<AbstractSwTableHeightDlg_Impl>::Create(std::make_unique<SwTableHeightDlg>(pParent, rSh)); } diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 5ebcbdd7509e..88e9d2b632c7 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -271,15 +271,17 @@ public: virtual void Apply() override { m_xDlg->Apply(); } }; -class AbstractSwTableHeightDlg_Impl : public VclAbstractDialog +class AbstractSwTableHeightDlg_Impl : public AbstractSwTableHeightDlg { - std::unique_ptr<SwTableHeightDlg> m_xDlg; + std::shared_ptr<SwTableHeightDlg> m_xDlg; public: - explicit AbstractSwTableHeightDlg_Impl(std::unique_ptr<SwTableHeightDlg> p) + explicit AbstractSwTableHeightDlg_Impl(std::shared_ptr<SwTableHeightDlg> p) : m_xDlg(std::move(p)) { } virtual short Execute() override; + virtual bool StartExecuteAsync(AsyncContext &rCtx) override; + virtual void Apply() override { m_xDlg->Apply(); } }; class AbstractSwMergeTableDlg_Impl : public VclAbstractDialog @@ -795,7 +797,7 @@ public: virtual VclPtr<VclAbstractDialog> CreateSwAutoMarkDialog(weld::Window *pParent, SwWrtShell &rSh) override; virtual VclPtr<AbstractSwSelGlossaryDlg> CreateSwSelGlossaryDlg(weld::Window *pParent, const OUString &rShortName) override; virtual VclPtr<AbstractSwSortDlg> CreateSwSortingDialog(weld::Window *pParent, SwWrtShell &rSh) override; - virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) override; + virtual VclPtr<AbstractSwTableHeightDlg> CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) override; virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(weld::Window *pParent, SwWrtShell &rSh) override; virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) override; diff --git a/sw/source/ui/table/rowht.cxx b/sw/source/ui/table/rowht.cxx index f46297bf7de5..7a7c26906f5e 100644 --- a/sw/source/ui/table/rowht.cxx +++ b/sw/source/ui/table/rowht.cxx @@ -61,12 +61,4 @@ SwTableHeightDlg::SwTableHeightDlg(weld::Window *pParent, SwWrtShell &rS) } } -short SwTableHeightDlg::run() -{ - short nRet = GenericDialogController::run(); - if (nRet == RET_OK) - Apply(); - return nRet; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/rowht.hxx b/sw/source/uibase/inc/rowht.hxx index 659b9ac6331a..59a51fc97abe 100644 --- a/sw/source/uibase/inc/rowht.hxx +++ b/sw/source/uibase/inc/rowht.hxx @@ -30,12 +30,9 @@ class SwTableHeightDlg final : public weld::GenericDialogController std::unique_ptr<weld::MetricSpinButton> m_xHeightEdit; std::unique_ptr<weld::CheckButton> m_xAutoHeightCB; -private: - void Apply(); - public: SwTableHeightDlg(weld::Window* pParent, SwWrtShell& rS); - virtual short run() override; + void Apply(); }; #endif diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 0adc875b5279..8b1280dcbab7 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -887,8 +887,15 @@ void SwTableShell::Execute(SfxRequest &rReq) case FN_TABLE_SET_ROW_HEIGHT: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwTableHeightDialog(GetView().GetFrameWeld(), rSh)); - pDlg->Execute(); + VclPtr<AbstractSwTableHeightDlg> pDlg(pFact->CreateSwTableHeightDialog(GetView().GetFrameWeld(), rSh)); + pDlg->StartExecuteAsync( + [pDlg] (sal_Int32 nResult)->void + { + if (nResult == RET_OK) + pDlg->Apply(); + pDlg->disposeOnce(); + } + ); break; } case FN_NUMBER_BULLETS: |