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 2010 Novell, Inc.
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 <com/sun/star/awt/SystemPointer.hpp>
30 : :
31 : : #include "gstwindow.hxx"
32 : : #include "gstplayer.hxx"
33 : :
34 : : #define AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_GStreamer"
35 : : #define AVMEDIA_GST_WINDOW_SERVICENAME "com.sun.star.media.Window_GStreamer"
36 : :
37 : : using namespace ::com::sun::star;
38 : :
39 : : namespace avmedia { namespace gstreamer {
40 : :
41 : : // -----------
42 : : // - statics -
43 : : // -----------
44 : :
45 : 0 : static ::osl::Mutex& ImplGetOwnStaticMutex()
46 : : {
47 : : static ::osl::Mutex* pMutex = NULL;
48 : :
49 : 0 : if( pMutex == NULL )
50 : : {
51 : 0 : ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
52 : :
53 : 0 : if( pMutex == NULL )
54 : : {
55 : 0 : static ::osl::Mutex aMutex;
56 : 0 : pMutex = &aMutex;
57 : 0 : }
58 : : }
59 : :
60 : 0 : return *pMutex;
61 : : }
62 : :
63 : : // ---------------
64 : : // - Window -
65 : : // ---------------
66 : :
67 : : // ------------------------------------------------------------------------------
68 : :
69 : 0 : Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, Player& rPlayer ) :
70 : : mxMgr( rxMgr ),
71 : : maListeners( maMutex ),
72 : : meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ),
73 : : mrPlayer( rPlayer ),
74 : 0 : mnPointerType( awt::SystemPointer::ARROW )
75 : : {
76 : 0 : ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() );
77 : :
78 : 0 : }
79 : :
80 : : // ------------------------------------------------------------------------------
81 : :
82 : 0 : Window::~Window()
83 : : {
84 : 0 : }
85 : :
86 : : // XPlayerWindow
87 : : // ------------------------------------------------------------------------------
88 : :
89 : 0 : void SAL_CALL Window::update( )
90 : : throw (uno::RuntimeException)
91 : : {
92 : 0 : }
93 : :
94 : : // ------------------------------------------------------------------------------
95 : :
96 : 0 : sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel )
97 : : throw (uno::RuntimeException)
98 : : {
99 : 0 : sal_Bool bRet = false;
100 : :
101 : 0 : if( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel &&
102 : : media::ZoomLevel_NOT_AVAILABLE != eZoomLevel )
103 : : {
104 : 0 : if( eZoomLevel != meZoomLevel )
105 : : {
106 : 0 : meZoomLevel = eZoomLevel;
107 : : }
108 : :
109 : 0 : bRet = true;
110 : : }
111 : :
112 : 0 : return bRet;
113 : : }
114 : :
115 : : // ------------------------------------------------------------------------------
116 : :
117 : 0 : media::ZoomLevel SAL_CALL Window::getZoomLevel( )
118 : : throw (uno::RuntimeException)
119 : : {
120 : 0 : return meZoomLevel;
121 : : }
122 : :
123 : : // ------------------------------------------------------------------------------
124 : :
125 : 0 : void SAL_CALL Window::setPointerType( sal_Int32 nPointerType )
126 : : throw (uno::RuntimeException)
127 : : {
128 : 0 : mnPointerType = nPointerType;
129 : 0 : }
130 : :
131 : : // XWindow
132 : : // ------------------------------------------------------------------------------
133 : :
134 : 0 : void SAL_CALL Window::setPosSize( sal_Int32 /*X*/, sal_Int32 /*Y*/, sal_Int32 /*Width*/, sal_Int32 /*Height*/, sal_Int16 /*Flags*/ )
135 : : throw (uno::RuntimeException)
136 : : {
137 : 0 : }
138 : :
139 : : // ------------------------------------------------------------------------------
140 : :
141 : 0 : awt::Rectangle SAL_CALL Window::getPosSize()
142 : : throw (uno::RuntimeException)
143 : : {
144 : 0 : awt::Rectangle aRet;
145 : :
146 : 0 : aRet.X = aRet.Y = 0;
147 : 0 : aRet.Width = 320;
148 : 0 : aRet.Height = 240;
149 : :
150 : 0 : return aRet;
151 : : }
152 : :
153 : : // ------------------------------------------------------------------------------
154 : :
155 : 0 : void SAL_CALL Window::setVisible( sal_Bool /*bVisible*/ )
156 : : throw (uno::RuntimeException)
157 : : {
158 : :
159 : 0 : }
160 : :
161 : : // ------------------------------------------------------------------------------
162 : :
163 : 0 : void SAL_CALL Window::setEnable( sal_Bool /*bEnable*/ )
164 : : throw (uno::RuntimeException)
165 : : {
166 : 0 : }
167 : :
168 : : // ------------------------------------------------------------------------------
169 : :
170 : 0 : void SAL_CALL Window::setFocus( )
171 : : throw (uno::RuntimeException)
172 : : {
173 : 0 : }
174 : :
175 : : // ------------------------------------------------------------------------------
176 : :
177 : 0 : void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener )
178 : : throw (uno::RuntimeException)
179 : : {
180 : 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
181 : 0 : }
182 : :
183 : : // ------------------------------------------------------------------------------
184 : :
185 : 0 : void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener )
186 : : throw (uno::RuntimeException)
187 : : {
188 : 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
189 : 0 : }
190 : :
191 : : // ------------------------------------------------------------------------------
192 : :
193 : 0 : void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
194 : : throw (uno::RuntimeException)
195 : : {
196 : 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
197 : 0 : }
198 : :
199 : : // ------------------------------------------------------------------------------
200 : :
201 : 0 : void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
202 : : throw (uno::RuntimeException)
203 : : {
204 : 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
205 : 0 : }
206 : :
207 : : // ------------------------------------------------------------------------------
208 : :
209 : 0 : void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener )
210 : : throw (uno::RuntimeException)
211 : : {
212 : 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
213 : 0 : }
214 : :
215 : : // ------------------------------------------------------------------------------
216 : :
217 : 0 : void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener )
218 : : throw (uno::RuntimeException)
219 : : {
220 : 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
221 : 0 : }
222 : :
223 : : // ------------------------------------------------------------------------------
224 : :
225 : 0 : void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener )
226 : : throw (uno::RuntimeException)
227 : : {
228 : 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
229 : 0 : }
230 : :
231 : : // ------------------------------------------------------------------------------
232 : :
233 : 0 : void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener )
234 : : throw (uno::RuntimeException)
235 : : {
236 : 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
237 : 0 : }
238 : :
239 : : // ------------------------------------------------------------------------------
240 : :
241 : 0 : void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener )
242 : : throw (uno::RuntimeException)
243 : : {
244 : 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
245 : 0 : }
246 : :
247 : : // ------------------------------------------------------------------------------
248 : :
249 : 0 : void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener )
250 : : throw (uno::RuntimeException)
251 : : {
252 : 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
253 : 0 : }
254 : :
255 : : // ------------------------------------------------------------------------------
256 : :
257 : 0 : void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener )
258 : : throw (uno::RuntimeException)
259 : : {
260 : 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
261 : 0 : }
262 : :
263 : : // ------------------------------------------------------------------------------
264 : :
265 : 0 : void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener )
266 : : throw (uno::RuntimeException)
267 : : {
268 : 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
269 : 0 : }
270 : :
271 : : // XComponent
272 : : // ------------------------------------------------------------------------------
273 : :
274 : 0 : void SAL_CALL Window::dispose( )
275 : : throw (uno::RuntimeException)
276 : : {
277 : 0 : }
278 : :
279 : : // ------------------------------------------------------------------------------
280 : :
281 : 0 : void SAL_CALL Window::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
282 : : throw (uno::RuntimeException)
283 : : {
284 : 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
285 : 0 : }
286 : :
287 : : // ------------------------------------------------------------------------------
288 : :
289 : 0 : void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
290 : : throw (uno::RuntimeException)
291 : : {
292 : 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
293 : 0 : }
294 : :
295 : : // XServiceInfo
296 : : // ------------------------------------------------------------------------------
297 : :
298 : 0 : ::rtl::OUString SAL_CALL Window::getImplementationName( )
299 : : throw (uno::RuntimeException)
300 : : {
301 : 0 : return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME ) );
302 : : }
303 : :
304 : : // ------------------------------------------------------------------------------
305 : :
306 : 0 : sal_Bool SAL_CALL Window::supportsService( const ::rtl::OUString& ServiceName )
307 : : throw (uno::RuntimeException)
308 : : {
309 : 0 : return ServiceName == AVMEDIA_GST_WINDOW_SERVICENAME;
310 : : }
311 : :
312 : : // ------------------------------------------------------------------------------
313 : :
314 : 0 : uno::Sequence< ::rtl::OUString > SAL_CALL Window::getSupportedServiceNames( )
315 : : throw (uno::RuntimeException)
316 : : {
317 : 0 : uno::Sequence< ::rtl::OUString > aRet(1);
318 : 0 : aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_WINDOW_SERVICENAME ) );
319 : :
320 : 0 : return aRet;
321 : : }
322 : :
323 : : } // namespace gstreamer
324 : : } // namespace avmedia
325 : :
326 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|