LCOV - code coverage report
Current view: top level - avmedia/source/framework - soundhandler.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 5 20.0 %
Date: 2012-08-25 Functions: 2 4 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef __FRAMEWORK_HANDLER_SOUNDHANDLER_HXX_
      30                 :            : #define __FRAMEWORK_HANDLER_SOUNDHANDLER_HXX_
      31                 :            : 
      32                 :            : #include <com/sun/star/lang/XTypeProvider.hpp>
      33                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      34                 :            : #include <com/sun/star/frame/XNotifyingDispatch.hpp>
      35                 :            : #include <com/sun/star/frame/XStatusListener.hpp>
      36                 :            : #include <com/sun/star/frame/XFrame.hpp>
      37                 :            : #include <com/sun/star/document/XExtendedFilterDetection.hpp>
      38                 :            : #include <com/sun/star/media/XPlayer.hpp>
      39                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      40                 :            : #include <com/sun/star/util/URL.hpp>
      41                 :            : 
      42                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      43                 :            : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      44                 :            : 
      45                 :            : #include <cppuhelper/weak.hxx>
      46                 :            : 
      47                 :            : #include <vcl/timer.hxx>
      48                 :            : #include <tools/link.hxx>
      49                 :            : #include <avmedia/mediawindow.hxx>
      50                 :            : #include <osl/mutex.hxx>
      51                 :            : 
      52                 :            : namespace css = ::com::sun::star;
      53                 :            : 
      54                 :            : namespace avmedia{
      55                 :            : 
      56                 :         24 : struct ThreadHelpBase
      57                 :            : {
      58                 :            :     public:
      59                 :            :         mutable ::osl::Mutex m_aLock;
      60                 :            : };
      61                 :            : 
      62                 :            : /*-************************************************************************************************************//**
      63                 :            :     @short          handler to detect and play sounds ("wav" and "au" only!)
      64                 :            :     @descr          Register this implementation as a content handler to detect and/or play wav- and au-sounds.
      65                 :            :                     It doesn't depend from the target platform. But one instance of this class
      66                 :            :                     can play one sound at the same time only. Means every new dispatch request will stop the
      67                 :            :                     might still running one. So we support one operation/one URL/one listener at the same time
      68                 :            :                     only.
      69                 :            : 
      70                 :            :     @devstatus      ready
      71                 :            :     @threadsafe     yes
      72                 :            : *//*-*************************************************************************************************************/
      73                 :            : class SoundHandler  :   // interfaces
      74                 :            :                         public  css::lang::XTypeProvider
      75                 :            :                     ,   public  css::lang::XServiceInfo
      76                 :            :                     ,   public  css::frame::XNotifyingDispatch // => XDispatch
      77                 :            :                     ,   public  css::document::XExtendedFilterDetection
      78                 :            :                         // baseclasses
      79                 :            :                         // Order is neccessary for right initialization!
      80                 :            :                     ,   private ThreadHelpBase
      81                 :            :                     ,   public  ::cppu::OWeakObject
      82                 :            : {
      83                 :            :     //-------------------------------------------------------------------------------------------------------------
      84                 :            :     //  public methods
      85                 :            :     //-------------------------------------------------------------------------------------------------------------
      86                 :            :     public:
      87                 :            : 
      88                 :            :         //---------------------------------------------------------------------------------------------------------
      89                 :            :         //  constructor / destructor
      90                 :            :         //---------------------------------------------------------------------------------------------------------
      91                 :            :                  SoundHandler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
      92                 :            :         virtual ~SoundHandler(                                                                        );
      93                 :            : 
      94                 :            :         //---------------------------------------------------------------------------------------------------------
      95                 :            :         //  XInterface, XTypeProvider, XServiceInfo
      96                 :            :         //---------------------------------------------------------------------------------------------------------
      97                 :            :         virtual css::uno::Any  SAL_CALL queryInterface( const css::uno::Type& aType   ) throw( css::uno::RuntimeException );
      98                 :            :         virtual void SAL_CALL acquire() throw();
      99                 :            :         virtual void SAL_CALL release() throw();
     100                 :            :         virtual css::uno::Sequence< css::uno::Type >  SAL_CALL getTypes () throw( css::uno::RuntimeException );
     101                 :            :         virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( css::uno::RuntimeException );
     102                 :            : 
     103                 :            :     /* interface XServiceInfo */
     104                 :            :        virtual ::rtl::OUString                                        SAL_CALL getImplementationName              (                                                                               ) throw( css::uno::RuntimeException );
     105                 :            :        virtual sal_Bool                                               SAL_CALL supportsService                    ( const ::rtl::OUString&                                        sServiceName    ) throw( css::uno::RuntimeException );
     106                 :            :        virtual css::uno::Sequence< ::rtl::OUString >                  SAL_CALL getSupportedServiceNames           (                                                                               ) throw( css::uno::RuntimeException );
     107                 :            :     /* Helper for XServiceInfo */
     108                 :            :        static css::uno::Sequence< ::rtl::OUString >                   SAL_CALL impl_getStaticSupportedServiceNames(                                                                               );
     109                 :            :        static ::rtl::OUString                                         SAL_CALL impl_getStaticImplementationName   (                                                                               );
     110                 :            :     /* Helper for registry */
     111                 :            :        static css::uno::Reference< css::uno::XInterface >             SAL_CALL impl_createInstance                ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception );
     112                 :            :        static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory                 ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
     113                 :            :     /* Helper for initialization of service by using own reference! */
     114                 :            :        virtual void                                                   SAL_CALL impl_initService                   (                                                                               );
     115                 :            : 
     116                 :            :         //---------------------------------------------------------------------------------------------------------
     117                 :            :         //  XNotifyingDispatch
     118                 :            :         //---------------------------------------------------------------------------------------------------------
     119                 :            :         virtual void SAL_CALL dispatchWithNotification(const css::util::URL&                                             aURL      ,
     120                 :            :                                                        const css::uno::Sequence< css::beans::PropertyValue >&            lArguments,
     121                 :            :                                                        const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw(css::uno::RuntimeException);
     122                 :            : 
     123                 :            :         //---------------------------------------------------------------------------------------------------------
     124                 :            :         //  XDispatch
     125                 :            :         //---------------------------------------------------------------------------------------------------------
     126                 :            :         virtual void SAL_CALL dispatch              (   const   css::util::URL&                                     aURL        ,
     127                 :            :                                                         const   css::uno::Sequence< css::beans::PropertyValue >&    lArguments  ) throw( css::uno::RuntimeException );
     128                 :            :         // not supported !
     129                 :          0 :         virtual void SAL_CALL addStatusListener     (   const   css::uno::Reference< css::frame::XStatusListener >& /*xListener*/   ,
     130                 :          0 :                                                         const   css::util::URL&                                     /*aURL*/        ) throw( css::uno::RuntimeException ) {};
     131                 :          0 :         virtual void SAL_CALL removeStatusListener  (   const   css::uno::Reference< css::frame::XStatusListener >& /*xListener*/   ,
     132                 :          0 :                                                         const   css::util::URL&                                     /*aURL*/        ) throw( css::uno::RuntimeException ) {};
     133                 :            : 
     134                 :            :         //---------------------------------------------------------------------------------------------------------
     135                 :            :         //  XExtendedFilterDetection
     136                 :            :         //---------------------------------------------------------------------------------------------------------
     137                 :            :         virtual ::rtl::OUString SAL_CALL detect     (           css::uno::Sequence< css::beans::PropertyValue >&    lDescriptor ) throw( css::uno::RuntimeException );
     138                 :            : 
     139                 :            :     //-------------------------------------------------------------------------------------------------------------
     140                 :            :     //  protected methods
     141                 :            :     //-------------------------------------------------------------------------------------------------------------
     142                 :            :     protected:
     143                 :            : 
     144                 :            :     //-------------------------------------------------------------------------------------------------------------
     145                 :            :     //  private methods
     146                 :            :     //-------------------------------------------------------------------------------------------------------------
     147                 :            :     private:
     148                 :            :         DECL_LINK( implts_PlayerNotify, void* );
     149                 :            : 
     150                 :            :     //-------------------------------------------------------------------------------------------------------------
     151                 :            :     //  variables
     152                 :            :     //  (should be private everyway!)
     153                 :            :     //-------------------------------------------------------------------------------------------------------------
     154                 :            :     private:
     155                 :            : 
     156                 :            :         bool m_bError;
     157                 :            :         css::uno::Reference< css::lang::XMultiServiceFactory >     m_xFactory          ;   /// global uno service factory to create new services
     158                 :            :         css::uno::Reference< css::uno::XInterface >                m_xSelfHold         ;   /// we must protect us against dieing during async(!) dispatch() call!
     159                 :            :         css::uno::Reference< css::media::XPlayer >                 m_xPlayer           ;   /// uses avmedia player to play sounds ...
     160                 :            : 
     161                 :            :         css::uno::Reference< css::frame::XDispatchResultListener > m_xListener         ;
     162                 :            :         Timer m_aUpdateTimer;
     163                 :            : 
     164                 :            : };      //  class SoundHandler
     165                 :            : 
     166                 :            : }       //  namespace avmedia
     167                 :            : 
     168                 :            : #endif  //  #ifndef __FRAMEWORK_HANDLER_SOUNDHANDLER_HXX_
     169                 :            : 
     170                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10