1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include <mouseevent.hxx>
29 
30 namespace DOM { namespace events
31 {
32     CMouseEvent::CMouseEvent()
33         : CMouseEvent_Base()
34         , m_screenX(0)
35         , m_screenY(0)
36         , m_clientX(0)
37         , m_clientY(0)
38         , m_ctrlKey(sal_False)
39         , m_shiftKey(sal_False)
40         , m_altKey(sal_False)
41         , m_metaKey(sal_False)
42         , m_button(0)
43     {
44     }
45 
46     sal_Int32 SAL_CALL CMouseEvent::getScreenX() throw (RuntimeException)
47     {
48         ::osl::MutexGuard const g(m_Mutex);
49         return m_screenX;
50     }
51     sal_Int32 SAL_CALL CMouseEvent::getScreenY() throw (RuntimeException)
52     {
53         ::osl::MutexGuard const g(m_Mutex);
54         return m_screenY;
55     }
56     sal_Int32 SAL_CALL CMouseEvent::getClientX() throw (RuntimeException)
57     {
58         ::osl::MutexGuard const g(m_Mutex);
59         return m_clientX;
60     }
61     sal_Int32 SAL_CALL CMouseEvent::getClientY() throw (RuntimeException)
62     {
63         ::osl::MutexGuard const g(m_Mutex);
64         return m_clientY;
65     }
66     sal_Bool SAL_CALL CMouseEvent::getCtrlKey() throw (RuntimeException)
67     {
68         ::osl::MutexGuard const g(m_Mutex);
69         return m_ctrlKey;
70     }
71     sal_Bool SAL_CALL CMouseEvent::getShiftKey() throw (RuntimeException)
72     {
73         ::osl::MutexGuard const g(m_Mutex);
74         return m_shiftKey;
75     }
76     sal_Bool SAL_CALL CMouseEvent::getAltKey() throw (RuntimeException)
77     {
78         ::osl::MutexGuard const g(m_Mutex);
79         return m_altKey;
80     }
81     sal_Bool SAL_CALL CMouseEvent::getMetaKey() throw (RuntimeException)
82     {
83         ::osl::MutexGuard const g(m_Mutex);
84         return m_metaKey;
85     }
86     sal_Int16 SAL_CALL CMouseEvent::getButton() throw (RuntimeException)
87     {
88         ::osl::MutexGuard const g(m_Mutex);
89         return m_button;
90     }
91     Reference< XEventTarget > SAL_CALL CMouseEvent::getRelatedTarget()  throw(RuntimeException)
92     {
93         ::osl::MutexGuard const g(m_Mutex);
94         return m_relatedTarget;
95     }
96 
97     void SAL_CALL CMouseEvent::initMouseEvent(
98                         const OUString& typeArg,
99                         sal_Bool canBubbleArg,
100                         sal_Bool cancelableArg,
101                         const Reference< XAbstractView >& viewArg,
102                         sal_Int32 detailArg,
103                         sal_Int32 screenXArg,
104                         sal_Int32 screenYArg,
105                         sal_Int32 clientXArg,
106                         sal_Int32 clientYArg,
107                         sal_Bool ctrlKeyArg,
108                         sal_Bool altKeyArg,
109                         sal_Bool shiftKeyArg,
110                         sal_Bool metaKeyArg,
111                         sal_Int16 buttonArg,
112                         const Reference< XEventTarget >& /*relatedTargetArg*/)
113         throw(RuntimeException)
114     {
115         ::osl::MutexGuard const g(m_Mutex);
116 
117         CUIEvent::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
118         m_screenX = screenXArg;
119         m_screenY = screenYArg;
120         m_clientX = clientXArg;
121         m_clientY = clientYArg;
122         m_ctrlKey = ctrlKeyArg;
123         m_altKey = altKeyArg;
124         m_shiftKey = shiftKeyArg;
125         m_metaKey = metaKeyArg;
126         m_button = buttonArg;
127     }
128 
129     // delegate to CUIEvent, since we are inheriting from CUIEvent and XUIEvent
130     Reference< XAbstractView > SAL_CALL CMouseEvent::getView() throw(RuntimeException)
131     {
132         return CUIEvent::getView();
133     }
134 
135     sal_Int32 SAL_CALL CMouseEvent::getDetail() throw(RuntimeException)
136     {
137         return CUIEvent::getDetail();
138     }
139 
140     void SAL_CALL CMouseEvent::initUIEvent(const OUString& typeArg,
141                      sal_Bool canBubbleArg,
142                      sal_Bool cancelableArg,
143                      const Reference< XAbstractView >& viewArg,
144                      sal_Int32 detailArg) throw(RuntimeException)
145     {
146         CUIEvent::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
147     }
148 
149     OUString SAL_CALL CMouseEvent::getType() throw (RuntimeException)
150     {
151         return CUIEvent::getType();
152     }
153 
154     Reference< XEventTarget > SAL_CALL CMouseEvent::getTarget() throw (RuntimeException)
155     {
156         return CUIEvent::getTarget();
157     }
158 
159     Reference< XEventTarget > SAL_CALL CMouseEvent::getCurrentTarget() throw (RuntimeException)
160     {
161         return CUIEvent::getCurrentTarget();
162     }
163 
164     PhaseType SAL_CALL CMouseEvent::getEventPhase() throw (RuntimeException)
165     {
166         return CUIEvent::getEventPhase();
167     }
168 
169     sal_Bool SAL_CALL CMouseEvent::getBubbles() throw (RuntimeException)
170     {
171         return CEvent::getBubbles();
172     }
173 
174     sal_Bool SAL_CALL CMouseEvent::getCancelable() throw (RuntimeException)
175     {
176         return CUIEvent::getCancelable();
177     }
178 
179     com::sun::star::util::Time SAL_CALL CMouseEvent::getTimeStamp() throw (RuntimeException)
180     {
181         return CUIEvent::getTimeStamp();
182     }
183 
184     void SAL_CALL CMouseEvent::stopPropagation() throw (RuntimeException)
185     {
186         CUIEvent::stopPropagation();
187     }
188 
189     void SAL_CALL CMouseEvent::preventDefault() throw (RuntimeException)
190     {
191         CUIEvent::preventDefault();
192     }
193 
194     void SAL_CALL CMouseEvent::initEvent(const OUString& eventTypeArg, sal_Bool canBubbleArg,
195         sal_Bool cancelableArg) throw (RuntimeException)
196     {
197         // base initializer
198         CUIEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg);
199     }
200 }}
201 
202