sc/inc/scabstdlg.hxx               |    2 +-
 sc/source/ui/attrdlg/scdlgfact.cxx |    5 +++++
 sc/source/ui/attrdlg/scdlgfact.hxx |    3 ++-
 sc/source/ui/view/cellsh2.cxx      |   25 +++++++++++++++++--------
 vcl/jsdialog/enabled.cxx           |    1 +
 5 files changed, 26 insertions(+), 10 deletions(-)

New commits:
commit 7e93e2721f200940547a23814eccc2348e1d6adf
Author:     Rashesh <rashesh.pa...@collabora.com>
AuthorDate: Fri Aug 30 11:41:42 2024 +0530
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Sep 9 15:16:22 2024 +0200

    sc: make SelectRange dialog async
    
    Change-Id: Id1ac622d7a2f15d432fa122b87217c0bfa9a39a6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172626
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Gökay ŞATIR <gokaysa...@collabora.com>
    (cherry picked from commit 832eee15118babf772f19a820ef88603fb6e5ccd)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173066
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index efd9c27c2ba0..158501225a58 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -473,7 +473,7 @@ public:
     virtual VclPtr<AbstractScInsertTableDlg> 
CreateScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData,
         SCTAB nTabCount, bool bFromFile) = 0;
 
-    virtual VclPtr<AbstractScSelEntryDlg > CreateScSelEntryDlg(weld::Window* 
pParent, const std::vector<OUString> &rEntryList) = 0;
+    virtual VclPtr<AbstractScSelEntryDlg> CreateScSelEntryDlg(weld::Window* 
pParent, const std::vector<OUString> &rEntryList) = 0;
     virtual VclPtr<AbstractScLinkedAreaDlg> 
CreateScLinkedAreaDlg(weld::Widget* pParent) = 0;
 
     virtual VclPtr<AbstractScMetricInputDlg> 
CreateScMetricInputDlg(weld::Window* pParent,
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx 
b/sc/source/ui/attrdlg/scdlgfact.cxx
index 34aae130fd0e..47e81dc7c09f 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -1065,6 +1065,11 @@ const SfxItemSet* 
ScAsyncTabController_Impl::GetOutputItemSet() const
     return m_xDlg->GetOutputItemSet();
 }
 
+bool 
AbstractScSelEntryDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext 
&rCtx)
+{
+    return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 // =========================Factories  for createdialog ===================
 VclPtr<AbstractScImportAsciiDlg> 
ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg(weld::Window* pParent,
                                                     const OUString& aDatName,
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx 
b/sc/source/ui/attrdlg/scdlgfact.hxx
index 588fd758fcf0..0f8077240a73 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -320,13 +320,14 @@ public:
 
 class AbstractScSelEntryDlg_Impl : public AbstractScSelEntryDlg
 {
-    std::unique_ptr<ScSelEntryDlg> m_xDlg;
+    std::shared_ptr<ScSelEntryDlg> m_xDlg;
 public:
     explicit AbstractScSelEntryDlg_Impl(std::unique_ptr<ScSelEntryDlg> p)
         : m_xDlg(std::move(p))
     {
     }
     virtual short    Execute() override;
+    virtual bool StartExecuteAsync(AsyncContext& rCtx) override;
     virtual OUString GetSelectedEntry() const override;
 };
 
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index a1580b8958cc..0323ca8c219f 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -766,14 +766,23 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
 
                         ScAbstractDialogFactory* pFact = 
ScAbstractDialogFactory::Create();
 
-                        ScopedVclPtr<AbstractScSelEntryDlg> 
pDlg(pFact->CreateScSelEntryDlg(pTabViewShell->GetFrameWeld(), aList));
-                        if ( pDlg->Execute() == RET_OK )
-                        {
-                            OUString aName = pDlg->GetSelectedEntry();
-                            pTabViewShell->GotoDBArea( aName );
-                            rReq.AppendItem( SfxStringItem( SID_SELECT_DB, 
aName ) );
-                            rReq.Done();
-                        }
+                        VclPtr<AbstractScSelEntryDlg> pDlg(
+                            
pFact->CreateScSelEntryDlg(pTabViewShell->GetFrameWeld(), aList));
+                        pDlg->StartExecuteAsync(
+                            [pTabViewShell, pDlg](sal_Int32 nResult)
+                            {
+                                if (nResult == RET_OK)
+                                {
+                                    OUString aName = pDlg->GetSelectedEntry();
+                                    pTabViewShell->GotoDBArea(aName);
+                                    SfxRequest 
aRequest(pTabViewShell->GetViewFrame(),
+                                                        SID_SELECT_DB);
+                                    
aRequest.AppendItem(SfxStringItem(SID_SELECT_DB, aName));
+                                    aRequest.Done();
+                                }
+
+                                pDlg->disposeOnce();
+                            });
                     }
                 }
             }
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 07e2919fc4e9..25305d5b412d 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -154,6 +154,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
         || rUIFile == u"modules/scalc/ui/warnautocorrect.ui"
         || rUIFile == u"modules/scalc/ui/ztestdialog.ui"
         || rUIFile == u"modules/scalc/ui/definedatabaserangedialog.ui"
+        || rUIFile == u"modules/scalc/ui/selectrange.ui"
         // schart
         || rUIFile == u"modules/schart/ui/attributedialog.ui"
         || rUIFile == u"modules/schart/ui/charttypedialog.ui"

Reply via email to