diff options
author | Henry Castro <hcastro@collabora.com> | 2020-12-04 17:34:48 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2020-12-18 18:21:37 +0100 |
commit | 4ea3ec3d3aaa304b9769c2d5c7556529cc4df9ff (patch) | |
tree | f512fc2607ab375e1fbb256664488f60d0ea40f2 /sfx2 | |
parent | ca839b341883c1238f27ba42236f08ebb49d53a4 (diff) |
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 <hcastro@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index ab441f70b7f5..7452faff296a 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1453,32 +1453,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(); |