23#include <com/sun/star/frame/Desktop.hpp>
24#include <com/sun/star/frame/XDispatch.hpp>
25#include <com/sun/star/frame/XDispatchProvider.hpp>
26#include <com/sun/star/frame/XNotifyingDispatch.hpp>
27#include <com/sun/star/util/URL.hpp>
28#include <com/sun/star/util/URLTransformer.hpp>
34bool 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)
36 uno::Reference<frame::XDispatchProvider> xDispatchProvider(rFrame, uno::UNO_QUERY);
37 if (!xDispatchProvider.is())
40 util::URL aCommandURL;
41 aCommandURL.Complete = rCommand;
43 uno::Reference<util::XURLTransformer> xParser = util::URLTransformer::create(xContext);
44 xParser->parseStrict(aCommandURL);
46 uno::Reference<frame::XDispatch> xDisp = xDispatchProvider->queryDispatch(aCommandURL, OUString(), 0);
53 uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, uno::UNO_QUERY);
54 if (xNotifyingDisp.is())
56 xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, rListener);
61 xDisp->dispatch(aCommandURL, rArguments);
66bool dispatchCommand(
const OUString& rCommand,
const css::uno::Sequence<css::beans::PropertyValue>& rArguments,
const uno::Reference<css::frame::XDispatchResultListener>& rListener)
70 uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(xContext);
72 uno::Reference<frame::XFrame>
xFrame(xDesktop->getActiveFrame());
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)
Reference< XComponentContext > getProcessComponentContext()
This function gets the process service factory's default component context.
Reference< XFrame > xFrame