[Libreoffice-commits] core.git: cui/source sfx2/source
Henry Castro (via logerrit)
logerrit at kemper.freedesktop.org
Fri Dec 18 17:22:20 UTC 2020
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 4ea3ec3d3aaa304b9769c2d5c7556529cc4df9ff
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Dec 4 17:34:48 2020 -0400
Commit: Henry Castro <hcastro at collabora.com>
CommitDate: Fri Dec 18 18:21:37 2020 +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 <hcastro at collabora.com>
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 778e2940ba1d..f694f26fd6bc 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 e43b027602c4..d10914440db5 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -145,6 +145,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();
@@ -1113,7 +1118,7 @@ void AbstractDialogFactory_Impl::ShowAsyncScriptErrorDialog(weld::Window* pParen
VclPtr<AbstractScriptSelectorDialog> AbstractDialogFactory_Impl::CreateScriptSelectorDialog(weld::Window* pParent,
const Reference<frame::XFrame>& rxFrame)
{
- return VclPtr<AbstractScriptSelectorDialog_Impl>::Create(std::make_unique<SvxScriptSelectorDialog>(pParent, rxFrame));
+ return VclPtr<AbstractScriptSelectorDialog_Impl>::Create(std::make_shared<SvxScriptSelectorDialog>(pParent, rxFrame));
}
OUString AbstractScriptSelectorDialog_Impl::GetScriptURL() const
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index a9d521708f5d..87ad9730b307 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -283,13 +283,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 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();
More information about the Libreoffice-commits
mailing list