Kaydet (Commit) e928e529 authored tarafından Ashod Nakashian's avatar Ashod Nakashian Kaydeden (comit) Ashod Nakashian

comphelper: use dispatchwithNotification only when we have a callback

Change-Id: Ica7448458ecc5e9adc802a288f72b1fceb709f79
Reviewed-on: https://gerrit.libreoffice.org/70724Reviewed-by: 's avatarAshod Nakashian <ashnakash@gmail.com>
Tested-by: 's avatarAshod Nakashian <ashnakash@gmail.com>
üst 5db99266
...@@ -30,8 +30,9 @@ ...@@ -30,8 +30,9 @@
using namespace css; using namespace css;
namespace comphelper { namespace comphelper {
bool dispatchCommand(const OUString& rCommand,
bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArguments, const uno::Reference<css::frame::XDispatchResultListener>& aListener) const css::uno::Sequence<css::beans::PropertyValue>& rArguments,
const uno::Reference<css::frame::XDispatchResultListener>& aListener)
{ {
// Target where we will execute the .uno: command // Target where we will execute the .uno: command
uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
...@@ -55,11 +56,17 @@ bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::bea ...@@ -55,11 +56,17 @@ bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::bea
return false; return false;
// And do the work... // And do the work...
uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, uno::UNO_QUERY); if (aListener.is())
if (xNotifyingDisp.is()) {
xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, aListener); uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, uno::UNO_QUERY);
else if (xNotifyingDisp.is())
xDisp->dispatch(aCommandURL, rArguments); {
xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, aListener);
return true;
}
}
xDisp->dispatch(aCommandURL, rArguments);
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment