LibreOffice Module framework (master) 1
servicehandler.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <com/sun/star/frame/XNotifyingDispatch.hpp>
23#include <com/sun/star/frame/XDispatch.hpp>
24#include <com/sun/star/frame/XDispatchProvider.hpp>
25#include <com/sun/star/util/URL.hpp>
26#include <com/sun/star/beans/PropertyValue.hpp>
27#include <com/sun/star/frame/XStatusListener.hpp>
28#include <com/sun/star/lang/XServiceInfo.hpp>
29#include <com/sun/star/uno/XComponentContext.hpp>
30
32
33namespace framework{
34
49class ServiceHandler final : public ::cppu::WeakImplHelper<
50 css::lang::XServiceInfo ,
51 css::frame::XDispatchProvider ,
52 css::frame::XNotifyingDispatch > // => XDispatch
53{
54 /* member */
55 private:
56
58 css::uno::Reference< css::uno::XComponentContext > m_xContext;
59
60 /* interface */
61 public:
62
63 // ctor/dtor
64 ServiceHandler( css::uno::Reference< css::uno::XComponentContext > );
65 virtual ~ServiceHandler( ) override;
66
67 /* interface XServiceInfo */
68 virtual OUString SAL_CALL getImplementationName() override;
69 virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
70 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
71
72 // XDispatchProvider
73 virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL ,
74 const OUString& sTarget ,
75 sal_Int32 nFlags ) override;
76 virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) override;
77
78 // XNotifyingDispatch
79 virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL ,
80 const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
81 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) override;
82
83 // XDispatch
84 virtual void SAL_CALL dispatch ( const css::util::URL& aURL ,
85 const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) override;
86 virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener ,
87 const css::util::URL& aURL ) override;
88 virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener ,
89 const css::util::URL& aURL ) override;
90
91 /* internal */
92 private:
94 css::uno::Reference< css::uno::XInterface > implts_dispatch( const css::util::URL& aURL );
95
96}; // class ServiceHandler
97
98} // namespace framework
99
100/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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...
unsigned char sal_Bool