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 2000, 2010 Oracle and/or its affiliates.
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 "mediaevent_impl.hxx"
30 : : #include "mediawindow_impl.hxx"
31 : : #include <osl/mutex.hxx>
32 : : #include <vcl/svapp.hxx>
33 : : #include <vcl/event.hxx>
34 : :
35 : : using namespace ::com::sun::star;
36 : :
37 : : /* Definition of MediaWindowImpl class */
38 : :
39 : : namespace avmedia { namespace priv {
40 : : // ---------------------------
41 : : // - MediaEventListenersImpl -
42 : : // ---------------------------
43 : :
44 : 0 : MediaEventListenersImpl::MediaEventListenersImpl( Window& rEventWindow ) :
45 [ # # ]: 0 : mpNotifyWindow( &rEventWindow )
46 : : {
47 : 0 : }
48 : :
49 : : // ---------------------------------------------------------------------
50 : :
51 [ # # ]: 0 : MediaEventListenersImpl::~MediaEventListenersImpl()
52 : : {
53 [ # # ]: 0 : }
54 : :
55 : : // ---------------------------------------------------------------------
56 : :
57 : 0 : void MediaEventListenersImpl::cleanUp()
58 : : {
59 : 0 : Application::RemoveMouseAndKeyEvents( reinterpret_cast< ::Window* >( mpNotifyWindow ) );
60 : 0 : mpNotifyWindow = NULL;
61 : 0 : }
62 : :
63 : : // ---------------------------------------------------------------------
64 : :
65 : 0 : void SAL_CALL MediaEventListenersImpl::disposing( const ::com::sun::star::lang::EventObject& /* Source */ )
66 : : throw (::com::sun::star::uno::RuntimeException)
67 : : {
68 : 0 : }
69 : :
70 : : // ---------------------------------------------------------------------
71 : :
72 : 0 : void SAL_CALL MediaEventListenersImpl::keyPressed( const ::com::sun::star::awt::KeyEvent& e )
73 : : throw (::com::sun::star::uno::RuntimeException)
74 : : {
75 [ # # ]: 0 : const ::osl::MutexGuard aGuard( maMutex );
76 [ # # ]: 0 : const SolarMutexGuard aAppGuard;
77 : :
78 [ # # ]: 0 : if( mpNotifyWindow )
79 : : {
80 : : KeyCode aVCLKeyCode( e.KeyCode,
81 : : ( ( e.Modifiers & 1 ) ? KEY_SHIFT : 0 ) |
82 : : ( ( e.Modifiers & 2 ) ? KEY_MOD1 : 0 ) |
83 [ # # ][ # # ]: 0 : ( ( e.Modifiers & 4 ) ? KEY_MOD2 : 0 ) );
[ # # ]
84 [ # # ]: 0 : KeyEvent aVCLKeyEvt( e.KeyChar, aVCLKeyCode );
85 : :
86 [ # # ]: 0 : Application::PostKeyEvent( VCLEVENT_WINDOW_KEYINPUT, reinterpret_cast< ::Window* >( mpNotifyWindow ), &aVCLKeyEvt );
87 [ # # ][ # # ]: 0 : }
88 : 0 : }
89 : :
90 : : // ---------------------------------------------------------------------
91 : :
92 : 0 : void SAL_CALL MediaEventListenersImpl::keyReleased( const ::com::sun::star::awt::KeyEvent& e )
93 : : throw (::com::sun::star::uno::RuntimeException)
94 : : {
95 [ # # ]: 0 : const ::osl::MutexGuard aGuard( maMutex );
96 [ # # ]: 0 : const SolarMutexGuard aAppGuard;
97 : :
98 [ # # ]: 0 : if( mpNotifyWindow )
99 : : {
100 : : KeyCode aVCLKeyCode( e.KeyCode,
101 : : ( ( e.Modifiers & 1 ) ? KEY_SHIFT : 0 ) |
102 : : ( ( e.Modifiers & 2 ) ? KEY_MOD1 : 0 ) |
103 [ # # ][ # # ]: 0 : ( ( e.Modifiers & 4 ) ? KEY_MOD2 : 0 ) );
[ # # ]
104 [ # # ]: 0 : KeyEvent aVCLKeyEvt( e.KeyChar, aVCLKeyCode );
105 [ # # ]: 0 : Application::PostKeyEvent( VCLEVENT_WINDOW_KEYUP, reinterpret_cast< ::Window* >( mpNotifyWindow ), &aVCLKeyEvt );
106 [ # # ][ # # ]: 0 : }
107 : 0 : }
108 : :
109 : : // ---------------------------------------------------------------------
110 : :
111 : 0 : void SAL_CALL MediaEventListenersImpl::mousePressed( const ::com::sun::star::awt::MouseEvent& e )
112 : : throw (::com::sun::star::uno::RuntimeException)
113 : : {
114 [ # # ]: 0 : const ::osl::MutexGuard aGuard( maMutex );
115 [ # # ]: 0 : const SolarMutexGuard aAppGuard;
116 : :
117 [ # # ]: 0 : if( mpNotifyWindow )
118 : : {
119 : : MouseEvent aVCLMouseEvt( Point( e.X, e.Y ),
120 : 0 : sal::static_int_cast< sal_uInt16 >(e.ClickCount),
121 : : 0,
122 : : ( ( e.Buttons & 1 ) ? MOUSE_LEFT : 0 ) |
123 : : ( ( e.Buttons & 2 ) ? MOUSE_RIGHT : 0 ) |
124 : : ( ( e.Buttons & 4 ) ? MOUSE_MIDDLE : 0 ),
125 [ # # ][ # # ]: 0 : e.Modifiers );
[ # # ]
126 [ # # ]: 0 : Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, reinterpret_cast< ::Window* >( mpNotifyWindow ), &aVCLMouseEvt );
127 [ # # ][ # # ]: 0 : }
128 : 0 : }
129 : :
130 : : // ----------------------------------------------gvd-----------------------
131 : :
132 : 0 : void SAL_CALL MediaEventListenersImpl::mouseReleased( const ::com::sun::star::awt::MouseEvent& e )
133 : : throw (::com::sun::star::uno::RuntimeException)
134 : : {
135 [ # # ]: 0 : const ::osl::MutexGuard aGuard( maMutex );
136 [ # # ]: 0 : const SolarMutexGuard aAppGuard;
137 : :
138 [ # # ]: 0 : if( mpNotifyWindow )
139 : : {
140 : : MouseEvent aVCLMouseEvt( Point( e.X, e.Y ),
141 : 0 : sal::static_int_cast< sal_uInt16 >(e.ClickCount),
142 : : 0,
143 : : ( ( e.Buttons & 1 ) ? MOUSE_LEFT : 0 ) |
144 : : ( ( e.Buttons & 2 ) ? MOUSE_RIGHT : 0 ) |
145 : : ( ( e.Buttons & 4 ) ? MOUSE_MIDDLE : 0 ),
146 [ # # ][ # # ]: 0 : e.Modifiers );
[ # # ]
147 [ # # ]: 0 : Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONUP, reinterpret_cast< ::Window* >( mpNotifyWindow ), &aVCLMouseEvt );
148 [ # # ][ # # ]: 0 : }
149 : 0 : }
150 : :
151 : : // ---------------------------------------------------------------------
152 : :
153 : 0 : void SAL_CALL MediaEventListenersImpl::mouseEntered( const ::com::sun::star::awt::MouseEvent& /* e */ )
154 : : throw (::com::sun::star::uno::RuntimeException)
155 : : {
156 [ # # ]: 0 : const ::osl::MutexGuard aGuard( maMutex );
157 [ # # ]: 0 : const SolarMutexGuard aAppGuard;
158 : :
159 : 0 : if( mpNotifyWindow )
160 : : {
161 [ # # ][ # # ]: 0 : }
162 : 0 : }
163 : :
164 : : // ---------------------------------------------------------------------
165 : :
166 : 0 : void SAL_CALL MediaEventListenersImpl::mouseExited( const ::com::sun::star::awt::MouseEvent& /* e */ )
167 : : throw (::com::sun::star::uno::RuntimeException)
168 : : {
169 [ # # ]: 0 : const ::osl::MutexGuard aGuard( maMutex );
170 [ # # ]: 0 : const SolarMutexGuard aAppGuard;
171 : :
172 : 0 : if( mpNotifyWindow )
173 : : {
174 [ # # ][ # # ]: 0 : }
175 : 0 : }
176 : :
177 : : // ---------------------------------------------------------------------
178 : :
179 : 0 : void SAL_CALL MediaEventListenersImpl::mouseDragged( const ::com::sun::star::awt::MouseEvent& e )
180 : : throw (::com::sun::star::uno::RuntimeException)
181 : : {
182 [ # # ]: 0 : const ::osl::MutexGuard aGuard( maMutex );
183 [ # # ]: 0 : const SolarMutexGuard aAppGuard;
184 : :
185 [ # # ]: 0 : if( mpNotifyWindow )
186 : : {
187 [ # # ]: 0 : MouseEvent aVCLMouseEvt( Point( e.X, e.Y ), 0, 0, e.Buttons, e.Modifiers );
188 [ # # ]: 0 : Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< ::Window* >( mpNotifyWindow ), &aVCLMouseEvt );
189 [ # # ][ # # ]: 0 : }
190 : 0 : }
191 : :
192 : : // ---------------------------------------------------------------------
193 : :
194 : 0 : void SAL_CALL MediaEventListenersImpl::mouseMoved( const ::com::sun::star::awt::MouseEvent& e )
195 : : throw (::com::sun::star::uno::RuntimeException)
196 : : {
197 [ # # ]: 0 : const ::osl::MutexGuard aGuard( maMutex );
198 [ # # ]: 0 : const SolarMutexGuard aAppGuard;
199 : :
200 [ # # ]: 0 : if( mpNotifyWindow )
201 : : {
202 [ # # ]: 0 : MouseEvent aVCLMouseEvt( Point( e.X, e.Y ), 0, 0, e.Buttons, e.Modifiers );
203 [ # # ]: 0 : Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, reinterpret_cast< ::Window* >( mpNotifyWindow ), &aVCLMouseEvt );
204 [ # # ][ # # ]: 0 : }
205 : 0 : }
206 : :
207 : : // ---------------------------------------------------------------------
208 : :
209 : 0 : void SAL_CALL MediaEventListenersImpl::focusGained( const ::com::sun::star::awt::FocusEvent& /* e */ )
210 : : throw (::com::sun::star::uno::RuntimeException)
211 : : {
212 : 0 : }
213 : :
214 : : // ---------------------------------------------------------------------
215 : :
216 : 0 : void SAL_CALL MediaEventListenersImpl::focusLost( const ::com::sun::star::awt::FocusEvent& /* e */ )
217 : : throw (::com::sun::star::uno::RuntimeException)
218 : : {
219 : 0 : }
220 : :
221 : : } // namespace priv
222 : : } // namespace avemdia
223 : :
224 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|