tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / avmedia / source / framework / soundhandler.hxx
bloba143fcb87eaaa7ec8a90dedfe9cdd6845ad582e8
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/lang/XTypeProvider.hpp>
23 #include <com/sun/star/frame/XNotifyingDispatch.hpp>
24 #include <com/sun/star/frame/XStatusListener.hpp>
25 #include <com/sun/star/document/XExtendedFilterDetection.hpp>
26 #include <com/sun/star/media/XPlayer.hpp>
27 #include <com/sun/star/beans/PropertyValue.hpp>
28 #include <com/sun/star/util/URL.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <comphelper/compbase.hxx>
33 #include <cppuhelper/basemutex.hxx>
34 #include <cppuhelper/weak.hxx>
36 #include <vcl/timer.hxx>
37 #include <vcl/idle.hxx>
38 #include <tools/link.hxx>
40 namespace avmedia{
42 /*-************************************************************************************************************
43 @short handler to detect and play sounds ("wav" and "au" only!)
44 @descr Register this implementation as a content handler to detect and/or play wav- and au-sounds.
45 It doesn't depend from the target platform. But one instance of this class
46 can play one sound at the same time only. Means every new dispatch request will stop the
47 might still running one. So we support one operation/one URL/one listener at the same time
48 only.
50 @devstatus ready
51 @threadsafe yes
52 *//*-*************************************************************************************************************/
53 class SoundHandler : public comphelper::WeakImplHelper<css::lang::XServiceInfo,
54 css::frame::XNotifyingDispatch, // => XDispatch
55 css::document::XExtendedFilterDetection>
57 // public methods
58 public:
60 // constructor / destructor
61 SoundHandler();
62 virtual ~SoundHandler( ) override;
64 // XServiceInfo
65 virtual OUString SAL_CALL getImplementationName ( ) override;
66 virtual sal_Bool SAL_CALL supportsService ( const OUString& sServiceName ) override;
67 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames ( ) override;
69 // XNotifyingDispatch
70 virtual void SAL_CALL dispatchWithNotification(const css::util::URL& aURL ,
71 const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
72 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) override;
74 // XDispatch
75 virtual void SAL_CALL dispatch ( const css::util::URL& aURL ,
76 const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) override;
77 // not supported !
78 virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/ ,
79 const css::util::URL& /*aURL*/ ) override {};
80 virtual void SAL_CALL removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/ ,
81 const css::util::URL& /*aURL*/ ) override {};
83 // XExtendedFilterDetection
84 virtual OUString SAL_CALL detect ( css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ) override;
86 // protected methods
87 protected:
89 // private methods
90 private:
91 DECL_LINK( implts_PlayerNotify, Timer*, void );
93 // variables
94 // (should be private everyway!)
95 private:
97 bool m_bError;
98 css::uno::Reference< css::uno::XInterface > m_xSelfHold ; // we must protect us against dying during async(!) dispatch() call!
99 css::uno::Reference< css::media::XPlayer > m_xPlayer ; // uses avmedia player to play sounds...
101 css::uno::Reference< css::frame::XDispatchResultListener > m_xListener ;
102 Idle m_aUpdateIdle;
104 }; // class SoundHandler
106 } // namespace avmedia
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */