23#include <com/sun/star/frame/DispatchResultState.hpp>
24#include <com/sun/star/task/XJobExecutor.hpp>
25#include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 return "com.sun.star.comp.framework.ServiceHandler";
85 css::uno::Reference< css::frame::XDispatch > xDispatcher;
94css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL
ServiceHandler::queryDispatches(
const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor )
96 sal_Int32
nCount = lDescriptor.getLength();
97 css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatcher(
nCount );
98 auto lDispatcherRange = asNonConstRange(lDispatcher);
102 lDescriptor[
i].FeatureURL,
103 lDescriptor[
i].FrameName,
104 lDescriptor[
i].SearchFlags);
120 const css::uno::Sequence< css::beans::PropertyValue >& )
124 css::uno::Reference< css::frame::XNotifyingDispatch > xSelfHold(
this);
142 const css::uno::Sequence< css::beans::PropertyValue >& ,
143 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener )
148 css::uno::Reference< css::frame::XNotifyingDispatch > xThis(
this);
153 css::frame::DispatchResultEvent
aEvent;
155 aEvent.State = css::frame::DispatchResultState::SUCCESS;
157 aEvent.State = css::frame::DispatchResultState::FAILURE;
158 aEvent.Result <<= xService;
161 xListener->dispatchFinished(
aEvent );
186 sal_Int32 nArgStart = sServiceAndArguments.indexOf(
'?');
191 sArguments = sServiceAndArguments.copy(nArgStart);
199 return css::uno::Reference< css::uno::XInterface >();
205 css::uno::Reference< css::uno::XInterface > xService;
211 css::uno::Reference< css::task::XJobExecutor > xExecutable(xService, css::uno::UNO_QUERY);
212 if (xExecutable.is())
213 xExecutable->trigger(sArguments);
218 catch(
const css::uno::Exception&)
239 const css::util::URL& )
245 const css::util::URL& )
253extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
255 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& )
constexpr OUStringLiteral sServiceName
protocol handler for "service:*" URLs @descr It's a special dispatch/provider object which is registe...
virtual void SAL_CALL dispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &lArguments) override
dispatch URL with arguments @descr We use threadsafe internal method to do so.
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
virtual OUString SAL_CALL getImplementationName() override
virtual ~ServiceHandler() override
standard dtor
css::uno::Reference< css::uno::XComponentContext > m_xContext
reference to global uno service manager which had created us
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xListener, const css::util::URL &aURL) override
virtual void SAL_CALL dispatchWithNotification(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &lArguments, const css::uno::Reference< css::frame::XDispatchResultListener > &xListener) override
dispatch with guaranteed notifications about success @descr We use threadsafe internal method to do s...
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xListener, const css::util::URL &aURL) override
add/remove listener for state events @descr We use an internal container to hold such registered list...
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor > &lDescriptor) override
do the same like dispatch() but for multiple requests at the same time
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL &aURL, const OUString &sTarget, sal_Int32 nFlags) override
decide if this dispatch implementation can be used for requested URL or not @descr A protocol handler...
ServiceHandler(css::uno::Reference< css::uno::XComponentContext >)
standard ctor @descr This initializes a new instance of this class with needed information for work.
css::uno::Reference< css::uno::XInterface > implts_dispatch(const css::util::URL &aURL)
threadsafe helper for dispatch calls @descr We support two interfaces for the same process - dispatch...
#define TOOLS_WARN_EXCEPTION(area, stream)
css::uno::Reference< css::uno::XComponentContext > m_xContext
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr OUStringLiteral PROTOCOL_VALUE
constexpr OUStringLiteral SERVICENAME_PROTOCOLHANDLER
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * framework_ServiceHandler_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)