From 71a99887adaa404adbf156e5894fe520b755248c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 22 Jan 2024 14:39:00 +0200 Subject: make object name dialog async MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Icf81810297dc5767cedd051cf8ccdfbb101f35ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162395 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167361 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl --- sd/source/ui/view/drviews2.cxx | 30 +++++++++++++++++------------- sd/source/ui/view/drviewsc.cxx | 3 +-- 2 files changed, 18 insertions(+), 15 deletions(-) (limited to 'sd') diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 0847df373f44..e327a9e0e949 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -2662,25 +2662,29 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) OUString aName(pSelected->GetName()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr pDlg(pFact->CreateSvxObjectNameDialog(GetFrameWeld(), aName)); + VclPtr pDlg(pFact->CreateSvxObjectNameDialog(GetFrameWeld(), aName)); pDlg->SetCheckNameHdl(LINK(this, DrawViewShell, NameObjectHdl)); - if(RET_OK == pDlg->Execute()) - { - pDlg->GetName(aName); - pSelected->SetName(aName); + pDlg->StartExecuteAsync( + [this, pDlg, pSelected] (sal_Int32 nResult)->void + { + if (nResult == RET_OK) + { + pSelected->SetName(pDlg->GetName()); - SdPage* pPage = GetActualPage(); - if (pPage) - pPage->notifyObjectRenamed(pSelected); - } + SdPage* pPage = GetActualPage(); + if (pPage) + pPage->notifyObjectRenamed(pSelected); + } + pDlg->disposeOnce(); + SfxBindings& rBindings = GetViewFrame()->GetBindings(); + rBindings.Invalidate( SID_NAVIGATOR_STATE, true ); + rBindings.Invalidate( SID_CONTEXT ); + } + ); } - SfxBindings& rBindings = GetViewFrame()->GetBindings(); - rBindings.Invalidate( SID_NAVIGATOR_STATE, true ); - rBindings.Invalidate( SID_CONTEXT ); - Cancel(); rReq.Ignore(); break; diff --git a/sd/source/ui/view/drviewsc.cxx b/sd/source/ui/view/drviewsc.cxx index 6be86e63cb8d..46ecb31d639b 100644 --- a/sd/source/ui/view/drviewsc.cxx +++ b/sd/source/ui/view/drviewsc.cxx @@ -62,8 +62,7 @@ void DrawViewShell::UpdateIMapDlg( SdrObject* pObj ) IMPL_LINK( DrawViewShell, NameObjectHdl, AbstractSvxObjectNameDialog&, rDialog, bool ) { - OUString aName; - rDialog.GetName( aName ); + OUString aName = rDialog.GetName(); return aName.isEmpty() || ( GetDoc() && !GetDoc()->GetObj( aName ) ); } -- cgit