diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-05-14 12:41:09 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-05-14 17:11:56 +0200 |
commit | 430b3f4db745dfe08b989745e340e0503dd0ac34 (patch) | |
tree | 8c66cfd8fa3c9e90786d1e14f38cc84a05b2f7a3 /comphelper | |
parent | f264b2ffc4f8cad28cfe852ddba63f30293e321c (diff) |
Resolves: tdf#120423 dispatch against the correct Frame
Change-Id: I5ea2e5d7b79efbd2b14d0b528e5a5c3e44e643bc
Reviewed-on: https://gerrit.libreoffice.org/72284
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/dispatchcommand.cxx | 28 |
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: */ |