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 832eee15118babf772f19a820ef88603fb6e5ccd
Author:     Rashesh <rashesh.pa...@collabora.com>
AuthorDate: Fri Aug 30 11:41:42 2024 +0530
Commit:     Gökay ŞATIR <gokaysa...@collabora.com>
CommitDate: Mon Sep 2 12:36:23 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>

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 93541ca1dcea..bb758f4729a5 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -471,7 +471,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 22f13d19bbf0..438a4e2856e3 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -1040,6 +1040,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 eaa6eefb1378..9de4a2535a32 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -317,13 +317,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 71bcd6cac315..b2fdf0ba411b 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -753,14 +753,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 2718d458ee17..8be77d39673d 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