summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-11-03 13:20:06 +0100
committerJan Holesovsky <kendy@collabora.com>2015-11-03 13:25:23 +0100
commit8c987fababbddb6e4f81b0cd717b59b9a9ff9be0 (patch)
tree269bb73e21a8afebd8ea916d1280d8f858a571bc /comphelper
parentc0f37892a24b202c0a28836ed1046c90c7631e03 (diff)
lok: Introduce LOK_CALLBACK_UNO_COMMAND_RESULT callback.
Posting of the .uno:Something commands is asynchronous. To be able to find out when eg. .uno:Save finished, this commit introduces a callback that fires when that happens. To be able to receive such a notification, the appropriate postUnoCommand() must be called with 'true' as the parameter for bNotifyWhenFinished (defaults to 'false'). Change-Id: I254939ebc8ea5f309ae39686dcaaeddd5148b0c9
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/dispatchcommand.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/comphelper/source/misc/dispatchcommand.cxx b/comphelper/source/misc/dispatchcommand.cxx
index 160c08a930c7..04cc2d78c73c 100644
--- a/comphelper/source/misc/dispatchcommand.cxx
+++ b/comphelper/source/misc/dispatchcommand.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
@@ -30,7 +31,7 @@ using namespace css;
namespace comphelper {
-bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
+bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArguments, uno::Reference<css::frame::XDispatchResultListener> aListener)
{
// Target where we will execute the .uno: command
uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
@@ -54,7 +55,11 @@ bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::bea
return false;
// And do the work...
- xDisp->dispatch(aCommandURL, rArguments);
+ uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, uno::UNO_QUERY);
+ if (xNotifyingDisp.is())
+ xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, aListener);
+ else
+ xNotifyingDisp->dispatch(aCommandURL, rArguments);
return true;
}