LibreOffice Module framework (master) 1
oxt_handler.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/XStatusListener.hpp>
24#include <com/sun/star/document/XExtendedFilterDetection.hpp>
25#include <com/sun/star/beans/PropertyValue.hpp>
26#include <com/sun/star/util/URL.hpp>
27#include <com/sun/star/lang/XServiceInfo.hpp>
28#include <com/sun/star/uno/XComponentContext.hpp>
29
31#include <mutex>
32
33namespace framework{
34
35/*-************************************************************************************************************
36 @short handler to detect and play sounds ("wav" and "au" only!)
37 @descr Register this implementation as a content handler to detect and/or play wav- and au-sounds.
38 It doesn't depend from the target platform. But one instance of this class
39 can play one sound at the same time only. Means every new dispatch request will stop the
40 might still running one. So we support one operation/one URL/one listener at the same time
41 only.
42
43 @devstatus ready
44 @threadsafe yes
45*//*-*************************************************************************************************************/
46class Oxt_Handler final : public ::cppu::WeakImplHelper<
47 css::lang::XServiceInfo,
48 css::frame::XNotifyingDispatch, // => XDispatch
49 css::document::XExtendedFilterDetection >
50{
51
52 public:
53
54 Oxt_Handler( css::uno::Reference< css::uno::XComponentContext > );
55 virtual ~Oxt_Handler( ) override;
56
57 /* interface XServiceInfo */
58 virtual OUString SAL_CALL getImplementationName() override;
59 virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
60 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
61
62 // XNotifyingDispatch
63
64 virtual void SAL_CALL dispatchWithNotification(const css::util::URL& aURL ,
65 const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
66 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) override;
67
68 // XDispatch
69
70 virtual void SAL_CALL dispatch ( const css::util::URL& aURL ,
71 const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) override;
72 // not supported !
73 virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/ ,
74 const css::util::URL& /*aURL*/ ) override {};
75 virtual void SAL_CALL removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/ ,
76 const css::util::URL& /*aURL*/ ) override {};
77
78 // XExtendedFilterDetection
79 virtual OUString SAL_CALL detect ( css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ) override;
80
81 private:
82 std::mutex m_mutex;
83
84 css::uno::Reference< css::uno::XComponentContext > m_xContext;
85
86};
87
88}
89
90/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral sServiceName
virtual OUString SAL_CALL detect(css::uno::Sequence< css::beans::PropertyValue > &lDescriptor) override
virtual OUString SAL_CALL getImplementationName() override
Definition: oxt_handler.cxx:33
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
Definition: oxt_handler.cxx:91
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > &, const css::util::URL &) override
Definition: oxt_handler.hxx:73
Oxt_Handler(css::uno::Reference< css::uno::XComponentContext >)
Definition: oxt_handler.cxx:59
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: oxt_handler.cxx:43
virtual void SAL_CALL dispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &lArguments) override
virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > &, const css::util::URL &) override
Definition: oxt_handler.hxx:75
virtual ~Oxt_Handler() override
Definition: oxt_handler.cxx:67
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: oxt_handler.hxx:84
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Definition: oxt_handler.cxx:38
URL aURL
unsigned char sal_Bool