cui/source/customize/cfgutil.cxx | 1 + cui/source/factory/dlgfact.cxx | 7 ++++++- cui/source/factory/dlgfact.hxx | 5 +++-- sfx2/source/appl/appserv.cxx | 39 ++++++++++++++++++++++----------------- 4 files changed, 32 insertions(+), 20 deletions(-)
New commits: commit 3557bb2a5cb2119dba7d84bdd723c5887e64c2d0 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Fri Dec 4 17:34:48 2020 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Mon Jan 18 22:06:56 2021 +0100 lok: run async the Macro Selector Dialog Required to be called by the client side Change-Id: I9c9d22dd249839009bdc6a701553f3b9d776347a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107246 Tested-by: Jenkins Reviewed-by: Henry Castro <hcas...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109137 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index 1d94255e73eb..a980d4b7fa3f 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -42,6 +42,7 @@ #include <sfx2/minfitem.hxx> #include <comphelper/SetFlagContextHelper.hxx> #include <comphelper/documentinfo.hxx> +#include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/sequenceashashmap.hxx> #include <svtools/imagemgr.hxx> diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index be6351d04b8b..f8399d259071 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -148,6 +148,11 @@ short AbstractTitleDialog_Impl::Execute() return m_xDlg->run(); } +bool AbstractScriptSelectorDialog_Impl::StartExecuteAsync(AsyncContext &rCtx) +{ + return SfxDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + short AbstractScriptSelectorDialog_Impl::Execute() { return m_xDlg->run(); @@ -1132,7 +1137,7 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateScriptErrorDialog(co VclPtr<AbstractScriptSelectorDialog> AbstractDialogFactory_Impl::CreateScriptSelectorDialog(weld::Window* pParent, const Reference<frame::XFrame>& rxFrame) { - return VclPtr<AbstractScriptSelectorDialog_Impl>::Create(std::make_unique<SvxScriptSelectorDialog>(pParent, false/*bShowSlots*/, rxFrame)); + return VclPtr<AbstractScriptSelectorDialog_Impl>::Create(std::make_shared<SvxScriptSelectorDialog>(pParent, false/*bShowSlots*/, rxFrame)); } OUString AbstractScriptSelectorDialog_Impl::GetScriptURL() const diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 27566e6a7224..08a78ef42d57 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -313,13 +313,14 @@ public: class SvxScriptSelectorDialog; class AbstractScriptSelectorDialog_Impl : public AbstractScriptSelectorDialog { - std::unique_ptr<SvxScriptSelectorDialog> m_xDlg; + std::shared_ptr<SvxScriptSelectorDialog> m_xDlg; public: - explicit AbstractScriptSelectorDialog_Impl(std::unique_ptr<SvxScriptSelectorDialog> p) + explicit AbstractScriptSelectorDialog_Impl(std::shared_ptr<SvxScriptSelectorDialog> p) : m_xDlg(std::move(p)) { } virtual short Execute() override; + virtual bool StartExecuteAsync(AsyncContext &rCtx) override; virtual OUString GetScriptURL() const override; virtual void SetRunLabel() override; }; diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 0633c12df3e7..07f56777b5af 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1535,32 +1535,37 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) do // artificial loop for flow control { - ScopedVclPtr<AbstractScriptSelectorDialog> pDlg(pFact->CreateScriptSelectorDialog(lcl_getDialogParent(xFrame), xFrame)); + VclPtr<AbstractScriptSelectorDialog> pDlg(pFact->CreateScriptSelectorDialog(lcl_getDialogParent(xFrame), xFrame)); OSL_ENSURE( pDlg, "SfxApplication::OfaExec_Impl( SID_RUNMACRO ): no dialog!" ); if ( !pDlg ) break; pDlg->SetRunLabel(); - short nDialogResult = pDlg->Execute(); - if ( !nDialogResult ) - break; + pDlg->StartExecuteAsync([pDlg, xFrame](sal_Int32 nDialogResult) { + if ( !nDialogResult ) + { + pDlg->disposeOnce(); + return; + } - Sequence< Any > args; - Sequence< sal_Int16 > outIndex; - Sequence< Any > outArgs; - Any ret; + Sequence< Any > args; + Sequence< sal_Int16 > outIndex; + Sequence< Any > outArgs; + Any ret; - Reference< XInterface > xScriptContext; + Reference< XInterface > xScriptContext; - Reference< XController > xController; - if ( xFrame.is() ) - xController = xFrame->getController(); - if ( xController.is() ) - xScriptContext = xController->getModel(); - if ( !xScriptContext.is() ) - xScriptContext = xController; + Reference< XController > xController; + if ( xFrame.is() ) + xController = xFrame->getController(); + if ( xController.is() ) + xScriptContext = xController->getModel(); + if ( !xScriptContext.is() ) + xScriptContext = xController; - SfxObjectShell::CallXScript( xScriptContext, pDlg->GetScriptURL(), args, ret, outIndex, outArgs ); + SfxObjectShell::CallXScript( xScriptContext, pDlg->GetScriptURL(), args, ret, outIndex, outArgs ); + pDlg->disposeOnce(); + }); } while ( false ); rReq.Done(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits