sd/source/ui/func/funavig.cxx |   30 +++++++++++++++++++++++++-----
 sd/source/ui/inc/funavig.hxx  |    2 ++
 2 files changed, 27 insertions(+), 5 deletions(-)

New commits:
commit 1beb32521948a735f2ef7aad991edf97f9fbd39f
Author:     Hubert Figuière <[email protected]>
AuthorDate: Wed Jul 16 13:07:01 2025 -0400
Commit:     Miklos Vajna <[email protected]>
CommitDate: Mon Jul 28 09:25:53 2025 +0200

    sd: Make the GotoPage dialog async
    
    Signed-off-by: Hubert Figuière <[email protected]>
    Change-Id: I2a4a8d204f448de961ca0bcd76928e49c280167a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187972
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188047
    Tested-by: Jenkins

diff --git a/sd/source/ui/func/funavig.cxx b/sd/source/ui/func/funavig.cxx
index ccb2e74660e4..20642205398e 100644
--- a/sd/source/ui/func/funavig.cxx
+++ b/sd/source/ui/func/funavig.cxx
@@ -159,15 +159,35 @@ void FuNavigation::DoExecute( SfxRequest& rReq )
                         sTitle = SdResId(STR_GOTO_SLIDE_DLG_TITLE);
                         sLabel = SdResId(STR_SLIDE_NAME) + ":";
                     }
-                    svx::GotoPageDlg aDlg(pDrawViewShell->GetFrameWeld(), 
sTitle, sLabel,
-                         pDrawViewShell->GetCurPagePos() + 1,
-                         mrDoc.GetSdPageCount(PageKind::Standard));
-                    if (aDlg.run() == RET_OK)
-                        pDrawViewShell->SwitchPage(aDlg.GetPageSelection() - 
1);
+                    std::shared_ptr<SfxRequest> xRequest = 
std::make_shared<SfxRequest>(rReq);
+                    rReq.Ignore(); // the 'old' request is not relevant any 
more
+
+                    auto xDialog = 
std::make_shared<svx::GotoPageDlg>(pDrawViewShell->GetFrameWeld(), sTitle, 
sLabel,
+                        pDrawViewShell->GetCurPagePos() + 1,
+                        mrDoc.GetSdPageCount(PageKind::Standard));
+
+                    rtl::Reference<FuNavigation> xThis( this ); // avoid 
destruction within async processing
+                    weld::DialogController::runAsync(xDialog, [xDialog, 
xRequest, xThis](sal_uInt32 nResult) {
+                        if (nResult == RET_OK)
+                        {
+                            auto pDrawViewShell2 = dynamic_cast<DrawViewShell 
*>(&xThis->mrViewShell);
+                            
pDrawViewShell2->SwitchPage(xDialog->GetPageSelection() - 1);
+                        }
+                        xThis->Finish();
+                        xRequest->Done();
+                    });
+
+                    return;
                 }
         }
         break;
     }
+
+    Finish();
+}
+
+void FuNavigation::Finish()
+{
     // Refresh toolbar icons
     SfxBindings& rBindings = mrViewShell.GetViewFrame()->GetBindings();
     rBindings.Invalidate(SID_GO_TO_FIRST_PAGE);
diff --git a/sd/source/ui/inc/funavig.hxx b/sd/source/ui/inc/funavig.hxx
index 66496abbd866..313118f4eb3d 100644
--- a/sd/source/ui/inc/funavig.hxx
+++ b/sd/source/ui/inc/funavig.hxx
@@ -39,6 +39,8 @@ private:
         ::sd::View* pView,
         SdDrawDocument& rDoc,
         SfxRequest& rReq);
+
+    void Finish();
 };
 
 } // end of namespace sd

Reply via email to