[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - comphelper/source

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 15 00:42:18 UTC 2019


 comphelper/source/misc/dispatchcommand.cxx |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

New commits:
commit e928e5295db7e11d8f8773076cf122b4d16ec9f2
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Apr 13 21:40:20 2019 -0400
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Mon Apr 15 02:41:41 2019 +0200

    comphelper: use dispatchwithNotification only when we have a callback
    
    Change-Id: Ica7448458ecc5e9adc802a288f72b1fceb709f79
    Reviewed-on: https://gerrit.libreoffice.org/70724
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/comphelper/source/misc/dispatchcommand.cxx b/comphelper/source/misc/dispatchcommand.cxx
index 90d181d2e0e4..73b778c53a4b 100644
--- a/comphelper/source/misc/dispatchcommand.cxx
+++ b/comphelper/source/misc/dispatchcommand.cxx
@@ -30,8 +30,9 @@
 using namespace css;
 
 namespace comphelper {
-
-bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArguments, const uno::Reference<css::frame::XDispatchResultListener>& aListener)
+bool dispatchCommand(const OUString& rCommand,
+                     const css::uno::Sequence<css::beans::PropertyValue>& rArguments,
+                     const uno::Reference<css::frame::XDispatchResultListener>& aListener)
 {
     // Target where we will execute the .uno: command
     uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
@@ -55,11 +56,17 @@ bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::bea
         return false;
 
     // And do the work...
-    uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, uno::UNO_QUERY);
-    if (xNotifyingDisp.is())
-        xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, aListener);
-    else
-        xDisp->dispatch(aCommandURL, rArguments);
+    if (aListener.is())
+    {
+        uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, uno::UNO_QUERY);
+        if (xNotifyingDisp.is())
+        {
+            xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, aListener);
+            return true;
+        }
+    }
+
+    xDisp->dispatch(aCommandURL, rArguments);
 
     return true;
 }


More information about the Libreoffice-commits mailing list