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