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

Generated by: LCOV version 1.10