cui/source/factory/dlgfact.cxx | 20 ++++++++++++-------- sw/Library_sw.mk | 1 - sw/inc/colwd.hxx | 4 +--- sw/inc/swabstdlg.hxx | 11 ++++++++++- sw/source/ui/dialog/swdlgfact.cxx | 10 ++++++++-- sw/source/ui/dialog/swdlgfact.hxx | 10 ++++++---- sw/source/ui/table/colwd.cxx | 8 -------- sw/source/uibase/table/tablemgr.cxx | 11 +++++++++-- sw/source/uibase/uiview/view2.cxx | 9 +++++++-- 9 files changed, 53 insertions(+), 31 deletions(-)
New commits: commit 8d26ca7f9ac37b5ada0a2c463b37181bcc8301a8 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Jan 30 14:13:41 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jan 30 17:47:29 2024 +0100 tdf#158695 convert-to bogusly needs libcui (--disable-gui build) Change-Id: I8e13902c4ee9b4b17e921b68b0626f7728cb0c18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162749 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index bd5d831f7f2f..707f5506d6a6 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -56,7 +56,6 @@ $(eval $(call gb_Library_use_libraries,sw,\ comphelper \ cppu \ cppuhelper \ - cui \ $(call gb_Helper_optional,DBCONNECTIVITY, \ dbtools) \ docmodel \ commit a08110be32a6958f27ce9ddb1e2cb2227265dfe1 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Jan 30 12:24:47 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jan 30 17:08:22 2024 +0100 convert table width dialog to async Change-Id: Id8fe4f8f0e3138b714aeb938f887483dab1214a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162739 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/colwd.hxx b/sw/inc/colwd.hxx index 8ead4ccf44d4..ab511ee118c0 100644 --- a/sw/inc/colwd.hxx +++ b/sw/inc/colwd.hxx @@ -33,11 +33,9 @@ private: DECL_LINK(LoseFocusHdl, weld::SpinButton&, void); - void Apply(); - public: SwTableWidthDlg(weld::Window* pParent, SwTableFUNC& rFnc); - virtual short run() override; + void Apply(); }; #endif diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 690b20c6ea3b..65fbf918efca 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -418,6 +418,15 @@ public: }; +class AbstractSwTableWidthDlg : public VclAbstractDialog +{ +protected: + virtual ~AbstractSwTableWidthDlg() override = default; +public: + virtual void Apply() = 0; +}; + + class SwAbstractDialogFactory { public: @@ -488,7 +497,7 @@ public: virtual VclPtr<SfxAbstractDialog> CreateSwBorderDlg(weld::Window* pParent, SfxItemSet& rSet, SwBorderModes nType) = 0; virtual VclPtr<SfxAbstractDialog> CreateSwWrapDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pSh) = 0; - virtual VclPtr<VclAbstractDialog> CreateSwTableWidthDlg(weld::Window *pParent, SwTableFUNC &rFnc) = 0; + virtual VclPtr<AbstractSwTableWidthDlg> CreateSwTableWidthDlg(weld::Window *pParent, SwTableFUNC &rFnc) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateSwTableTabDlg(weld::Window* pParent, const SfxItemSet* pItemSet, SwWrtShell* pSh) = 0; diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 412e3682a910..8676ec08a8d2 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -144,7 +144,13 @@ bool AbstractSplitTableDialog_Impl::StartExecuteAsync(AsyncContext &rCtx) short AbstractSwTableWidthDlg_Impl::Execute() { - return m_xDlg->run(); + assert(false); + return -1; +} + +bool AbstractSwTableWidthDlg_Impl::StartExecuteAsync(AsyncContext &rCtx) +{ + return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); } short AbstractSwTableHeightDlg_Impl::Execute() @@ -1136,7 +1142,7 @@ VclPtr<SfxAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwWrapDlg(weld::Wi return VclPtr<SwAbstractSfxController_Impl>::Create(std::make_unique<SwWrapDlg>(pParent, rSet, pSh, true/*bDrawMode*/)); } -VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwTableWidthDlg(weld::Window *pParent, SwTableFUNC &rFnc) +VclPtr<AbstractSwTableWidthDlg> SwAbstractDialogFactory_Impl::CreateSwTableWidthDlg(weld::Window *pParent, SwTableFUNC &rFnc) { return VclPtr<AbstractSwTableWidthDlg_Impl>::Create(std::make_unique<SwTableWidthDlg>(pParent, rFnc)); } diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index ac79f2652ddc..2fd0b0b70183 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -256,15 +256,17 @@ public: virtual std::optional<SwLanguageListItem> GetSelectedLanguage() override; }; -class AbstractSwTableWidthDlg_Impl : public VclAbstractDialog +class AbstractSwTableWidthDlg_Impl : public AbstractSwTableWidthDlg { - std::unique_ptr<SwTableWidthDlg> m_xDlg; + std::shared_ptr<SwTableWidthDlg> m_xDlg; public: - explicit AbstractSwTableWidthDlg_Impl(std::unique_ptr<SwTableWidthDlg> p) + explicit AbstractSwTableWidthDlg_Impl(std::shared_ptr<SwTableWidthDlg> p) : m_xDlg(std::move(p)) { } virtual short Execute() override; + virtual bool StartExecuteAsync(AsyncContext &rCtx) override; + virtual void Apply() override { m_xDlg->Apply(); } }; class AbstractSwTableHeightDlg_Impl : public VclAbstractDialog @@ -795,7 +797,7 @@ public: virtual VclPtr<SfxAbstractDialog> CreateSwBorderDlg(weld::Window* pParent, SfxItemSet& rSet, SwBorderModes nType) override; virtual VclPtr<SfxAbstractDialog> CreateSwWrapDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pSh) override; - virtual VclPtr<VclAbstractDialog> CreateSwTableWidthDlg(weld::Window *pParent, SwTableFUNC &rFnc) override; + virtual VclPtr<AbstractSwTableWidthDlg> CreateSwTableWidthDlg(weld::Window *pParent, SwTableFUNC &rFnc) override; virtual VclPtr<SfxAbstractTabDialog> CreateSwTableTabDlg(weld::Window* pParent, const SfxItemSet* pItemSet, SwWrtShell* pSh) override; virtual VclPtr<AbstractSwFieldDlg> CreateSwFieldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, weld::Window *pParent) override; diff --git a/sw/source/ui/table/colwd.cxx b/sw/source/ui/table/colwd.cxx index 2440d8696fac..70e47e19c9ed 100644 --- a/sw/source/ui/table/colwd.cxx +++ b/sw/source/ui/table/colwd.cxx @@ -64,12 +64,4 @@ void SwTableWidthDlg::Apply() o3tl::narrowing<sal_uInt16>(m_xWidthMF->denormalize(m_xWidthMF->get_value(FieldUnit::TWIP)))); } -short SwTableWidthDlg::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/table/tablemgr.cxx b/sw/source/uibase/table/tablemgr.cxx index 8df92dae563b..852d9d5585f2 100644 --- a/sw/source/uibase/table/tablemgr.cxx +++ b/sw/source/uibase/table/tablemgr.cxx @@ -50,8 +50,15 @@ void SwTableFUNC::ColWidthDlg(weld::Window *pParent) { InitTabCols(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwTableWidthDlg(pParent, *this)); - pDlg->Execute(); + VclPtr<AbstractSwTableWidthDlg> pDlg(pFact->CreateSwTableWidthDlg(pParent, *this)); + pDlg->StartExecuteAsync( + [pDlg] (sal_Int32 nResult)->void + { + if (nResult == RET_OK) + pDlg->Apply(); + pDlg->disposeOnce(); + } + ); } // Determine the width commit 93c4bfc96acf7f387120ff05883068d358a608c1 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Jan 25 10:29:47 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jan 30 17:08:11 2024 +0100 make writer databases dialog async Change-Id: I9f3c3bc3c555ef8a115258ff6d186ceeead3cc99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162556 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 2392fa46edc6..e0ad91cd52b1 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -821,18 +821,23 @@ void AbstractPasswordToOpenModifyDialog_Impl::AllowEmpty() // Create dialogs with simplest interface VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateVclDialog(weld::Window* pParent, sal_uInt32 nResId) { - std::unique_ptr<OfaTreeOptionsDialog> xDlg; switch ( nResId ) { - case SID_OPTIONS_TREEDIALOG : case SID_OPTIONS_DATABASES : + { + Reference< frame::XFrame > xFrame; + auto xDlg = std::make_shared<OfaTreeOptionsDialog>(pParent, xFrame, /*bActivateLastSelection*/false); + xDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS); + return VclPtr<CuiAbstractControllerAsync_Impl>::Create(std::move(xDlg)); + } + case SID_OPTIONS_TREEDIALOG : case SID_LANGUAGE_OPTIONS : { bool bActivateLastSelection = false; if (nResId == SID_OPTIONS_TREEDIALOG) bActivateLastSelection = true; Reference< frame::XFrame > xFrame; - xDlg = std::make_unique<OfaTreeOptionsDialog>(pParent, xFrame, bActivateLastSelection); + auto xDlg = std::make_unique<OfaTreeOptionsDialog>(pParent, xFrame, bActivateLastSelection); if (nResId == SID_OPTIONS_DATABASES) { xDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS); @@ -842,15 +847,14 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateVclDialog(weld::Wind //open the tab page "tools/options/languages" xDlg->ActivatePage(OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE); } + return VclPtr<CuiAbstractController_Impl>::Create(std::move(xDlg)); } break; + default: - break; + assert(false); + return nullptr; } - - if (xDlg) - return VclPtr<CuiAbstractController_Impl>::Create(std::move(xDlg)); - return nullptr; } VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateFrameDialog(weld::Window* pParent, const Reference< frame::XFrame >& rxFrame, diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 37402849c4fa..6c9a17967344 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -3048,8 +3048,13 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) if (RET_OK == xWarning->run()) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( nullptr, SID_OPTIONS_DATABASES )); - pDlg->Execute(); + VclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( nullptr, SID_OPTIONS_DATABASES )); + pDlg->StartExecuteAsync( + [pDlg] (sal_Int32 /*nResult*/)->void + { + pDlg->disposeOnce(); + } + ); } return ; }