xref: /aoo42x/main/unoxml/source/events/event.cxx (revision cdf0e10c)
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 <event.hxx>
29 
30 namespace DOM { namespace events
31 {
32 
33     CEvent::CEvent()
34         : m_canceled(sal_False)
35         , m_phase(PhaseType_CAPTURING_PHASE)
36         , m_bubbles(sal_False)
37         , m_cancelable(sal_True)
38     {
39     }
40 
41     CEvent::~CEvent()
42     {
43     }
44 
45     OUString SAL_CALL CEvent::getType() throw (RuntimeException)
46     {
47         ::osl::MutexGuard const g(m_Mutex);
48         return m_eventType;
49     }
50 
51     Reference< XEventTarget > SAL_CALL
52     CEvent::getTarget() throw (RuntimeException)
53     {
54         ::osl::MutexGuard const g(m_Mutex);
55         return m_target;
56     }
57 
58     Reference< XEventTarget > SAL_CALL
59     CEvent::getCurrentTarget() throw (RuntimeException)
60     {
61         ::osl::MutexGuard const g(m_Mutex);
62         return m_currentTarget;
63     }
64 
65     PhaseType SAL_CALL CEvent::getEventPhase() throw (RuntimeException)
66     {
67         ::osl::MutexGuard const g(m_Mutex);
68         return m_phase;
69     }
70 
71     sal_Bool SAL_CALL CEvent::getBubbles() throw (RuntimeException)
72     {
73         ::osl::MutexGuard const g(m_Mutex);
74         return m_bubbles;
75     }
76 
77     sal_Bool SAL_CALL CEvent::getCancelable() throw (RuntimeException)
78     {
79         ::osl::MutexGuard const g(m_Mutex);
80         return m_cancelable;
81     }
82 
83     com::sun::star::util::Time SAL_CALL
84     CEvent::getTimeStamp() throw (RuntimeException)
85     {
86         ::osl::MutexGuard const g(m_Mutex);
87         return m_time;
88     }
89 
90     void SAL_CALL CEvent::stopPropagation() throw (RuntimeException)
91     {
92         ::osl::MutexGuard const g(m_Mutex);
93         if (m_cancelable) { m_canceled = sal_True; }
94     }
95 
96     void SAL_CALL CEvent::preventDefault() throw (RuntimeException)
97     {
98     }
99 
100     void SAL_CALL
101     CEvent::initEvent(OUString const& eventTypeArg, sal_Bool canBubbleArg,
102         sal_Bool cancelableArg) throw (RuntimeException)
103     {
104         ::osl::MutexGuard const g(m_Mutex);
105 
106         m_eventType = eventTypeArg;
107         m_bubbles = canBubbleArg;
108         m_cancelable = cancelableArg;
109     }
110 
111 }}
112