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