cid#1607171 Data race condition
[LibreOffice.git] / framework / inc / dispatch / oxt_handler.hxx
blob09b80ea8caba6e77bcfdff3891edaf9bebc6591c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
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>
30 #include <cppuhelper/implbase.hxx>
31 #include <mutex>
33 namespace framework{
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.
43 @devstatus ready
44 @threadsafe yes
45 *//*-*************************************************************************************************************/
46 class Oxt_Handler final : public ::cppu::WeakImplHelper<
47 css::lang::XServiceInfo,
48 css::frame::XNotifyingDispatch, // => XDispatch
49 css::document::XExtendedFilterDetection >
52 public:
54 Oxt_Handler( css::uno::Reference< css::uno::XComponentContext > );
55 virtual ~Oxt_Handler( ) override;
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;
62 // XNotifyingDispatch
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;
68 // XDispatch
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 {};
78 // XExtendedFilterDetection
79 virtual OUString SAL_CALL detect ( css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ) override;
81 private:
82 std::mutex m_mutex;
84 css::uno::Reference< css::uno::XComponentContext > m_xContext; /// global uno service factory to create new services
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */