namespace sfx2
{ // Helper that executes the dialog according to the call mode defined in the passed request: // synchronously or asynchronously. User-provided callback endDialogFn(sal_Int32, SfxRequest&) // is called, and the result of the dialog execution is passed to it, along with the request, to // set the necessary return values. After endDialogFn exits, the dialog is disposed. Intended // for use in request handlers. template <class Fn>
requires(std::is_invocable_v<Fn, sal_Int32, SfxRequest&>) void ExecDialogPerRequestAndDispose( const VclPtr<VclAbstractDialog>& dlg, SfxRequest& req, const Fn& endDialogFn)
{ if (req.GetCallMode() & SfxCallMode::SYNCHRON)
{
endDialogFn(dlg->Execute(), req);
dlg->disposeOnce();
} else
{
dlg->StartExecuteAsync(
[ dlg, endDialogFn, pRequest = std::make_shared<SfxRequest>(req) ](sal_Int32 result) {
endDialogFn(result, *pRequest);
dlg->disposeOnce();
});
req.Ignore();
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.