comphelper/source/misc/dispatchcommand.cxx |   28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

New commits:
commit 52162c94dedb3babc05a917810b48e1e76d4ece5
Author:     Ashod Nakashian <[email protected]>
AuthorDate: Sat Apr 13 21:40:20 2019 -0400
Commit:     Ashod Nakashian <[email protected]>
CommitDate: Thu Dec 26 03:37:12 2019 +0100

    comphelper: use dispatchwithNotification only when we have a callback
    
    Reviewed-on: https://gerrit.libreoffice.org/70724
    Reviewed-by: Ashod Nakashian <[email protected]>
    Tested-by: Ashod Nakashian <[email protected]>
    (cherry picked from commit e928e5295db7e11d8f8773076cf122b4d16ec9f2)
    
    Change-Id: Ica7448458ecc5e9adc802a288f72b1fceb709f79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85799
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Ashod Nakashian <[email protected]>

diff --git a/comphelper/source/misc/dispatchcommand.cxx 
b/comphelper/source/misc/dispatchcommand.cxx
index 0b5d3b18a65a..403b8ad01beb 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 
uno::Reference<css::frame::XFrame>& rFrame, const 
css::uno::Sequence<css::beans::PropertyValue>& rArguments, const 
uno::Reference<css::frame::XDispatchResultListener>& rListener)
+bool dispatchCommand(const OUString& rCommand, const 
uno::Reference<css::frame::XFrame>& rFrame,
+                     const css::uno::Sequence<css::beans::PropertyValue>& 
rArguments,
+                     const 
uno::Reference<css::frame::XDispatchResultListener>& rListener)
 {
     uno::Reference<frame::XDispatchProvider> xDispatchProvider(rFrame, 
uno::UNO_QUERY);
     if (!xDispatchProvider.is())
@@ -43,21 +44,30 @@ bool dispatchCommand(const OUString& rCommand, const 
uno::Reference<css::frame::
     uno::Reference<util::XURLTransformer> xParser = 
util::URLTransformer::create(xContext);
     xParser->parseStrict(aCommandURL);
 
-    uno::Reference<frame::XDispatch> xDisp = 
xDispatchProvider->queryDispatch(aCommandURL, OUString(), 0);
+    uno::Reference<frame::XDispatch> xDisp
+        = xDispatchProvider->queryDispatch(aCommandURL, OUString(), 0);
     if (!xDisp.is())
         return false;
 
     // And do the work...
-    uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, 
uno::UNO_QUERY);
-    if (xNotifyingDisp.is())
-        xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, 
rListener);
-    else
-        xDisp->dispatch(aCommandURL, rArguments);
+    if (rListener.is())
+    {
+        uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, 
uno::UNO_QUERY);
+        if (xNotifyingDisp.is())
+        {
+            xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, 
rListener);
+            return true;
+        }
+    }
+
+    xDisp->dispatch(aCommandURL, rArguments);
 
     return true;
 }
 
-bool dispatchCommand(const OUString& rCommand, const 
css::uno::Sequence<css::beans::PropertyValue>& rArguments, const 
uno::Reference<css::frame::XDispatchResultListener>& rListener)
+bool dispatchCommand(const OUString& rCommand,
+                     const css::uno::Sequence<css::beans::PropertyValue>& 
rArguments,
+                     const 
uno::Reference<css::frame::XDispatchResultListener>& rListener)
 {
     // Target where we will execute the .uno: command
     uno::Reference<uno::XComponentContext> xContext = 
::comphelper::getProcessComponentContext();
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to