xref: /aoo4110/main/unoxml/source/events/event.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include <event.hxx>
25 
26 namespace DOM { namespace events
27 {
28 
CEvent()29     CEvent::CEvent()
30         : m_canceled(sal_False)
31         , m_phase(PhaseType_CAPTURING_PHASE)
32         , m_bubbles(sal_False)
33         , m_cancelable(sal_True)
34     {
35     }
36 
~CEvent()37     CEvent::~CEvent()
38     {
39     }
40 
getType()41     OUString SAL_CALL CEvent::getType() throw (RuntimeException)
42     {
43         ::osl::MutexGuard const g(m_Mutex);
44         return m_eventType;
45     }
46 
47     Reference< XEventTarget > SAL_CALL
getTarget()48     CEvent::getTarget() throw (RuntimeException)
49     {
50         ::osl::MutexGuard const g(m_Mutex);
51         return m_target;
52     }
53 
54     Reference< XEventTarget > SAL_CALL
getCurrentTarget()55     CEvent::getCurrentTarget() throw (RuntimeException)
56     {
57         ::osl::MutexGuard const g(m_Mutex);
58         return m_currentTarget;
59     }
60 
getEventPhase()61     PhaseType SAL_CALL CEvent::getEventPhase() throw (RuntimeException)
62     {
63         ::osl::MutexGuard const g(m_Mutex);
64         return m_phase;
65     }
66 
getBubbles()67     sal_Bool SAL_CALL CEvent::getBubbles() throw (RuntimeException)
68     {
69         ::osl::MutexGuard const g(m_Mutex);
70         return m_bubbles;
71     }
72 
getCancelable()73     sal_Bool SAL_CALL CEvent::getCancelable() throw (RuntimeException)
74     {
75         ::osl::MutexGuard const g(m_Mutex);
76         return m_cancelable;
77     }
78 
79     com::sun::star::util::Time SAL_CALL
getTimeStamp()80     CEvent::getTimeStamp() throw (RuntimeException)
81     {
82         ::osl::MutexGuard const g(m_Mutex);
83         return m_time;
84     }
85 
stopPropagation()86     void SAL_CALL CEvent::stopPropagation() throw (RuntimeException)
87     {
88         ::osl::MutexGuard const g(m_Mutex);
89         if (m_cancelable) { m_canceled = sal_True; }
90     }
91 
preventDefault()92     void SAL_CALL CEvent::preventDefault() throw (RuntimeException)
93     {
94     }
95 
96     void SAL_CALL
initEvent(OUString const & eventTypeArg,sal_Bool canBubbleArg,sal_Bool cancelableArg)97     CEvent::initEvent(OUString const& eventTypeArg, sal_Bool canBubbleArg,
98         sal_Bool cancelableArg) throw (RuntimeException)
99     {
100         ::osl::MutexGuard const g(m_Mutex);
101 
102         m_eventType = eventTypeArg;
103         m_bubbles = canBubbleArg;
104         m_cancelable = cancelableArg;
105     }
106 
107 }}
108