summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-05-14 12:41:09 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2019-05-15 19:04:22 +0200
commitcdaa535937a645345b91c90fbebae344c811e741 (patch)
treea0c9f33bc83529ef6dad6ec789b981bbb07b61c9 /comphelper
parentda284440060f69d43399277a3d2596140675545c (diff)
Resolves: tdf#120423 dispatch against the correct Frame
Change-Id: I5ea2e5d7b79efbd2b14d0b528e5a5c3e44e643bc Reviewed-on: https://gerrit.libreoffice.org/72292 Reviewed-by: Michael Stahl <Michael.Stahl@cib.de> Tested-by: Jenkins
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/dispatchcommand.cxx28
1 files changed, 17 insertions, 11 deletions
diff --git a/comphelper/source/misc/dispatchcommand.cxx b/comphelper/source/misc/dispatchcommand.cxx
index 90d181d2e0e4..0b5d3b18a65a 100644
--- a/comphelper/source/misc/dispatchcommand.cxx
+++ b/comphelper/source/misc/dispatchcommand.cxx
@@ -31,22 +31,15 @@ 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 uno::Reference<css::frame::XFrame>& rFrame, 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();
- uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(xContext);
-
- uno::Reference<frame::XFrame> xFrame(xDesktop->getActiveFrame());
- if (!xFrame.is())
- xFrame.set(xDesktop, uno::UNO_QUERY);
-
- uno::Reference<frame::XDispatchProvider> xDispatchProvider(xFrame, uno::UNO_QUERY);
+ uno::Reference<frame::XDispatchProvider> xDispatchProvider(rFrame, uno::UNO_QUERY);
if (!xDispatchProvider.is())
return false;
util::URL aCommandURL;
aCommandURL.Complete = rCommand;
+ uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
uno::Reference<util::XURLTransformer> xParser = util::URLTransformer::create(xContext);
xParser->parseStrict(aCommandURL);
@@ -57,13 +50,26 @@ bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::bea
// And do the work...
uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, uno::UNO_QUERY);
if (xNotifyingDisp.is())
- xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, aListener);
+ xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, rListener);
else
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)
+{
+ // Target where we will execute the .uno: command
+ uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+ uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(xContext);
+
+ uno::Reference<frame::XFrame> xFrame(xDesktop->getActiveFrame());
+ if (!xFrame.is())
+ xFrame.set(xDesktop, uno::UNO_QUERY);
+
+ return dispatchCommand(rCommand, xFrame, rArguments, rListener);
+}
+
} // namespace comphelper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */