1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #include <com/sun/star/awt/SystemPointer.hdl> 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include "window.hxx" 31*cdf0e10cSrcweir #include "player.hxx" 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir using namespace ::com::sun::star; 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir namespace avmedia { namespace xine { 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir // ----------- 38*cdf0e10cSrcweir // - statics - 39*cdf0e10cSrcweir // ----------- 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir static ::osl::Mutex& ImplGetOwnStaticMutex() 42*cdf0e10cSrcweir { 43*cdf0e10cSrcweir static ::osl::Mutex* pMutex = NULL; 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir if( pMutex == NULL ) 46*cdf0e10cSrcweir { 47*cdf0e10cSrcweir ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir if( pMutex == NULL ) 50*cdf0e10cSrcweir { 51*cdf0e10cSrcweir static ::osl::Mutex aMutex; 52*cdf0e10cSrcweir pMutex = &aMutex; 53*cdf0e10cSrcweir } 54*cdf0e10cSrcweir } 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir return *pMutex; 57*cdf0e10cSrcweir } 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir // ----------- 60*cdf0e10cSrcweir // - WndProc - 61*cdf0e10cSrcweir // ----------- 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir /* 64*cdf0e10cSrcweir LRESULT CALLBACK MediaPlayerWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 ) 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir Window* pWindow = (Window*) ::GetWindowLong( hWnd, 0 ); 67*cdf0e10cSrcweir bool bProcessed = true; 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir if( pWindow ) 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir switch( nMsg ) 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir case( WM_SETCURSOR ): 74*cdf0e10cSrcweir pWindow->updatePointer(); 75*cdf0e10cSrcweir break; 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir case( WM_GRAPHNOTIFY ): 78*cdf0e10cSrcweir pWindow->processGraphEvent(); 79*cdf0e10cSrcweir break; 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir case( WM_MOUSEMOVE ): 82*cdf0e10cSrcweir case( WM_LBUTTONDOWN ): 83*cdf0e10cSrcweir case( WM_MBUTTONDOWN ): 84*cdf0e10cSrcweir case( WM_RBUTTONDOWN ): 85*cdf0e10cSrcweir case( WM_LBUTTONUP ): 86*cdf0e10cSrcweir case( WM_MBUTTONUP ): 87*cdf0e10cSrcweir case( WM_RBUTTONUP ): 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir awt::MouseEvent aUNOEvt; 90*cdf0e10cSrcweir POINT aWinPoint; 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir if( !::GetCursorPos( &aWinPoint ) || !::ScreenToClient( hWnd, &aWinPoint ) ) 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir aWinPoint.x = GET_X_LPARAM( nPar2 ); 95*cdf0e10cSrcweir aWinPoint.y = GET_Y_LPARAM( nPar2 ); 96*cdf0e10cSrcweir } 97*cdf0e10cSrcweir aUNOEvt.Modifiers = 0; 98*cdf0e10cSrcweir aUNOEvt.Buttons = 0; 99*cdf0e10cSrcweir aUNOEvt.X = aWinPoint.x; 100*cdf0e10cSrcweir aUNOEvt.Y = aWinPoint.y; 101*cdf0e10cSrcweir aUNOEvt.PopupTrigger = false; 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir // Modifiers 104*cdf0e10cSrcweir if( nPar1 & MK_SHIFT ) 105*cdf0e10cSrcweir aUNOEvt.Modifiers |= awt::KeyModifier::SHIFT; 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir if( nPar1 & MK_CONTROL ) 108*cdf0e10cSrcweir aUNOEvt.Modifiers |= awt::KeyModifier::MOD1; 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir // Buttons 111*cdf0e10cSrcweir if( WM_LBUTTONDOWN == nMsg || WM_LBUTTONUP == nMsg ) 112*cdf0e10cSrcweir aUNOEvt.Buttons |= awt::MouseButton::LEFT; 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir if( WM_MBUTTONDOWN == nMsg || WM_MBUTTONUP == nMsg ) 115*cdf0e10cSrcweir aUNOEvt.Buttons |= awt::MouseButton::MIDDLE; 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir if( WM_RBUTTONDOWN == nMsg || WM_RBUTTONUP == nMsg ) 118*cdf0e10cSrcweir aUNOEvt.Buttons |= awt::MouseButton::RIGHT; 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir // event type 121*cdf0e10cSrcweir if( WM_LBUTTONDOWN == nMsg || 122*cdf0e10cSrcweir WM_MBUTTONDOWN == nMsg || 123*cdf0e10cSrcweir WM_RBUTTONDOWN == nMsg ) 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir aUNOEvt.ClickCount = 1; 126*cdf0e10cSrcweir pWindow->fireMousePressedEvent( aUNOEvt ); 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir else if( WM_LBUTTONUP == nMsg || 129*cdf0e10cSrcweir WM_MBUTTONUP == nMsg || 130*cdf0e10cSrcweir WM_RBUTTONUP == nMsg ) 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir aUNOEvt.ClickCount = 1; 133*cdf0e10cSrcweir pWindow->fireMouseReleasedEvent( aUNOEvt ); 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir else if( WM_MOUSEMOVE == nMsg ) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir aUNOEvt.ClickCount = 0; 138*cdf0e10cSrcweir pWindow->fireMouseMovedEvent( aUNOEvt ); 139*cdf0e10cSrcweir pWindow->updatePointer(); 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir } 142*cdf0e10cSrcweir break; 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir case( WM_SETFOCUS ): 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir const awt::FocusEvent aUNOEvt; 147*cdf0e10cSrcweir pWindow->fireSetFocusEvent( aUNOEvt ); 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir break; 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir default: 152*cdf0e10cSrcweir bProcessed = false; 153*cdf0e10cSrcweir break; 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir else 157*cdf0e10cSrcweir bProcessed = false; 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir return( bProcessed ? 0 : DefWindowProc( hWnd, nMsg, nPar1, nPar2 ) ); 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir */ 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir // --------------- 164*cdf0e10cSrcweir // - Window - 165*cdf0e10cSrcweir // --------------- 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir Window::Window( Player& rPlayer ) : 168*cdf0e10cSrcweir mrPlayer( rPlayer ), 169*cdf0e10cSrcweir maListeners( maMutex ), 170*cdf0e10cSrcweir meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ), 171*cdf0e10cSrcweir mnPointerType( awt::SystemPointer::ARROW ) 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() ); 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir Window::~Window() 179*cdf0e10cSrcweir { 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir void Window::implLayoutVideoWindow() 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir if( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel ) 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir awt::Size aPrefSize( mrPlayer.getPreferredPlayerWindowSize() ); 189*cdf0e10cSrcweir awt::Rectangle aRect = getPosSize(); 190*cdf0e10cSrcweir int nW = aRect.Width, nH = aRect.Height; 191*cdf0e10cSrcweir int nVideoW = nW, nVideoH = nH; 192*cdf0e10cSrcweir int nX = 0, nY = 0, nWidth = 0, nHeight = 0; 193*cdf0e10cSrcweir bool bDone = false, bZoom = false; 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir if( media::ZoomLevel_ORIGINAL == meZoomLevel ) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir bZoom = true; 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir else if( media::ZoomLevel_ZOOM_1_TO_4 == meZoomLevel ) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir aPrefSize.Width >>= 2; 202*cdf0e10cSrcweir aPrefSize.Height >>= 2; 203*cdf0e10cSrcweir bZoom = true; 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir else if( media::ZoomLevel_ZOOM_1_TO_2 == meZoomLevel ) 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir aPrefSize.Width >>= 1; 208*cdf0e10cSrcweir aPrefSize.Height >>= 1; 209*cdf0e10cSrcweir bZoom = true; 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir else if( media::ZoomLevel_ZOOM_2_TO_1 == meZoomLevel ) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir aPrefSize.Width <<= 1; 214*cdf0e10cSrcweir aPrefSize.Height <<= 1; 215*cdf0e10cSrcweir bZoom = true; 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir else if( media::ZoomLevel_ZOOM_4_TO_1 == meZoomLevel ) 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir aPrefSize.Width <<= 2; 220*cdf0e10cSrcweir aPrefSize.Height <<= 2; 221*cdf0e10cSrcweir bZoom = true; 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir else if( media::ZoomLevel_FIT_TO_WINDOW == meZoomLevel ) 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir nWidth = nVideoW; 226*cdf0e10cSrcweir nHeight = nVideoH; 227*cdf0e10cSrcweir bDone = true; 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir if( bZoom ) 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir if( ( aPrefSize.Width <= nVideoW ) && ( aPrefSize.Height <= nVideoH ) ) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir nX = ( nVideoW - aPrefSize.Width ) >> 1; 235*cdf0e10cSrcweir nY = ( nVideoH - aPrefSize.Height ) >> 1; 236*cdf0e10cSrcweir nWidth = aPrefSize.Width; 237*cdf0e10cSrcweir nHeight = aPrefSize.Height; 238*cdf0e10cSrcweir bDone = true; 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir if( !bDone ) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir if( aPrefSize.Width > 0 && aPrefSize.Height > 0 && nVideoW > 0 && nVideoH > 0 ) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir double fPrefWH = (double) aPrefSize.Width / aPrefSize.Height; 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir if( fPrefWH < ( (double) nVideoW / nVideoH ) ) 249*cdf0e10cSrcweir nVideoW = (int)( nVideoH * fPrefWH ); 250*cdf0e10cSrcweir else 251*cdf0e10cSrcweir nVideoH = (int)( nVideoW / fPrefWH ); 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir nX = ( nW - nVideoW ) >> 1; 254*cdf0e10cSrcweir nY = ( nH - nVideoH ) >> 1; 255*cdf0e10cSrcweir nWidth = nVideoW; 256*cdf0e10cSrcweir nHeight = nVideoH; 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir else 259*cdf0e10cSrcweir nX = nY = nWidth = nHeight = 0; 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir /* 263*cdf0e10cSrcweir IVideoWindow* pVideoWindow = const_cast< IVideoWindow* >( mrPlayer.getVideoWindow() ); 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir if( pVideoWindow ) 266*cdf0e10cSrcweir pVideoWindow->SetWindowPosition( nX, nY, nWidth, nHeight ); 267*cdf0e10cSrcweir */ 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir bool Window::create( const uno::Sequence< uno::Any >& /*rArguments*/ ) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir bool bRet = false; 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir return bRet; 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir void SAL_CALL Window::update( ) 283*cdf0e10cSrcweir throw (uno::RuntimeException) 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel ) 290*cdf0e10cSrcweir throw (uno::RuntimeException) 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir bool bRet = false; 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir if( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel && 295*cdf0e10cSrcweir media::ZoomLevel_NOT_AVAILABLE != eZoomLevel ) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir if( eZoomLevel != meZoomLevel ) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir meZoomLevel = eZoomLevel; 300*cdf0e10cSrcweir implLayoutVideoWindow(); 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir bRet = true; 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir return bRet; 307*cdf0e10cSrcweir } 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir media::ZoomLevel SAL_CALL Window::getZoomLevel( ) 312*cdf0e10cSrcweir throw (uno::RuntimeException) 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir return meZoomLevel; 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir void SAL_CALL Window::setPointerType( sal_Int32 nPointerType ) 320*cdf0e10cSrcweir throw (uno::RuntimeException) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir mnPointerType = nPointerType; 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir void SAL_CALL Window::setPosSize( sal_Int32 /*X*/, sal_Int32 /*Y*/, sal_Int32 /*Width*/, sal_Int32 /*Height*/, sal_Int16 /*Flags*/ ) 328*cdf0e10cSrcweir throw (uno::RuntimeException) 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir implLayoutVideoWindow(); 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir awt::Rectangle SAL_CALL Window::getPosSize() 336*cdf0e10cSrcweir throw (uno::RuntimeException) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir awt::Rectangle aRet; 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir return aRet; 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir void SAL_CALL Window::setVisible( sal_Bool /* bVisible */ ) 346*cdf0e10cSrcweir throw (uno::RuntimeException) 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir void SAL_CALL Window::setEnable( sal_Bool /* bEnable */ ) 353*cdf0e10cSrcweir throw (uno::RuntimeException) 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir void SAL_CALL Window::setFocus( ) 360*cdf0e10cSrcweir throw (uno::RuntimeException) 361*cdf0e10cSrcweir { 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) 367*cdf0e10cSrcweir throw (uno::RuntimeException) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir maListeners.addInterface( getCppuType( &xListener ), xListener ); 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) 375*cdf0e10cSrcweir throw (uno::RuntimeException) 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir maListeners.removeInterface( getCppuType( &xListener ), xListener ); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) 383*cdf0e10cSrcweir throw (uno::RuntimeException) 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir maListeners.addInterface( getCppuType( &xListener ), xListener ); 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) 391*cdf0e10cSrcweir throw (uno::RuntimeException) 392*cdf0e10cSrcweir { 393*cdf0e10cSrcweir maListeners.removeInterface( getCppuType( &xListener ), xListener ); 394*cdf0e10cSrcweir } 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) 399*cdf0e10cSrcweir throw (uno::RuntimeException) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir maListeners.addInterface( getCppuType( &xListener ), xListener ); 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) 407*cdf0e10cSrcweir throw (uno::RuntimeException) 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir maListeners.removeInterface( getCppuType( &xListener ), xListener ); 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) 415*cdf0e10cSrcweir throw (uno::RuntimeException) 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir maListeners.addInterface( getCppuType( &xListener ), xListener ); 418*cdf0e10cSrcweir } 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) 423*cdf0e10cSrcweir throw (uno::RuntimeException) 424*cdf0e10cSrcweir { 425*cdf0e10cSrcweir maListeners.removeInterface( getCppuType( &xListener ), xListener ); 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 429*cdf0e10cSrcweir 430*cdf0e10cSrcweir void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) 431*cdf0e10cSrcweir throw (uno::RuntimeException) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir maListeners.addInterface( getCppuType( &xListener ), xListener ); 434*cdf0e10cSrcweir } 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) 439*cdf0e10cSrcweir throw (uno::RuntimeException) 440*cdf0e10cSrcweir { 441*cdf0e10cSrcweir maListeners.removeInterface( getCppuType( &xListener ), xListener ); 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener ) 447*cdf0e10cSrcweir throw (uno::RuntimeException) 448*cdf0e10cSrcweir { 449*cdf0e10cSrcweir maListeners.addInterface( getCppuType( &xListener ), xListener ); 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener ) 455*cdf0e10cSrcweir throw (uno::RuntimeException) 456*cdf0e10cSrcweir { 457*cdf0e10cSrcweir maListeners.removeInterface( getCppuType( &xListener ), xListener ); 458*cdf0e10cSrcweir } 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir void SAL_CALL Window::dispose( ) 463*cdf0e10cSrcweir throw (uno::RuntimeException) 464*cdf0e10cSrcweir { 465*cdf0e10cSrcweir } 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir void SAL_CALL Window::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) 470*cdf0e10cSrcweir throw (uno::RuntimeException) 471*cdf0e10cSrcweir { 472*cdf0e10cSrcweir maListeners.addInterface( getCppuType( &xListener ), xListener ); 473*cdf0e10cSrcweir } 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) 478*cdf0e10cSrcweir throw (uno::RuntimeException) 479*cdf0e10cSrcweir { 480*cdf0e10cSrcweir maListeners.removeInterface( getCppuType( &xListener ), xListener ); 481*cdf0e10cSrcweir } 482*cdf0e10cSrcweir 483*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir void Window::fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) 486*cdf0e10cSrcweir { 487*cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( getCppuType( (uno::Reference< awt::XMouseListener >*) 0 ) ); 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir if( pContainer ) 490*cdf0e10cSrcweir { 491*cdf0e10cSrcweir ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir while( aIter.hasMoreElements() ) 494*cdf0e10cSrcweir uno::Reference< awt::XMouseListener >( aIter.next(), uno::UNO_QUERY )->mousePressed( rEvt ); 495*cdf0e10cSrcweir } 496*cdf0e10cSrcweir } 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir void Window::fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) 501*cdf0e10cSrcweir { 502*cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( getCppuType( (uno::Reference< awt::XMouseListener >*) 0 ) ); 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir if( pContainer ) 505*cdf0e10cSrcweir { 506*cdf0e10cSrcweir ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir while( aIter.hasMoreElements() ) 509*cdf0e10cSrcweir uno::Reference< awt::XMouseListener >( aIter.next(), uno::UNO_QUERY )->mouseReleased( rEvt ); 510*cdf0e10cSrcweir } 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir 513*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 514*cdf0e10cSrcweir 515*cdf0e10cSrcweir void Window::fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) 516*cdf0e10cSrcweir { 517*cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( getCppuType( (uno::Reference< awt::XMouseMotionListener >*) 0 ) ); 518*cdf0e10cSrcweir 519*cdf0e10cSrcweir if( pContainer ) 520*cdf0e10cSrcweir { 521*cdf0e10cSrcweir ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir while( aIter.hasMoreElements() ) 524*cdf0e10cSrcweir uno::Reference< awt::XMouseMotionListener >( aIter.next(), uno::UNO_QUERY )->mouseMoved( rEvt ); 525*cdf0e10cSrcweir } 526*cdf0e10cSrcweir } 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir void Window::fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt ) 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( getCppuType( (uno::Reference< awt::XFocusListener >*) 0 ) ); 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir if( pContainer ) 535*cdf0e10cSrcweir { 536*cdf0e10cSrcweir ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir while( aIter.hasMoreElements() ) 539*cdf0e10cSrcweir uno::Reference< awt::XFocusListener >( aIter.next(), uno::UNO_QUERY )->focusGained( rEvt ); 540*cdf0e10cSrcweir } 541*cdf0e10cSrcweir } 542*cdf0e10cSrcweir 543*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir ::rtl::OUString SAL_CALL Window::getImplementationName( ) 546*cdf0e10cSrcweir throw (uno::RuntimeException) 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_XINE_WINDOW_IMPLEMENTATIONNAME ) ); 549*cdf0e10cSrcweir } 550*cdf0e10cSrcweir 551*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir sal_Bool SAL_CALL Window::supportsService( const ::rtl::OUString& ServiceName ) 554*cdf0e10cSrcweir throw (uno::RuntimeException) 555*cdf0e10cSrcweir { 556*cdf0e10cSrcweir return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_XINE_WINDOW_SERVICENAME ) ); 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir // ------------------------------------------------------------------------------ 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL Window::getSupportedServiceNames( ) 562*cdf0e10cSrcweir throw (uno::RuntimeException) 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > aRet(1); 565*cdf0e10cSrcweir aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_XINE_WINDOW_SERVICENAME ) ); 566*cdf0e10cSrcweir 567*cdf0e10cSrcweir return aRet; 568*cdf0e10cSrcweir } 569*cdf0e10cSrcweir 570*cdf0e10cSrcweir } // namespace xine 571*cdf0e10cSrcweir } // namespace avmedia 572