cui/source/dialogs/cuicharmap.cxx | 6 +++++- cui/source/factory/dlgfact.cxx | 6 ++++++ cui/source/factory/dlgfact.hxx | 2 +- include/cui/cuicharmap.hxx | 4 ++++ sw/source/uibase/shells/textsh.cxx | 6 ++++-- 5 files changed, 20 insertions(+), 4 deletions(-)
New commits: commit a42d9a713c3fd42aae22bae4fe2b1ee7eaefe592 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Jul 10 09:45:24 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Jul 10 12:54:45 2024 +0200 make writer insert special character async Change-Id: I5fc13e759eb8f1d1e6ab7c09f39cabc1d4c4ad7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170273 Reviewed-by: Michael Meeks <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx index 0d0b809b0e7f..8f16e95c18b3 100644 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -116,7 +116,7 @@ SvxCharacterMap::SvxCharacterMap(weld::Widget* pParent, const SfxItemSet* pSet, m_xSearchSet->Hide(); } -short SvxCharacterMap::run() +void SvxCharacterMap::prepForRun() { if( SvxShowCharSet::getSelectedChar() == ' ') { @@ -133,7 +133,11 @@ short SvxCharacterMap::run() setFavButtonState(aOUStr, m_aShowChar.GetFont().GetFamilyName()); m_xOKBtn->set_sensitive(true); } +} +short SvxCharacterMap::run() +{ + prepForRun(); return SfxDialogController::run(); } diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 62d50eb96d85..ea607d489c88 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -164,6 +164,12 @@ void AbstractSvxCharacterMapDialog_Impl::SetText(const OUString& rStr) m_xDlg->set_title(rStr); } +bool AbstractSvxCharacterMapDialog_Impl::StartExecuteAsync(AsyncContext &rCtx) +{ + m_xDlg->prepForRun(); + return SvxCharacterMap::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + void CuiAbstractTabController_Impl::SetCurPageId( const OUString &rName ) { m_xDlg->SetCurPageId( rName ); diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 3ffba25bebae..f08837ba00e5 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -394,7 +394,7 @@ DECL_ABSTDLG_CLASS_SHARED_ASYNC(AbstractPasswordToOpenModifyDialog,AbstractPassw }; // AbstractSvxCharacterMapDialog_Impl -DECL_ABSTDLG_CLASS_UNIQUE(AbstractSvxCharacterMapDialog,SfxAbstractDialog,SvxCharacterMap) +DECL_ABSTDLG_CLASS_SHARED_ASYNC(AbstractSvxCharacterMapDialog,SfxAbstractDialog,SvxCharacterMap) virtual const SfxItemSet* GetOutputItemSet() const override; virtual void SetText(const OUString& rStr) override; }; diff --git a/include/cui/cuicharmap.hxx b/include/cui/cuicharmap.hxx index b2d4ac23c425..8eada5e94965 100644 --- a/include/cui/cuicharmap.hxx +++ b/include/cui/cuicharmap.hxx @@ -137,6 +137,10 @@ private: public: SvxCharacterMap(weld::Widget* pParent, const SfxItemSet* pSet, css::uno::Reference<css::frame::XFrame> xFrame); + + // for explicit use before AsyncRun + void prepForRun(); + virtual short run() override; void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); } diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 29242d99463b..38a39151b8c8 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -1013,8 +1013,10 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); auto xFrame = GetView().GetViewFrame().GetFrame().GetFrameInterface(); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetView().GetFrameWeld(), aAllSet, xFrame)); - pDlg->Execute(); + VclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetView().GetFrameWeld(), aAllSet, xFrame)); + pDlg->StartExecuteAsync([=](sal_Int32 /*nResult*/){ + pDlg->disposeOnce(); + }); return; }
