update dev300-m57
[ooovba.git] / applied_patches / 0498-avmedia-source-gstreamer-gstwindow.cxx.diff
blobc0b779290dd84676a8538f1f1c8a56cb1a53d022
1 --- /dev/null 2006-08-13 17:52:05.000000000 +0200
2 +++ avmedia/source/gstreamer/gstwindow.cxx 2006-08-22 11:38:56.000000000 +0200
3 @@ -0,0 +1,365 @@
4 +/*************************************************************************
5 + *
6 + * OpenOffice.org - a multi-platform office productivity suite
7 + *
8 + * $RCSfile$
9 + *
10 + * $Revision$
11 + *
12 + * last change: $Author$ $Date$
13 + *
14 + * The Contents of this file are made available subject to
15 + * the terms of GNU Lesser General Public License Version 2.1.
16 + *
17 + *
18 + * GNU Lesser General Public License Version 2.1
19 + * =============================================
20 + * Copyright 2005 by Sun Microsystems, Inc.
21 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
22 + *
23 + * This library is free software; you can redistribute it and/or
24 + * modify it under the terms of the GNU Lesser General Public
25 + * License version 2.1, as published by the Free Software Foundation.
26 + *
27 + * This library is distributed in the hope that it will be useful,
28 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 + * Lesser General Public License for more details.
31 + *
32 + * You should have received a copy of the GNU Lesser General Public
33 + * License along with this library; if not, write to the Free Software
34 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
35 + * MA 02111-1307 USA
36 + *
37 + ************************************************************************/
39 +#include <com/sun/star/awt/SystemPointer.hdl>
41 +#include "gstwindow.hxx"
42 +#include "gstplayer.hxx"
44 +#define AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_GStreamer"
45 +#define AVMEDIA_GST_WINDOW_SERVICENAME "com.sun.star.media.Window_GStreamer"
47 +using namespace ::com::sun::star;
49 +namespace avmedia { namespace gstreamer {
51 +// -----------
52 +// - statics -
53 +// -----------
55 +static ::osl::Mutex& ImplGetOwnStaticMutex()
57 + static ::osl::Mutex* pMutex = NULL;
59 + if( pMutex == NULL )
60 + {
61 + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
63 + if( pMutex == NULL )
64 + {
65 + static ::osl::Mutex aMutex;
66 + pMutex = &aMutex;
67 + }
68 + }
70 + return *pMutex;
73 +// ---------------
74 +// - Window -
75 +// ---------------
77 +// ------------------------------------------------------------------------------
79 +Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, Player& rPlayer ) :
80 + mxMgr( rxMgr ),
81 + maListeners( maMutex ),
82 + meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ),
83 + mrPlayer( rPlayer ),
84 + mnPointerType( awt::SystemPointer::ARROW )
86 + ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() );
90 +// ------------------------------------------------------------------------------
92 +Window::~Window()
96 +// XPlayerWindow
97 +// ------------------------------------------------------------------------------
99 +void SAL_CALL Window::update( )
100 + throw (uno::RuntimeException)
102 + //::RedrawWindow( (HWND) mnFrameWnd, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE );
105 +// ------------------------------------------------------------------------------
107 +sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel )
108 + throw (uno::RuntimeException)
110 + sal_Bool bRet = false;
112 + if( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel &&
113 + media::ZoomLevel_NOT_AVAILABLE != eZoomLevel )
115 + if( eZoomLevel != meZoomLevel )
117 + meZoomLevel = eZoomLevel;
118 + //ImplLayoutVideoWindow();
121 + bRet = true;
124 + return bRet;
127 +// ------------------------------------------------------------------------------
129 +media::ZoomLevel SAL_CALL Window::getZoomLevel( )
130 + throw (uno::RuntimeException)
132 + return meZoomLevel;
135 +// ------------------------------------------------------------------------------
137 +void SAL_CALL Window::setPointerType( sal_Int32 nPointerType )
138 + throw (uno::RuntimeException)
140 + mnPointerType = nPointerType;
143 +// XWindow
144 +// ------------------------------------------------------------------------------
146 +void SAL_CALL Window::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags )
147 + throw (uno::RuntimeException)
149 +// if( mnFrameWnd )
150 +// {
151 +// ::SetWindowPos( (HWND) mnFrameWnd, HWND_TOP, X, Y, Width, Height, 0 );
152 +// ImplLayoutVideoWindow();
153 +// }
156 +// ------------------------------------------------------------------------------
158 +awt::Rectangle SAL_CALL Window::getPosSize()
159 + throw (uno::RuntimeException)
161 + awt::Rectangle aRet;
163 + aRet.X = aRet.Y = 0;
164 + aRet.Width = 320;
165 + aRet.Height = 240;
167 +// if( mnFrameWnd )
168 +// {
169 +// ::RECT aWndRect;
170 +// long nX = 0, nY = 0, nWidth = 0, nHeight = 0;
172 +// if( ::GetClientRect( (HWND) mnFrameWnd, &aWndRect ) )
173 +// {
174 +// aRet.X = aWndRect.left;
175 +// aRet.Y = aWndRect.top;
176 +// aRet.Width = aWndRect.right - aWndRect.left + 1;
177 +// aRet.Height = aWndRect.bottom - aWndRect.top + 1;
178 +// }
179 +// }
181 + return aRet;
184 +// ------------------------------------------------------------------------------
186 +void SAL_CALL Window::setVisible( sal_Bool bVisible )
187 + throw (uno::RuntimeException)
189 +// if( mnFrameWnd )
190 +// {
191 +// IVideoWindow* pVideoWindow = const_cast< IVideoWindow* >( mrPlayer.getVideoWindow() );
193 +// if( pVideoWindow )
194 +// pVideoWindow->put_Visible( bVisible ? OATRUE : OAFALSE );
196 +// ::ShowWindow( (HWND) mnFrameWnd, bVisible ? SW_SHOW : SW_HIDE );
197 +// }
200 +// ------------------------------------------------------------------------------
202 +void SAL_CALL Window::setEnable( sal_Bool bEnable )
203 + throw (uno::RuntimeException)
205 +// if( mnFrameWnd )
206 +// ::EnableWindow( (HWND) mnFrameWnd, bEnable );
209 +// ------------------------------------------------------------------------------
211 +void SAL_CALL Window::setFocus( )
212 + throw (uno::RuntimeException)
214 +// if( mnFrameWnd )
215 +// ::SetFocus( (HWND) mnFrameWnd );
218 +// ------------------------------------------------------------------------------
220 +void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener )
221 + throw (uno::RuntimeException)
223 + maListeners.addInterface( getCppuType( &xListener ), xListener );
226 +// ------------------------------------------------------------------------------
228 +void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener )
229 + throw (uno::RuntimeException)
231 + maListeners.removeInterface( getCppuType( &xListener ), xListener );
234 +// ------------------------------------------------------------------------------
236 +void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
237 + throw (uno::RuntimeException)
239 + maListeners.addInterface( getCppuType( &xListener ), xListener );
242 +// ------------------------------------------------------------------------------
244 +void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
245 + throw (uno::RuntimeException)
247 + maListeners.removeInterface( getCppuType( &xListener ), xListener );
250 +// ------------------------------------------------------------------------------
252 +void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener )
253 + throw (uno::RuntimeException)
255 + maListeners.addInterface( getCppuType( &xListener ), xListener );
258 +// ------------------------------------------------------------------------------
260 +void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener )
261 + throw (uno::RuntimeException)
263 + maListeners.removeInterface( getCppuType( &xListener ), xListener );
266 +// ------------------------------------------------------------------------------
268 +void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener )
269 + throw (uno::RuntimeException)
271 + maListeners.addInterface( getCppuType( &xListener ), xListener );
274 +// ------------------------------------------------------------------------------
276 +void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener )
277 + throw (uno::RuntimeException)
279 + maListeners.removeInterface( getCppuType( &xListener ), xListener );
282 +// ------------------------------------------------------------------------------
284 +void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener )
285 + throw (uno::RuntimeException)
287 + maListeners.addInterface( getCppuType( &xListener ), xListener );
290 +// ------------------------------------------------------------------------------
292 +void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener )
293 + throw (uno::RuntimeException)
295 + maListeners.removeInterface( getCppuType( &xListener ), xListener );
298 +// ------------------------------------------------------------------------------
300 +void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener )
301 + throw (uno::RuntimeException)
303 + maListeners.addInterface( getCppuType( &xListener ), xListener );
306 +// ------------------------------------------------------------------------------
308 +void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener )
309 + throw (uno::RuntimeException)
311 + maListeners.removeInterface( getCppuType( &xListener ), xListener );
315 +// XComponent
316 +// ------------------------------------------------------------------------------
318 +void SAL_CALL Window::dispose( )
319 + throw (uno::RuntimeException)
323 +// ------------------------------------------------------------------------------
325 +void SAL_CALL Window::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
326 + throw (uno::RuntimeException)
328 + maListeners.addInterface( getCppuType( &xListener ), xListener );
331 +// ------------------------------------------------------------------------------
333 +void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
334 + throw (uno::RuntimeException)
336 + maListeners.removeInterface( getCppuType( &xListener ), xListener );
339 +// XServiceInfo
340 +// ------------------------------------------------------------------------------
342 +::rtl::OUString SAL_CALL Window::getImplementationName( )
343 + throw (uno::RuntimeException)
345 + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME ) );
348 +// ------------------------------------------------------------------------------
350 +sal_Bool SAL_CALL Window::supportsService( const ::rtl::OUString& ServiceName )
351 + throw (uno::RuntimeException)
353 + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_WINDOW_SERVICENAME ) );
356 +// ------------------------------------------------------------------------------
358 +uno::Sequence< ::rtl::OUString > SAL_CALL Window::getSupportedServiceNames( )
359 + throw (uno::RuntimeException)
361 + uno::Sequence< ::rtl::OUString > aRet(1);
362 + aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_WINDOW_SERVICENAME ) );
364 + return aRet;
367 +} // namespace gstreamer
368 +} // namespace avmedia