LCOV - code coverage report
Current view: top level - libreoffice/avmedia/source/framework - soundhandler.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 5 0.0 %
Date: 2012-12-27 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef __FRAMEWORK_HANDLER_SOUNDHANDLER_HXX_
      21             : #define __FRAMEWORK_HANDLER_SOUNDHANDLER_HXX_
      22             : 
      23             : #include <com/sun/star/lang/XTypeProvider.hpp>
      24             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      25             : #include <com/sun/star/frame/XNotifyingDispatch.hpp>
      26             : #include <com/sun/star/frame/XStatusListener.hpp>
      27             : #include <com/sun/star/frame/XFrame.hpp>
      28             : #include <com/sun/star/document/XExtendedFilterDetection.hpp>
      29             : #include <com/sun/star/media/XPlayer.hpp>
      30             : #include <com/sun/star/beans/PropertyValue.hpp>
      31             : #include <com/sun/star/util/URL.hpp>
      32             : 
      33             : #include <com/sun/star/lang/XServiceInfo.hpp>
      34             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      35             : 
      36             : #include <cppuhelper/weak.hxx>
      37             : 
      38             : #include <vcl/timer.hxx>
      39             : #include <tools/link.hxx>
      40             : #include <avmedia/mediawindow.hxx>
      41             : #include <osl/mutex.hxx>
      42             : 
      43             : namespace avmedia{
      44             : 
      45           0 : struct ThreadHelpBase
      46             : {
      47             :     public:
      48             :         mutable ::osl::Mutex m_aLock;
      49             : };
      50             : 
      51             : /*-************************************************************************************************************//**
      52             :     @short          handler to detect and play sounds ("wav" and "au" only!)
      53             :     @descr          Register this implementation as a content handler to detect and/or play wav- and au-sounds.
      54             :                     It doesn't depend from the target platform. But one instance of this class
      55             :                     can play one sound at the same time only. Means every new dispatch request will stop the
      56             :                     might still running one. So we support one operation/one URL/one listener at the same time
      57             :                     only.
      58             : 
      59             :     @devstatus      ready
      60             :     @threadsafe     yes
      61             : *//*-*************************************************************************************************************/
      62             : class SoundHandler  :   // interfaces
      63             :                         public  css::lang::XTypeProvider
      64             :                     ,   public  css::lang::XServiceInfo
      65             :                     ,   public  css::frame::XNotifyingDispatch // => XDispatch
      66             :                     ,   public  css::document::XExtendedFilterDetection
      67             :                         // baseclasses
      68             :                         // Order is neccessary for right initialization!
      69             :                     ,   private ThreadHelpBase
      70             :                     ,   public  ::cppu::OWeakObject
      71             : {
      72             :     //-------------------------------------------------------------------------------------------------------------
      73             :     //  public methods
      74             :     //-------------------------------------------------------------------------------------------------------------
      75             :     public:
      76             : 
      77             :         //---------------------------------------------------------------------------------------------------------
      78             :         //  constructor / destructor
      79             :         //---------------------------------------------------------------------------------------------------------
      80             :                  SoundHandler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
      81             :         virtual ~SoundHandler(                                                                        );
      82             : 
      83             :         //---------------------------------------------------------------------------------------------------------
      84             :         //  XInterface, XTypeProvider, XServiceInfo
      85             :         //---------------------------------------------------------------------------------------------------------
      86             :         virtual css::uno::Any  SAL_CALL queryInterface( const css::uno::Type& aType   ) throw( css::uno::RuntimeException );
      87             :         virtual void SAL_CALL acquire() throw();
      88             :         virtual void SAL_CALL release() throw();
      89             :         virtual css::uno::Sequence< css::uno::Type >  SAL_CALL getTypes () throw( css::uno::RuntimeException );
      90             :         virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( css::uno::RuntimeException );
      91             : 
      92             :     /* interface XServiceInfo */
      93             :        virtual OUString                                               SAL_CALL getImplementationName              (                                                                               ) throw( css::uno::RuntimeException );
      94             :        virtual sal_Bool                                               SAL_CALL supportsService                    ( const OUString&                                               sServiceName    ) throw( css::uno::RuntimeException );
      95             :        virtual css::uno::Sequence< OUString >                         SAL_CALL getSupportedServiceNames           (                                                                               ) throw( css::uno::RuntimeException );
      96             :     /* Helper for XServiceInfo */
      97             :        static css::uno::Sequence< OUString >                          SAL_CALL impl_getStaticSupportedServiceNames(                                                                               );
      98             :        static OUString                                                SAL_CALL impl_getStaticImplementationName   (                                                                               );
      99             :     /* Helper for registry */
     100             :        static css::uno::Reference< css::uno::XInterface >             SAL_CALL impl_createInstance                ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception );
     101             :        static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory                 ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
     102             :     /* Helper for initialization of service by using own reference! */
     103             :        virtual void                                                   SAL_CALL impl_initService                   (                                                                               );
     104             : 
     105             :         //---------------------------------------------------------------------------------------------------------
     106             :         //  XNotifyingDispatch
     107             :         //---------------------------------------------------------------------------------------------------------
     108             :         virtual void SAL_CALL dispatchWithNotification(const css::util::URL&                                             aURL      ,
     109             :                                                        const css::uno::Sequence< css::beans::PropertyValue >&            lArguments,
     110             :                                                        const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw(css::uno::RuntimeException);
     111             : 
     112             :         //---------------------------------------------------------------------------------------------------------
     113             :         //  XDispatch
     114             :         //---------------------------------------------------------------------------------------------------------
     115             :         virtual void SAL_CALL dispatch              (   const   css::util::URL&                                     aURL        ,
     116             :                                                         const   css::uno::Sequence< css::beans::PropertyValue >&    lArguments  ) throw( css::uno::RuntimeException );
     117             :         // not supported !
     118           0 :         virtual void SAL_CALL addStatusListener     (   const   css::uno::Reference< css::frame::XStatusListener >& /*xListener*/   ,
     119           0 :                                                         const   css::util::URL&                                     /*aURL*/        ) throw( css::uno::RuntimeException ) {};
     120           0 :         virtual void SAL_CALL removeStatusListener  (   const   css::uno::Reference< css::frame::XStatusListener >& /*xListener*/   ,
     121           0 :                                                         const   css::util::URL&                                     /*aURL*/        ) throw( css::uno::RuntimeException ) {};
     122             : 
     123             :         //---------------------------------------------------------------------------------------------------------
     124             :         //  XExtendedFilterDetection
     125             :         //---------------------------------------------------------------------------------------------------------
     126             :         virtual OUString SAL_CALL detect           (           css::uno::Sequence< css::beans::PropertyValue >&    lDescriptor ) throw( css::uno::RuntimeException );
     127             : 
     128             :     //-------------------------------------------------------------------------------------------------------------
     129             :     //  protected methods
     130             :     //-------------------------------------------------------------------------------------------------------------
     131             :     protected:
     132             : 
     133             :     //-------------------------------------------------------------------------------------------------------------
     134             :     //  private methods
     135             :     //-------------------------------------------------------------------------------------------------------------
     136             :     private:
     137             :         DECL_LINK( implts_PlayerNotify, void* );
     138             : 
     139             :     //-------------------------------------------------------------------------------------------------------------
     140             :     //  variables
     141             :     //  (should be private everyway!)
     142             :     //-------------------------------------------------------------------------------------------------------------
     143             :     private:
     144             : 
     145             :         bool m_bError;
     146             :         css::uno::Reference< css::lang::XMultiServiceFactory >     m_xFactory          ;   /// global uno service factory to create new services
     147             :         css::uno::Reference< css::uno::XInterface >                m_xSelfHold         ;   /// we must protect us against dieing during async(!) dispatch() call!
     148             :         css::uno::Reference< css::media::XPlayer >                 m_xPlayer           ;   /// uses avmedia player to play sounds ...
     149             : 
     150             :         css::uno::Reference< css::frame::XDispatchResultListener > m_xListener         ;
     151             :         Timer m_aUpdateTimer;
     152             : 
     153             : };      //  class SoundHandler
     154             : 
     155             : }       //  namespace avmedia
     156             : 
     157             : #endif  //  #ifndef __FRAMEWORK_HANDLER_SOUNDHANDLER_HXX_
     158             : 
     159             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10