Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <com/sun/star/awt/SystemPointer.hpp>
21 :
22 : #include "gstwindow.hxx"
23 : #include "gstplayer.hxx"
24 :
25 : #define AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_GStreamer"
26 : #define AVMEDIA_GST_WINDOW_SERVICENAME "com.sun.star.media.Window_GStreamer"
27 :
28 : using namespace ::com::sun::star;
29 :
30 : namespace avmedia { namespace gstreamer {
31 :
32 : // -----------
33 : // - statics -
34 : // -----------
35 :
36 0 : static ::osl::Mutex& ImplGetOwnStaticMutex()
37 : {
38 : static ::osl::Mutex* pMutex = NULL;
39 :
40 0 : if( pMutex == NULL )
41 : {
42 0 : ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
43 :
44 0 : if( pMutex == NULL )
45 : {
46 0 : static ::osl::Mutex aMutex;
47 0 : pMutex = &aMutex;
48 0 : }
49 : }
50 :
51 0 : return *pMutex;
52 : }
53 :
54 : // ---------------
55 : // - Window -
56 : // ---------------
57 :
58 : // ------------------------------------------------------------------------------
59 :
60 0 : Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, Player& rPlayer ) :
61 : mxMgr( rxMgr ),
62 : maListeners( maMutex ),
63 : meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ),
64 : mrPlayer( rPlayer ),
65 0 : mnPointerType( awt::SystemPointer::ARROW )
66 : {
67 0 : ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() );
68 :
69 0 : }
70 :
71 : // ------------------------------------------------------------------------------
72 :
73 0 : Window::~Window()
74 : {
75 0 : }
76 :
77 : // XPlayerWindow
78 : // ------------------------------------------------------------------------------
79 :
80 0 : void SAL_CALL Window::update( )
81 : throw (uno::RuntimeException)
82 : {
83 0 : }
84 :
85 : // ------------------------------------------------------------------------------
86 :
87 0 : sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel )
88 : throw (uno::RuntimeException)
89 : {
90 0 : sal_Bool bRet = false;
91 :
92 0 : if( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel &&
93 : media::ZoomLevel_NOT_AVAILABLE != eZoomLevel )
94 : {
95 0 : if( eZoomLevel != meZoomLevel )
96 : {
97 0 : meZoomLevel = eZoomLevel;
98 : }
99 :
100 0 : bRet = true;
101 : }
102 :
103 0 : return bRet;
104 : }
105 :
106 : // ------------------------------------------------------------------------------
107 :
108 0 : media::ZoomLevel SAL_CALL Window::getZoomLevel( )
109 : throw (uno::RuntimeException)
110 : {
111 0 : return meZoomLevel;
112 : }
113 :
114 : // ------------------------------------------------------------------------------
115 :
116 0 : void SAL_CALL Window::setPointerType( sal_Int32 nPointerType )
117 : throw (uno::RuntimeException)
118 : {
119 0 : mnPointerType = nPointerType;
120 0 : }
121 :
122 : // XWindow
123 : // ------------------------------------------------------------------------------
124 :
125 0 : void SAL_CALL Window::setPosSize( sal_Int32 /*X*/, sal_Int32 /*Y*/, sal_Int32 /*Width*/, sal_Int32 /*Height*/, sal_Int16 /*Flags*/ )
126 : throw (uno::RuntimeException)
127 : {
128 0 : }
129 :
130 : // ------------------------------------------------------------------------------
131 :
132 0 : awt::Rectangle SAL_CALL Window::getPosSize()
133 : throw (uno::RuntimeException)
134 : {
135 0 : awt::Rectangle aRet;
136 :
137 0 : aRet.X = aRet.Y = 0;
138 0 : aRet.Width = 320;
139 0 : aRet.Height = 240;
140 :
141 0 : return aRet;
142 : }
143 :
144 : // ------------------------------------------------------------------------------
145 :
146 0 : void SAL_CALL Window::setVisible( sal_Bool /*bVisible*/ )
147 : throw (uno::RuntimeException)
148 : {
149 :
150 0 : }
151 :
152 : // ------------------------------------------------------------------------------
153 :
154 0 : void SAL_CALL Window::setEnable( sal_Bool /*bEnable*/ )
155 : throw (uno::RuntimeException)
156 : {
157 0 : }
158 :
159 : // ------------------------------------------------------------------------------
160 :
161 0 : void SAL_CALL Window::setFocus( )
162 : throw (uno::RuntimeException)
163 : {
164 0 : }
165 :
166 : // ------------------------------------------------------------------------------
167 :
168 0 : void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener )
169 : throw (uno::RuntimeException)
170 : {
171 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
172 0 : }
173 :
174 : // ------------------------------------------------------------------------------
175 :
176 0 : void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener )
177 : throw (uno::RuntimeException)
178 : {
179 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
180 0 : }
181 :
182 : // ------------------------------------------------------------------------------
183 :
184 0 : void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
185 : throw (uno::RuntimeException)
186 : {
187 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
188 0 : }
189 :
190 : // ------------------------------------------------------------------------------
191 :
192 0 : void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
193 : throw (uno::RuntimeException)
194 : {
195 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
196 0 : }
197 :
198 : // ------------------------------------------------------------------------------
199 :
200 0 : void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener )
201 : throw (uno::RuntimeException)
202 : {
203 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
204 0 : }
205 :
206 : // ------------------------------------------------------------------------------
207 :
208 0 : void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener )
209 : throw (uno::RuntimeException)
210 : {
211 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
212 0 : }
213 :
214 : // ------------------------------------------------------------------------------
215 :
216 0 : void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener )
217 : throw (uno::RuntimeException)
218 : {
219 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
220 0 : }
221 :
222 : // ------------------------------------------------------------------------------
223 :
224 0 : void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener )
225 : throw (uno::RuntimeException)
226 : {
227 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
228 0 : }
229 :
230 : // ------------------------------------------------------------------------------
231 :
232 0 : void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener )
233 : throw (uno::RuntimeException)
234 : {
235 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
236 0 : }
237 :
238 : // ------------------------------------------------------------------------------
239 :
240 0 : void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener )
241 : throw (uno::RuntimeException)
242 : {
243 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
244 0 : }
245 :
246 : // ------------------------------------------------------------------------------
247 :
248 0 : void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener )
249 : throw (uno::RuntimeException)
250 : {
251 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
252 0 : }
253 :
254 : // ------------------------------------------------------------------------------
255 :
256 0 : void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener )
257 : throw (uno::RuntimeException)
258 : {
259 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
260 0 : }
261 :
262 : // XComponent
263 : // ------------------------------------------------------------------------------
264 :
265 0 : void SAL_CALL Window::dispose( )
266 : throw (uno::RuntimeException)
267 : {
268 0 : }
269 :
270 : // ------------------------------------------------------------------------------
271 :
272 0 : void SAL_CALL Window::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
273 : throw (uno::RuntimeException)
274 : {
275 0 : maListeners.addInterface( getCppuType( &xListener ), xListener );
276 0 : }
277 :
278 : // ------------------------------------------------------------------------------
279 :
280 0 : void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
281 : throw (uno::RuntimeException)
282 : {
283 0 : maListeners.removeInterface( getCppuType( &xListener ), xListener );
284 0 : }
285 :
286 : // XServiceInfo
287 : // ------------------------------------------------------------------------------
288 :
289 0 : OUString SAL_CALL Window::getImplementationName( )
290 : throw (uno::RuntimeException)
291 : {
292 0 : return OUString( AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME );
293 : }
294 :
295 : // ------------------------------------------------------------------------------
296 :
297 0 : sal_Bool SAL_CALL Window::supportsService( const OUString& ServiceName )
298 : throw (uno::RuntimeException)
299 : {
300 0 : return ServiceName == AVMEDIA_GST_WINDOW_SERVICENAME;
301 : }
302 :
303 : // ------------------------------------------------------------------------------
304 :
305 0 : uno::Sequence< OUString > SAL_CALL Window::getSupportedServiceNames( )
306 : throw (uno::RuntimeException)
307 : {
308 0 : uno::Sequence< OUString > aRet(1);
309 0 : aRet[0] = AVMEDIA_GST_WINDOW_SERVICENAME ;
310 :
311 0 : return aRet;
312 : }
313 :
314 : } // namespace gstreamer
315 : } // namespace avmedia
316 :
317 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|