LCOV - code coverage report
Current view: top level - avmedia/source/viewer - mediawindow_impl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 227 0.0 %
Date: 2012-08-25 Functions: 0 34 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 410 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                 :            : #include "mediawindow_impl.hxx"
      30                 :            : #include "mediaevent_impl.hxx"
      31                 :            : #include "mediamisc.hxx"
      32                 :            : #include "mediawindow.hrc"
      33                 :            : #include "helpids.hrc"
      34                 :            : 
      35                 :            : #include <algorithm>
      36                 :            : #include <cmath>
      37                 :            : #include <osl/mutex.hxx>
      38                 :            : #include <vcl/svapp.hxx>
      39                 :            : #ifdef UNX
      40                 :            : #include <vcl/sysdata.hxx>
      41                 :            : #endif
      42                 :            : 
      43                 :            : #include <com/sun/star/awt/SystemPointer.hpp>
      44                 :            : #include <com/sun/star/lang/XComponent.hpp>
      45                 :            : 
      46                 :            : using namespace ::com::sun::star;
      47                 :            : 
      48                 :            : namespace avmedia { namespace priv {
      49                 :            : 
      50                 :            : // ----------------------
      51                 :            : // - MediaWindowControl -
      52                 :            : // ----------------------
      53                 :            : 
      54                 :          0 : MediaWindowControl::MediaWindowControl( Window* pParent ) :
      55                 :          0 :     MediaControl( pParent, MEDIACONTROLSTYLE_MULTILINE )
      56                 :            : {
      57                 :          0 : }
      58                 :            : 
      59                 :            : // ---------------------------------------------------------------------
      60                 :            : 
      61                 :          0 : MediaWindowControl::~MediaWindowControl()
      62                 :            : {
      63         [ #  # ]:          0 : }
      64                 :            : 
      65                 :            : // ---------------------------------------------------------------------
      66                 :            : 
      67                 :          0 : void MediaWindowControl::update()
      68                 :            : {
      69         [ #  # ]:          0 :     MediaItem aItem;
      70                 :            : 
      71 [ #  # ][ #  # ]:          0 :     static_cast< MediaWindowImpl* >( GetParent() )->updateMediaItem( aItem );
      72 [ #  # ][ #  # ]:          0 :     setState( aItem );
      73                 :          0 : }
      74                 :            : 
      75                 :            : // ---------------------------------------------------------------------
      76                 :            : 
      77                 :          0 : void  MediaWindowControl::execute( const MediaItem& rItem )
      78                 :            : {
      79                 :          0 :     static_cast< MediaWindowImpl* >( GetParent() )->executeMediaItem( rItem );
      80                 :          0 : }
      81                 :            : 
      82                 :            : // --------------------
      83                 :            : // - MediaChildWindow -
      84                 :            : // --------------------
      85                 :            : 
      86                 :          0 : MediaChildWindow::MediaChildWindow( Window* pParent ) :
      87                 :          0 :     SystemChildWindow( pParent, WB_CLIPCHILDREN )
      88                 :            : {
      89                 :          0 : }
      90                 :            : 
      91                 :            : // ---------------------------------------------------------------------
      92                 :            : 
      93                 :          0 : MediaChildWindow::~MediaChildWindow()
      94                 :            : {
      95         [ #  # ]:          0 : }
      96                 :            : 
      97                 :            : // ---------------------------------------------------------------------
      98                 :            : 
      99                 :          0 : void MediaChildWindow::MouseMove( const MouseEvent& rMEvt )
     100                 :            : {
     101 [ #  # ][ #  # ]:          0 :     const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
     102 [ #  # ][ #  # ]:          0 :                                           rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
     103                 :            : 
     104         [ #  # ]:          0 :     SystemChildWindow::MouseMove( rMEvt );
     105 [ #  # ][ #  # ]:          0 :     GetParent()->MouseMove( aTransformedEvent );
     106                 :          0 : }
     107                 :            : 
     108                 :            : // ---------------------------------------------------------------------
     109                 :            : 
     110                 :          0 : void MediaChildWindow::MouseButtonDown( const MouseEvent& rMEvt )
     111                 :            : {
     112 [ #  # ][ #  # ]:          0 :     const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
     113 [ #  # ][ #  # ]:          0 :                                           rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
     114                 :            : 
     115         [ #  # ]:          0 :     SystemChildWindow::MouseButtonDown( rMEvt );
     116 [ #  # ][ #  # ]:          0 :     GetParent()->MouseButtonDown( aTransformedEvent );
     117                 :          0 : }
     118                 :            : 
     119                 :            : // ---------------------------------------------------------------------
     120                 :            : 
     121                 :          0 : void MediaChildWindow::MouseButtonUp( const MouseEvent& rMEvt )
     122                 :            : {
     123 [ #  # ][ #  # ]:          0 :     const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
     124 [ #  # ][ #  # ]:          0 :                                           rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
     125                 :            : 
     126         [ #  # ]:          0 :     SystemChildWindow::MouseButtonUp( rMEvt );
     127 [ #  # ][ #  # ]:          0 :     GetParent()->MouseButtonUp( aTransformedEvent );
     128                 :          0 : }
     129                 :            : 
     130                 :            : // ---------------------------------------------------------------------
     131                 :            : 
     132                 :          0 : void MediaChildWindow::KeyInput( const KeyEvent& rKEvt )
     133                 :            : {
     134                 :          0 :     SystemChildWindow::KeyInput( rKEvt );
     135                 :          0 :     GetParent()->KeyInput( rKEvt );
     136                 :          0 : }
     137                 :            : 
     138                 :            : // ---------------------------------------------------------------------
     139                 :            : 
     140                 :          0 : void MediaChildWindow::KeyUp( const KeyEvent& rKEvt )
     141                 :            : {
     142                 :          0 :     SystemChildWindow::KeyUp( rKEvt );
     143                 :          0 :     GetParent()->KeyUp( rKEvt );
     144                 :          0 : }
     145                 :            : 
     146                 :            : // ---------------------------------------------------------------------
     147                 :            : 
     148                 :          0 : void MediaChildWindow::Command( const CommandEvent& rCEvt )
     149                 :            : {
     150 [ #  # ][ #  # ]:          0 :     const CommandEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ),
     151 [ #  # ][ #  # ]:          0 :                                             rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() );
     152                 :            : 
     153         [ #  # ]:          0 :     SystemChildWindow::Command( rCEvt );
     154 [ #  # ][ #  # ]:          0 :     GetParent()->Command( aTransformedEvent );
     155                 :          0 : }
     156                 :            : 
     157                 :            : // ----------------------
     158                 :            : // - MediaWindowImpl -
     159                 :            : // ----------------------
     160                 :            : 
     161                 :          0 : MediaWindowImpl::MediaWindowImpl( Window* pParent, MediaWindow* pMediaWindow, bool bInternalMediaControl ) :
     162                 :            :     Control( pParent ),
     163                 :            :     MediaWindowBaseImpl( pMediaWindow ),
     164                 :            :     DropTargetHelper( this ),
     165                 :            :     DragSourceHelper( this ),
     166         [ #  # ]:          0 :     mxEventsIf( static_cast< ::cppu::OWeakObject* >( mpEvents = new MediaEventListenersImpl( maChildWindow ) ) ),
     167                 :            :     maChildWindow( this ),
     168         [ #  # ]:          0 :     mpMediaWindowControl( bInternalMediaControl ? new MediaWindowControl( this ) : NULL ),
     169                 :            :     mpEmptyBmpEx( NULL ),
     170 [ #  # ][ #  # ]:          0 :     mpAudioBmpEx( NULL )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     171                 :            : {
     172 [ #  # ][ #  # ]:          0 :     maChildWindow.SetBackground( Color( COL_BLACK ) );
                 [ #  # ]
     173         [ #  # ]:          0 :     maChildWindow.SetHelpId( HID_AVMEDIA_PLAYERWINDOW );
     174         [ #  # ]:          0 :     maChildWindow.Hide();
     175                 :            : 
     176         [ #  # ]:          0 :     if( mpMediaWindowControl )
     177                 :            :     {
     178 [ #  # ][ #  # ]:          0 :         mpMediaWindowControl->SetSizePixel( mpMediaWindowControl->getMinSizePixel() );
     179         [ #  # ]:          0 :         mpMediaWindowControl->Show();
     180                 :            :     }
     181                 :          0 : }
     182                 :            : 
     183                 :            : // ---------------------------------------------------------------------
     184                 :            : 
     185 [ #  # ][ #  # ]:          0 : MediaWindowImpl::~MediaWindowImpl()
         [ #  # ][ #  # ]
     186                 :            : {
     187 [ #  # ][ #  # ]:          0 :     delete mpEmptyBmpEx;
     188 [ #  # ][ #  # ]:          0 :     delete mpAudioBmpEx;
     189 [ #  # ][ #  # ]:          0 :     delete mpMediaWindowControl;
     190         [ #  # ]:          0 : }
     191                 :            : 
     192                 :            : // ---------------------------------------------------------------------
     193                 :            : 
     194                 :          0 : void MediaWindowImpl::cleanUp()
     195                 :            : {
     196         [ #  # ]:          0 :     uno::Reference< media::XPlayerWindow > xPlayerWindow( getPlayerWindow() );
     197                 :            : 
     198         [ #  # ]:          0 :     mpEvents->cleanUp();
     199                 :            : 
     200         [ #  # ]:          0 :     if( xPlayerWindow.is() )
     201                 :            :     {
     202 [ #  # ][ #  # ]:          0 :         xPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( mxEventsIf, uno::UNO_QUERY ) );
                 [ #  # ]
     203 [ #  # ][ #  # ]:          0 :         xPlayerWindow->removeMouseListener( uno::Reference< awt::XMouseListener >( mxEventsIf, uno::UNO_QUERY ) );
                 [ #  # ]
     204 [ #  # ][ #  # ]:          0 :         xPlayerWindow->removeMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEventsIf, uno::UNO_QUERY ) );
                 [ #  # ]
     205                 :            : 
     206         [ #  # ]:          0 :         uno::Reference< lang::XComponent > xComponent( xPlayerWindow, uno::UNO_QUERY );
     207                 :            : 
     208         [ #  # ]:          0 :         if( xComponent.is() )
     209 [ #  # ][ #  # ]:          0 :             xComponent->dispose();
     210                 :            : 
     211 [ #  # ][ #  # ]:          0 :         setPlayerWindow( NULL );
     212                 :            :     }
     213                 :            : 
     214         [ #  # ]:          0 :     MediaWindowBaseImpl::cleanUp();
     215                 :          0 : }
     216                 :            : 
     217                 :            : // ---------------------------------------------------------------------
     218                 :            : 
     219                 :          0 : void MediaWindowImpl::onURLChanged()
     220                 :            : {
     221         [ #  # ]:          0 :     if( getPlayer().is() )
     222                 :            :     {
     223         [ #  # ]:          0 :         uno::Sequence< uno::Any >              aArgs( 3 );
     224                 :          0 :         uno::Reference< media::XPlayerWindow > xPlayerWindow;
     225                 :          0 :         const Point                            aPoint;
     226         [ #  # ]:          0 :         const Size                             aSize( maChildWindow.GetSizePixel() );
     227                 :          0 :         const sal_Int32                        nWndHandle = 0;
     228                 :            : 
     229 [ #  # ][ #  # ]:          0 :         aArgs[ 0 ] = uno::makeAny( nWndHandle );
     230 [ #  # ][ #  # ]:          0 :         aArgs[ 1 ] = uno::makeAny( awt::Rectangle( aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height() ) );
     231 [ #  # ][ #  # ]:          0 :         aArgs[ 2 ] = uno::makeAny( reinterpret_cast< sal_IntPtr >( &maChildWindow ) );
     232                 :            : 
     233                 :            :         try
     234                 :            :         {
     235 [ #  # ][ #  # ]:          0 :             xPlayerWindow = getPlayer()->createPlayerWindow( aArgs );
         [ #  # ][ #  # ]
     236                 :            :         }
     237   [ #  #  #  # ]:          0 :         catch( uno::RuntimeException )
     238                 :            :         {
     239                 :            :             // happens eg, on MacOSX where Java frames cannot be created from X11 window handles
     240         [ #  # ]:          0 :         }
     241                 :            : 
     242         [ #  # ]:          0 :         setPlayerWindow( xPlayerWindow );
     243                 :            : 
     244         [ #  # ]:          0 :         if( xPlayerWindow.is() )
     245                 :            :         {
     246 [ #  # ][ #  # ]:          0 :             xPlayerWindow->addKeyListener( uno::Reference< awt::XKeyListener >( mxEventsIf, uno::UNO_QUERY ) );
                 [ #  # ]
     247 [ #  # ][ #  # ]:          0 :             xPlayerWindow->addMouseListener( uno::Reference< awt::XMouseListener >( mxEventsIf, uno::UNO_QUERY ) );
                 [ #  # ]
     248 [ #  # ][ #  # ]:          0 :             xPlayerWindow->addMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEventsIf, uno::UNO_QUERY ) );
                 [ #  # ]
     249 [ #  # ][ #  # ]:          0 :             xPlayerWindow->addFocusListener( uno::Reference< awt::XFocusListener >( mxEventsIf, uno::UNO_QUERY ) );
                 [ #  # ]
     250         [ #  # ]:          0 :         }
     251                 :            :     }
     252                 :            :     else
     253         [ #  # ]:          0 :         setPlayerWindow( NULL );
     254                 :            : 
     255         [ #  # ]:          0 :     if( getPlayerWindow().is() )
     256                 :          0 :         maChildWindow.Show();
     257                 :            :     else
     258                 :          0 :         maChildWindow.Hide();
     259                 :            : 
     260         [ #  # ]:          0 :     if( mpMediaWindowControl )
     261                 :            :     {
     262         [ #  # ]:          0 :         MediaItem aItem;
     263                 :            : 
     264         [ #  # ]:          0 :         updateMediaItem( aItem );
     265 [ #  # ][ #  # ]:          0 :         mpMediaWindowControl->setState( aItem );
     266                 :            :     }
     267                 :            : 
     268                 :          0 :     Invalidate();
     269                 :          0 : }
     270                 :            : 
     271                 :            : // ---------------------------------------------------------------------
     272                 :            : 
     273                 :          0 : void MediaWindowImpl::setPosSize( const Rectangle& rRect )
     274                 :            : {
     275         [ #  # ]:          0 :     SetPosSizePixel( rRect.TopLeft(), rRect.GetSize() );
     276                 :          0 : }
     277                 :            : 
     278                 :            : // ---------------------------------------------------------------------
     279                 :            : 
     280                 :          0 : void MediaWindowImpl::setPointer( const Pointer& rPointer )
     281                 :            : {
     282         [ #  # ]:          0 :     uno::Reference< media::XPlayerWindow >  xPlayerWindow( getPlayerWindow() );
     283                 :            : 
     284         [ #  # ]:          0 :     SetPointer( rPointer );
     285         [ #  # ]:          0 :     maChildWindow.SetPointer( rPointer );
     286                 :            : 
     287         [ #  # ]:          0 :     if( xPlayerWindow.is() )
     288                 :            :     {
     289                 :            :         long nPointer;
     290                 :            : 
     291   [ #  #  #  #  :          0 :         switch( rPointer.GetStyle() )
                      # ]
     292                 :            :         {
     293                 :          0 :             case( POINTER_CROSS ): nPointer = awt::SystemPointer::CROSS; break;
     294                 :          0 :             case( POINTER_HAND ): nPointer = awt::SystemPointer::HAND; break;
     295                 :          0 :             case( POINTER_MOVE ): nPointer = awt::SystemPointer::MOVE; break;
     296                 :          0 :             case( POINTER_WAIT ): nPointer = awt::SystemPointer::WAIT; break;
     297                 :            : 
     298                 :          0 :             default: nPointer = awt::SystemPointer::ARROW; break;
     299                 :            :         }
     300                 :            : 
     301 [ #  # ][ #  # ]:          0 :         xPlayerWindow->setPointerType( nPointer );
     302                 :          0 :     }
     303                 :          0 : }
     304                 :            : 
     305                 :            : // ---------------------------------------------------------------------
     306                 :            : 
     307                 :          0 : void MediaWindowImpl::Resize()
     308                 :            : {
     309         [ #  # ]:          0 :     uno::Reference< media::XPlayerWindow >  xPlayerWindow( getPlayerWindow() );
     310                 :          0 :     const Size                              aCurSize( GetOutputSizePixel() );
     311         [ #  # ]:          0 :     const sal_Int32                         nOffset( mpMediaWindowControl ? AVMEDIA_CONTROLOFFSET : 0 );
     312                 :          0 :     Size                                    aPlayerWindowSize( aCurSize.Width() - ( nOffset << 1 ),
     313                 :          0 :                                                                aCurSize.Height() - ( nOffset << 1 ) );
     314                 :            : 
     315         [ #  # ]:          0 :     if( mpMediaWindowControl )
     316                 :            :     {
     317         [ #  # ]:          0 :         const sal_Int32 nControlHeight = mpMediaWindowControl->GetSizePixel().Height();
     318         [ #  # ]:          0 :         const sal_Int32 nControlY = ::std::max( aCurSize.Height() - nControlHeight - nOffset, 0L );
     319                 :            : 
     320                 :          0 :         aPlayerWindowSize.Height() = ( nControlY - ( nOffset << 1 ) );
     321         [ #  # ]:          0 :         mpMediaWindowControl->SetPosSizePixel( Point( nOffset, nControlY ), Size( aCurSize.Width() - ( nOffset << 1 ), nControlHeight ) );
     322                 :            :     }
     323                 :            : 
     324         [ #  # ]:          0 :     if( xPlayerWindow.is() )
     325 [ #  # ][ #  # ]:          0 :         xPlayerWindow->setPosSize( 0, 0, aPlayerWindowSize.Width(), aPlayerWindowSize.Height(), 0 );
     326                 :            : 
     327         [ #  # ]:          0 :     maChildWindow.SetPosSizePixel( Point( nOffset, nOffset ), aPlayerWindowSize );
     328                 :          0 : }
     329                 :            : 
     330                 :            : // ---------------------------------------------------------------------
     331                 :            : 
     332                 :          0 : void MediaWindowImpl::StateChanged( StateChangedType eType )
     333                 :            : {
     334         [ #  # ]:          0 :     uno::Reference< media::XPlayerWindow > xPlayerWindow( getPlayerWindow() );
     335                 :            : 
     336         [ #  # ]:          0 :     if( xPlayerWindow.is() )
     337                 :            :     {
     338                 :            :         // stop playing when going disabled or hidden
     339      [ #  #  # ]:          0 :         switch( eType )
     340                 :            :         {
     341                 :            :             case STATE_CHANGE_VISIBLE:
     342                 :            :             {
     343 [ #  # ][ #  # ]:          0 :                 stopPlayingInternal( !IsVisible() );
     344 [ #  # ][ #  # ]:          0 :                 xPlayerWindow->setVisible( IsVisible() );
                 [ #  # ]
     345                 :            :             }
     346                 :          0 :             break;
     347                 :            : 
     348                 :            :             case STATE_CHANGE_ENABLE:
     349                 :            :             {
     350 [ #  # ][ #  # ]:          0 :                 stopPlayingInternal( !IsEnabled() );
     351 [ #  # ][ #  # ]:          0 :                 xPlayerWindow->setEnable( IsEnabled() );
                 [ #  # ]
     352                 :            :             }
     353                 :          0 :             break;
     354                 :            : 
     355                 :            :             default:
     356                 :          0 :             break;
     357                 :            :         }
     358                 :          0 :     }
     359                 :          0 : }
     360                 :            : 
     361                 :            : // ---------------------------------------------------------------------
     362                 :            : 
     363                 :          0 : void MediaWindowImpl::Paint( const Rectangle& )
     364                 :            : {
     365                 :          0 :     BitmapEx* pLogo = NULL;
     366                 :            : 
     367 [ #  # ][ #  # ]:          0 :     if( !getPlayer().is() )
     368                 :            :     {
     369         [ #  # ]:          0 :         if( !mpEmptyBmpEx )
     370 [ #  # ][ #  # ]:          0 :             mpEmptyBmpEx = new BitmapEx( AVMEDIA_RESID( AVMEDIA_BMP_EMPTYLOGO ) );
                 [ #  # ]
     371                 :            : 
     372                 :          0 :         pLogo = mpEmptyBmpEx;
     373                 :            :     }
     374 [ #  # ][ #  # ]:          0 :     else if( !getPlayerWindow().is() )
     375                 :            :     {
     376         [ #  # ]:          0 :         if( !mpAudioBmpEx )
     377 [ #  # ][ #  # ]:          0 :             mpAudioBmpEx = new BitmapEx( AVMEDIA_RESID( AVMEDIA_BMP_AUDIOLOGO ) );
                 [ #  # ]
     378                 :            : 
     379                 :          0 :         pLogo = mpAudioBmpEx;
     380                 :            :     }
     381                 :            : 
     382         [ #  # ]:          0 :     const Point     aBasePos( maChildWindow.GetPosPixel() );
     383 [ #  # ][ #  # ]:          0 :     const Rectangle aVideoRect( aBasePos, maChildWindow.GetSizePixel() );
     384                 :            : 
     385 [ #  # ][ #  # ]:          0 :     if( pLogo && !pLogo->IsEmpty() && ( aVideoRect.GetWidth() > 0 ) && ( aVideoRect.GetHeight() > 0 ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     386                 :            :     {
     387                 :          0 :         Size        aLogoSize( pLogo->GetSizePixel() );
     388                 :          0 :         const Color aBackgroundColor( 67, 67, 67 );
     389                 :            : 
     390         [ #  # ]:          0 :         SetLineColor( aBackgroundColor );
     391         [ #  # ]:          0 :         SetFillColor( aBackgroundColor );
     392         [ #  # ]:          0 :         DrawRect( aVideoRect );
     393                 :            : 
     394 [ #  # ][ #  # ]:          0 :         if( ( aLogoSize.Width() > aVideoRect.GetWidth() || aLogoSize.Height() > aVideoRect.GetHeight() ) &&
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     395                 :          0 :             ( aLogoSize.Height() > 0 ) )
     396                 :            :         {
     397                 :          0 :             const double fLogoWH = (double) aLogoSize.Width() / aLogoSize.Height();
     398                 :            : 
     399 [ #  # ][ #  # ]:          0 :             if( fLogoWH < ( (double) aVideoRect.GetWidth() / aVideoRect.GetHeight() ) )
                 [ #  # ]
     400                 :            :             {
     401         [ #  # ]:          0 :                 aLogoSize.Width() = (long) ( aVideoRect.GetHeight() * fLogoWH );
     402         [ #  # ]:          0 :                 aLogoSize.Height()= aVideoRect.GetHeight();
     403                 :            :             }
     404                 :            :             else
     405                 :            :             {
     406         [ #  # ]:          0 :                 aLogoSize.Width() = aVideoRect.GetWidth();
     407         [ #  # ]:          0 :                 aLogoSize.Height()= (long) ( aVideoRect.GetWidth() / fLogoWH );
     408                 :            :             }
     409                 :            :         }
     410                 :            : 
     411         [ #  # ]:          0 :         DrawBitmapEx( Point( aBasePos.X() + ( ( aVideoRect.GetWidth() - aLogoSize.Width() ) >> 1 ),
     412         [ #  # ]:          0 :                              aBasePos.Y() + ( ( aVideoRect.GetHeight() - aLogoSize.Height() ) >> 1 ) ),
     413         [ #  # ]:          0 :                       aLogoSize, *pLogo );
     414                 :            :     }
     415                 :          0 : }
     416                 :            : 
     417                 :            : // ---------------------------------------------------------------------
     418                 :            : 
     419                 :          0 : void MediaWindowImpl::GetFocus()
     420                 :            : {
     421                 :          0 : }
     422                 :            : 
     423                 :            : // ---------------------------------------------------------------------
     424                 :            : 
     425                 :          0 : void MediaWindowImpl::MouseMove( const MouseEvent& rMEvt )
     426                 :            : {
     427                 :          0 :     MediaWindow* pMediaWindow = getMediaWindow();
     428                 :            : 
     429         [ #  # ]:          0 :     if( pMediaWindow )
     430                 :          0 :         pMediaWindow->MouseMove( rMEvt );
     431                 :          0 : }
     432                 :            : 
     433                 :            : // ---------------------------------------------------------------------
     434                 :            : 
     435                 :          0 : void MediaWindowImpl::MouseButtonDown( const MouseEvent& rMEvt )
     436                 :            : {
     437                 :          0 :     MediaWindow* pMediaWindow = getMediaWindow();
     438                 :            : 
     439         [ #  # ]:          0 :     if( pMediaWindow )
     440                 :          0 :         pMediaWindow->MouseButtonDown( rMEvt );
     441                 :          0 : }
     442                 :            : 
     443                 :            : // ---------------------------------------------------------------------
     444                 :            : 
     445                 :          0 : void MediaWindowImpl::MouseButtonUp( const MouseEvent& rMEvt )
     446                 :            : {
     447                 :          0 :     MediaWindow* pMediaWindow = getMediaWindow();
     448                 :            : 
     449         [ #  # ]:          0 :     if( pMediaWindow )
     450                 :          0 :         pMediaWindow->MouseButtonUp( rMEvt );
     451                 :          0 : }
     452                 :            : 
     453                 :            : // ---------------------------------------------------------------------
     454                 :            : 
     455                 :          0 : void MediaWindowImpl::KeyInput( const KeyEvent& rKEvt )
     456                 :            : {
     457                 :          0 :     MediaWindow* pMediaWindow = getMediaWindow();
     458                 :            : 
     459         [ #  # ]:          0 :     if( pMediaWindow )
     460                 :          0 :         pMediaWindow->KeyInput( rKEvt );
     461                 :          0 : }
     462                 :            : 
     463                 :            : // ---------------------------------------------------------------------
     464                 :            : 
     465                 :          0 : void MediaWindowImpl::KeyUp( const KeyEvent& rKEvt )
     466                 :            : {
     467                 :          0 :     MediaWindow* pMediaWindow = getMediaWindow();
     468                 :            : 
     469         [ #  # ]:          0 :     if( pMediaWindow )
     470                 :          0 :         pMediaWindow->KeyUp( rKEvt );
     471                 :          0 : }
     472                 :            : 
     473                 :            : // ---------------------------------------------------------------------
     474                 :            : 
     475                 :          0 : void MediaWindowImpl::Command( const CommandEvent& rCEvt )
     476                 :            : {
     477                 :          0 :     MediaWindow* pMediaWindow = getMediaWindow();
     478                 :            : 
     479         [ #  # ]:          0 :     if( pMediaWindow )
     480                 :          0 :         pMediaWindow->Command( rCEvt );
     481                 :          0 : }
     482                 :            : 
     483                 :            : // ---------------------------------------------------------------------
     484                 :            : 
     485                 :          0 : sal_Int8 MediaWindowImpl::AcceptDrop( const AcceptDropEvent& rEvt )
     486                 :            : {
     487                 :          0 :     MediaWindow* pMediaWindow = getMediaWindow();
     488         [ #  # ]:          0 :     return( pMediaWindow ? pMediaWindow->AcceptDrop( rEvt ) : 0 );
     489                 :            : }
     490                 :            : 
     491                 :            : // ---------------------------------------------------------------------
     492                 :            : 
     493                 :          0 : sal_Int8 MediaWindowImpl::ExecuteDrop( const ExecuteDropEvent& rEvt )
     494                 :            : {
     495                 :          0 :     MediaWindow* pMediaWindow = getMediaWindow();
     496         [ #  # ]:          0 :     return( pMediaWindow ? pMediaWindow->ExecuteDrop( rEvt ) : 0 );
     497                 :            : }
     498                 :            : 
     499                 :            : // ---------------------------------------------------------------------
     500                 :            : 
     501                 :          0 : void MediaWindowImpl::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
     502                 :            : {
     503                 :          0 :     MediaWindow* pMediaWindow = getMediaWindow();
     504                 :            : 
     505         [ #  # ]:          0 :     if( pMediaWindow )
     506                 :          0 :         pMediaWindow->StartDrag( nAction, rPosPixel );
     507                 :          0 : }
     508                 :            : 
     509                 :            : } // namespace priv
     510                 :            : } // namespace avmedia
     511                 :            : 
     512                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10