LCOV - code coverage report
Current view: top level - avmedia/source/viewer - mediaevent_impl.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 88 1.1 %
Date: 2014-11-03 Functions: 2 17 11.8 %
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             : #include "mediaevent_impl.hxx"
      21             : #include "mediawindow_impl.hxx"
      22             : #include <osl/mutex.hxx>
      23             : #include <vcl/svapp.hxx>
      24             : #include <vcl/event.hxx>
      25             : 
      26             : using namespace ::com::sun::star;
      27             : 
      28             : namespace avmedia { namespace priv {
      29             : 
      30             : // - MediaEventListenersImpl -
      31             : 
      32             : 
      33           0 : MediaEventListenersImpl::MediaEventListenersImpl( vcl::Window& rEventWindow ) :
      34           0 :     mpNotifyWindow( &rEventWindow )
      35             : {
      36           0 : }
      37             : 
      38             : 
      39             : 
      40           0 : MediaEventListenersImpl::~MediaEventListenersImpl()
      41             : {
      42           0 : }
      43             : 
      44             : 
      45             : 
      46           0 : void MediaEventListenersImpl::cleanUp()
      47             : {
      48           0 :     Application::RemoveMouseAndKeyEvents( reinterpret_cast< vcl::Window* >( mpNotifyWindow ) );
      49           0 :     mpNotifyWindow = NULL;
      50           0 : }
      51             : 
      52             : 
      53             : 
      54           0 : void SAL_CALL MediaEventListenersImpl::disposing( const ::com::sun::star::lang::EventObject& /* Source */ )
      55             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
      56             : {
      57           0 : }
      58             : 
      59             : 
      60             : 
      61           0 : void SAL_CALL MediaEventListenersImpl::keyPressed( const ::com::sun::star::awt::KeyEvent& e )
      62             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
      63             : {
      64           0 :     const ::osl::MutexGuard aGuard( maMutex );
      65           0 :     const SolarMutexGuard aAppGuard;
      66             : 
      67           0 :     if( mpNotifyWindow )
      68             :     {
      69             :         vcl::KeyCode aVCLKeyCode( e.KeyCode,
      70           0 :                                   ( ( e.Modifiers & 1 ) ? KEY_SHIFT : 0 ) |
      71           0 :                                   ( ( e.Modifiers & 2 ) ? KEY_MOD1 : 0 ) |
      72           0 :                                   ( ( e.Modifiers & 4 ) ? KEY_MOD2 : 0 ) );
      73           0 :         KeyEvent aVCLKeyEvt( e.KeyChar, aVCLKeyCode );
      74             : 
      75           0 :         Application::PostKeyEvent( VCLEVENT_WINDOW_KEYINPUT, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLKeyEvt );
      76           0 :     }
      77           0 : }
      78             : 
      79             : 
      80             : 
      81           0 : void SAL_CALL MediaEventListenersImpl::keyReleased( const ::com::sun::star::awt::KeyEvent& e )
      82             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
      83             : {
      84           0 :     const ::osl::MutexGuard aGuard( maMutex );
      85           0 :     const SolarMutexGuard aAppGuard;
      86             : 
      87           0 :     if( mpNotifyWindow )
      88             :     {
      89             :         vcl::KeyCode aVCLKeyCode( e.KeyCode,
      90           0 :                                   ( ( e.Modifiers & 1 ) ? KEY_SHIFT : 0 ) |
      91           0 :                                   ( ( e.Modifiers & 2 ) ? KEY_MOD1 : 0 ) |
      92           0 :                                   ( ( e.Modifiers & 4 ) ? KEY_MOD2 : 0 ) );
      93           0 :         KeyEvent aVCLKeyEvt( e.KeyChar, aVCLKeyCode );
      94           0 :         Application::PostKeyEvent( VCLEVENT_WINDOW_KEYUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLKeyEvt );
      95           0 :     }
      96           0 : }
      97             : 
      98             : 
      99             : 
     100           0 : void SAL_CALL MediaEventListenersImpl::mousePressed( const ::com::sun::star::awt::MouseEvent& e )
     101             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     102             : {
     103           0 :     const ::osl::MutexGuard aGuard( maMutex );
     104           0 :     const SolarMutexGuard aAppGuard;
     105             : 
     106           0 :     if( mpNotifyWindow )
     107             :     {
     108             :         MouseEvent aVCLMouseEvt( Point( e.X, e.Y ),
     109           0 :                                  sal::static_int_cast< sal_uInt16 >(e.ClickCount),
     110             :                                  0,
     111             :                                 ( ( e.Buttons & 1 ) ? MOUSE_LEFT : 0 ) |
     112           0 :                                 ( ( e.Buttons & 2 ) ? MOUSE_RIGHT : 0 ) |
     113           0 :                                 ( ( e.Buttons & 4 ) ? MOUSE_MIDDLE : 0 ),
     114           0 :                                 e.Modifiers );
     115           0 :         Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt );
     116           0 :     }
     117           0 : }
     118             : 
     119             : // ----------------------------------------------gvd-----------------------
     120             : 
     121           0 : void SAL_CALL MediaEventListenersImpl::mouseReleased( const ::com::sun::star::awt::MouseEvent& e )
     122             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     123             : {
     124           0 :     const ::osl::MutexGuard aGuard( maMutex );
     125           0 :     const SolarMutexGuard aAppGuard;
     126             : 
     127           0 :     if( mpNotifyWindow )
     128             :     {
     129             :         MouseEvent aVCLMouseEvt( Point( e.X, e.Y ),
     130           0 :                                  sal::static_int_cast< sal_uInt16 >(e.ClickCount),
     131             :                                  0,
     132             :                                 ( ( e.Buttons & 1 ) ? MOUSE_LEFT : 0 ) |
     133           0 :                                 ( ( e.Buttons & 2 ) ? MOUSE_RIGHT : 0 ) |
     134           0 :                                 ( ( e.Buttons & 4 ) ? MOUSE_MIDDLE : 0 ),
     135           0 :                                 e.Modifiers );
     136           0 :         Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONUP, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt );
     137           0 :     }
     138           0 : }
     139             : 
     140             : 
     141             : 
     142           0 : void SAL_CALL MediaEventListenersImpl::mouseEntered( const ::com::sun::star::awt::MouseEvent& /* e */ )
     143             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     144             : {
     145           0 :     const ::osl::MutexGuard aGuard( maMutex );
     146           0 :     const SolarMutexGuard aAppGuard;
     147             : 
     148           0 :     if( mpNotifyWindow )
     149             :     {
     150           0 :     }
     151           0 : }
     152             : 
     153             : 
     154             : 
     155           0 : void SAL_CALL MediaEventListenersImpl::mouseExited( const ::com::sun::star::awt::MouseEvent& /* e */ )
     156             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     157             : {
     158           0 :     const ::osl::MutexGuard aGuard( maMutex );
     159           0 :     const SolarMutexGuard aAppGuard;
     160             : 
     161           0 :     if( mpNotifyWindow )
     162             :     {
     163           0 :     }
     164           0 : }
     165             : 
     166             : 
     167             : 
     168           0 : void SAL_CALL MediaEventListenersImpl::mouseDragged( const ::com::sun::star::awt::MouseEvent& e )
     169             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     170             : {
     171           0 :     const ::osl::MutexGuard aGuard( maMutex );
     172           0 :     const SolarMutexGuard aAppGuard;
     173             : 
     174           0 :     if( mpNotifyWindow )
     175             :     {
     176           0 :         MouseEvent aVCLMouseEvt( Point( e.X, e.Y ), 0, 0, e.Buttons, e.Modifiers );
     177           0 :         Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt );
     178           0 :     }
     179           0 : }
     180             : 
     181             : 
     182             : 
     183           0 : void SAL_CALL MediaEventListenersImpl::mouseMoved( const ::com::sun::star::awt::MouseEvent& e )
     184             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     185             : {
     186           0 :     const ::osl::MutexGuard aGuard( maMutex );
     187           0 :     const SolarMutexGuard aAppGuard;
     188             : 
     189           0 :     if( mpNotifyWindow )
     190             :     {
     191           0 :         MouseEvent aVCLMouseEvt( Point( e.X, e.Y ), 0, 0, e.Buttons, e.Modifiers );
     192           0 :         Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< vcl::Window* >( mpNotifyWindow ), &aVCLMouseEvt );
     193           0 :     }
     194           0 : }
     195             : 
     196             : 
     197             : 
     198           0 : void SAL_CALL MediaEventListenersImpl::focusGained( const ::com::sun::star::awt::FocusEvent& /* e */ )
     199             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     200             : {
     201           0 : }
     202             : 
     203             : 
     204             : 
     205           0 : void SAL_CALL MediaEventListenersImpl::focusLost( const ::com::sun::star::awt::FocusEvent& /* e */ )
     206             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     207             : {
     208           0 : }
     209             : 
     210             : } // namespace priv
     211         651 : } // namespace avemdia
     212             : 
     213             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10