cui/source/factory/dlgfact.cxx      |    2 +-
 cui/source/factory/dlgfact.hxx      |    2 +-
 sc/source/ui/view/tabvwshb.cxx      |   18 ++++++++++++------
 sd/source/ui/func/fulink.cxx        |   12 +++++++++---
 sw/source/uibase/shells/textfld.cxx |    9 +++++++--
 sw/source/uibase/uiview/view2.cxx   |    9 +++++++--
 6 files changed, 37 insertions(+), 15 deletions(-)

New commits:
commit 6cece4bf4147fb1cedd7011b3487fd64ff6dbeba
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Jan 22 15:06:54 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jan 23 12:58:42 2024 +0100

    make links dialog async
    
    Change-Id: I067d682ade01671d7aa347a492929ae4f92064b2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162421
    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 42c9d35e8a47..f30ba3115851 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -111,7 +111,7 @@ IMPL_ABSTDLG_CLASS(AbstractGalleryIdDialog)
 IMPL_ABSTDLG_CLASS(AbstractGraphicFilterDialog)
 IMPL_ABSTDLG_CLASS(AbstractHangulHanjaConversionDialog)
 IMPL_ABSTDLG_CLASS(AbstractInsertObjectDialog)
-IMPL_ABSTDLG_CLASS(AbstractLinksDialog)
+IMPL_ABSTDLG_CLASS_ASYNC(AbstractLinksDialog, SvBaseLinksDlg)
 IMPL_ABSTDLG_CLASS(AbstractScreenshotAnnotationDlg)
 IMPL_ABSTDLG_CLASS(AbstractSignatureLineDialog)
 IMPL_ABSTDLG_CLASS_ASYNC(AbstractSignSignatureLineDialog, 
SignSignatureLineDialog)
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index be1af746c182..c2fc4ebf3a4f 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -360,7 +360,7 @@ 
DECL_ABSTDLG_CLASS_SHARED_ASYNC(AbstractPasteDialog,SfxAbstractPasteDialog,SvPas
 };
 
 // AbstractLinksDialog_Impl
-DECL_ABSTDLG_CLASS_UNIQUE(AbstractLinksDialog,SfxAbstractLinksDialog,SvBaseLinksDlg)
+DECL_ABSTDLG_CLASS_SHARED_ASYNC(AbstractLinksDialog,SfxAbstractLinksDialog,SvBaseLinksDlg)
 };
 
 // AbstractSvxPostItDialog_Impl
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index 683ca26afca2..1db954039a36 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -365,7 +365,6 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
 
     MakeDrawLayer();
 
-    SfxBindings& rBindings = GetViewFrame().GetBindings();
     ScTabView*   pTabView  = GetViewData().GetView();
     vcl::Window*      pWin      = pTabView->GetActiveWin();
     ScDrawView*  pView     = pTabView->GetScDrawView();
@@ -505,11 +504,18 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
                     break;
                 }
 
-                ScopedVclPtr<SfxAbstractLinksDialog> 
pDlg(pFact->CreateLinksDialog(pWin->GetFrameWeld(), rDoc.GetLinkManager()));
-                pDlg->Execute();
-                rBindings.Invalidate( nSlot );
-                SfxGetpApp()->Broadcast( SfxHint( 
SfxHintId::ScAreaLinksChanged ) );     // Navigator
-                rReq.Done();
+                VclPtr<SfxAbstractLinksDialog> 
pDlg(pFact->CreateLinksDialog(pWin->GetFrameWeld(), rDoc.GetLinkManager()));
+                auto xRequest = std::make_shared<SfxRequest>(rReq);
+                rReq.Ignore(); // the 'old' request is not relevant any more
+                pDlg->StartExecuteAsync(
+                    [this, pDlg, xRequest] (sal_Int32 /*nResult*/)->void
+                    {
+                        GetViewFrame().GetBindings().Invalidate( SID_LINKS );
+                        SfxGetpApp()->Broadcast( SfxHint( 
SfxHintId::ScAreaLinksChanged ) );     // Navigator
+                        pDlg->disposeOnce();
+                        xRequest->Done();
+                    }
+                );
             }
             break;
 
diff --git a/sd/source/ui/func/fulink.cxx b/sd/source/ui/func/fulink.cxx
index 32b3b70ad880..4ad4d2feaaf5 100644
--- a/sd/source/ui/func/fulink.cxx
+++ b/sd/source/ui/func/fulink.cxx
@@ -68,9 +68,15 @@ void FuLink::DoExecute( SfxRequest& )
     sfx2::LinkManager* pLinkManager = mpDoc->GetLinkManager();
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-    ScopedVclPtr<SfxAbstractLinksDialog> 
pDlg(pFact->CreateLinksDialog(mpViewShell->GetFrameWeld(), pLinkManager));
-    pDlg->Execute();
-    mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_MANAGE_LINKS );
+    VclPtr<SfxAbstractLinksDialog> 
pDlg(pFact->CreateLinksDialog(mpViewShell->GetFrameWeld(), pLinkManager));
+    auto pViewShell = mpViewShell;
+    pDlg->StartExecuteAsync(
+        [pDlg, pViewShell] (sal_Int32 /*nResult*/)->void
+        {
+            pViewShell->GetViewFrame()->GetBindings().Invalidate( 
SID_MANAGE_LINKS );
+            pDlg->disposeOnce();
+        }
+    );
 }
 
 } // end of namespace sd
diff --git a/sw/source/uibase/shells/textfld.cxx 
b/sw/source/uibase/shells/textfld.cxx
index 68561d8b8ded..ac28d14bd079 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -151,8 +151,13 @@ void SwTextShell::ExecField(SfxRequest &rReq)
                             }
 
                             SvxAbstractDialogFactory* pFact = 
SvxAbstractDialogFactory::Create();
-                            ScopedVclPtr<SfxAbstractLinksDialog> 
pDlg(pFact->CreateLinksDialog(GetView().GetFrameWeld(), &rSh.GetLinkManager(), 
false, &rLink));
-                            pDlg->Execute();
+                            VclPtr<SfxAbstractLinksDialog> 
pDlg(pFact->CreateLinksDialog(GetView().GetFrameWeld(), &rSh.GetLinkManager(), 
false, &rLink));
+                            pDlg->StartExecuteAsync(
+                                [pDlg] (sal_Int32 /*nResult*/)->void
+                                {
+                                    pDlg->disposeOnce();
+                                }
+                            );
                         }
                         break;
                     }
diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index 1006f5b493ff..37402849c4fa 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -2477,8 +2477,13 @@ void SwView::EditLinkDlg()
 
     bool bWeb = dynamic_cast<SwWebView*>( this ) !=  nullptr;
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-    ScopedVclPtr<SfxAbstractLinksDialog> 
pDlg(pFact->CreateLinksDialog(GetViewFrame().GetFrameWeld(), 
&GetWrtShell().GetLinkManager(), bWeb));
-    pDlg->Execute();
+    VclPtr<SfxAbstractLinksDialog> 
pDlg(pFact->CreateLinksDialog(GetViewFrame().GetFrameWeld(), 
&GetWrtShell().GetLinkManager(), bWeb));
+    pDlg->StartExecuteAsync(
+        [pDlg] (sal_Int32 /*nResult*/)->void
+        {
+            pDlg->disposeOnce();
+        }
+    );
 }
 
 namespace sw {

Reply via email to