diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /unoxml/source/events | |
parent | Initial commit. (diff) | |
download | libreoffice-upstream.tar.xz libreoffice-upstream.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | unoxml/source/events/event.cxx | 108 | ||||
-rw-r--r-- | unoxml/source/events/eventdispatcher.cxx | 250 | ||||
-rw-r--r-- | unoxml/source/events/mouseevent.cxx | 196 | ||||
-rw-r--r-- | unoxml/source/events/mutationevent.cxx | 137 | ||||
-rw-r--r-- | unoxml/source/events/uievent.cxx | 115 |
5 files changed, 806 insertions, 0 deletions
diff --git a/unoxml/source/events/event.cxx b/unoxml/source/events/event.cxx new file mode 100644 index 000000000..bc12bb5f8 --- /dev/null +++ b/unoxml/source/events/event.cxx @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <event.hxx> + +using namespace css::uno; +using namespace css::xml::dom::events; + +namespace DOM::events +{ + + CEvent::CEvent() + : m_canceled(false) + , m_phase(PhaseType_CAPTURING_PHASE) + , m_bubbles(false) + , m_cancelable(true) + { + } + + CEvent::~CEvent() + { + } + + OUString SAL_CALL CEvent::getType() + { + ::osl::MutexGuard const g(m_Mutex); + return m_eventType; + } + + Reference< XEventTarget > SAL_CALL + CEvent::getTarget() + { + ::osl::MutexGuard const g(m_Mutex); + return m_target; + } + + Reference< XEventTarget > SAL_CALL + CEvent::getCurrentTarget() + { + ::osl::MutexGuard const g(m_Mutex); + return m_currentTarget; + } + + PhaseType SAL_CALL CEvent::getEventPhase() + { + ::osl::MutexGuard const g(m_Mutex); + return m_phase; + } + + sal_Bool SAL_CALL CEvent::getBubbles() + { + ::osl::MutexGuard const g(m_Mutex); + return m_bubbles; + } + + sal_Bool SAL_CALL CEvent::getCancelable() + { + ::osl::MutexGuard const g(m_Mutex); + return m_cancelable; + } + + css::util::Time SAL_CALL + CEvent::getTimeStamp() + { + ::osl::MutexGuard const g(m_Mutex); + return m_time; + } + + void SAL_CALL CEvent::stopPropagation() + { + ::osl::MutexGuard const g(m_Mutex); + if (m_cancelable) { m_canceled = true; } + } + + void SAL_CALL CEvent::preventDefault() + { + } + + void SAL_CALL + CEvent::initEvent(OUString const& eventTypeArg, sal_Bool canBubbleArg, + sal_Bool cancelableArg) + { + ::osl::MutexGuard const g(m_Mutex); + + m_eventType = eventTypeArg; + m_bubbles = canBubbleArg; + m_cancelable = cancelableArg; + } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/events/eventdispatcher.cxx b/unoxml/source/events/eventdispatcher.cxx new file mode 100644 index 000000000..ef07dff5a --- /dev/null +++ b/unoxml/source/events/eventdispatcher.cxx @@ -0,0 +1,250 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <eventdispatcher.hxx> + +#include <event.hxx> +#include <mutationevent.hxx> +#include <uievent.hxx> +#include <mouseevent.hxx> + +#include "../dom/document.hxx" + +#include <osl/mutex.hxx> + +using namespace css::uno; +using namespace css::xml::dom; +using namespace css::xml::dom::events; + +namespace DOM::events { + + void CEventDispatcher::addListener(xmlNodePtr pNode, const OUString& aType, const Reference<XEventListener>& aListener, bool bCapture) + { + TypeListenerMap *const pTMap = bCapture + ? (& m_CaptureListeners) : (& m_TargetListeners); + + // get the multimap for the specified type + ListenerMap *pMap = nullptr; + auto tIter = pTMap->find(aType); + if (tIter == pTMap->end()) { + // the map has to be created + auto const pair = pTMap->emplace(aType, ListenerMap()); + pMap = & pair.first->second; + } else { + pMap = & tIter->second; + } + assert(pMap != nullptr); + pMap->emplace(pNode, aListener); + } + + void CEventDispatcher::removeListener(xmlNodePtr pNode, const OUString& aType, const Reference<XEventListener>& aListener, bool bCapture) + { + TypeListenerMap *const pTMap = bCapture + ? (& m_CaptureListeners) : (& m_TargetListeners); + + // get the multimap for the specified type + auto tIter = pTMap->find(aType); + if (tIter != pTMap->end()) { + ListenerMap & rMap = tIter->second; + // find listeners of specified type for specified node + ListenerMap::iterator iter = rMap.find(pNode); + while (iter != rMap.end() && iter->first == pNode) + { + // erase all references to specified listener + if (iter->second.is() && iter->second == aListener) + { + iter = rMap.erase(iter); + } + else + ++iter; + } + } + } + + CEventDispatcher::~CEventDispatcher() + { + } + + void CEventDispatcher::callListeners( + TypeListenerMap const& rTMap, + xmlNodePtr const pNode, + const OUString& aType, Reference< XEvent > const& xEvent) + { + // get the multimap for the specified type + TypeListenerMap::const_iterator tIter = rTMap.find(aType); + if (tIter != rTMap.end()) { + ListenerMap const& rMap = tIter->second; + auto iterRange = rMap.equal_range(pNode); + for( auto iter = iterRange.first; iter != iterRange.second; ++iter ) + { + if(iter->second.is()) + (iter->second)->handleEvent(xEvent); + } + } + } + + void CEventDispatcher::dispatchEvent( + DOM::CDocument & rDocument, ::osl::Mutex & rMutex, + xmlNodePtr const pNode, Reference<XNode> const& xNode, + Reference< XEvent > const& i_xEvent) const + { + TypeListenerMap captureListeners; + TypeListenerMap targetListeners; + { + ::osl::MutexGuard g(rMutex); + + captureListeners = m_CaptureListeners; + targetListeners = m_TargetListeners; + } + + if (captureListeners.empty() && targetListeners.empty()) + return; + + CEvent *pEvent = nullptr; // pointer to internal event representation + + OUString const aType = i_xEvent->getType(); + if (aType == "DOMSubtreeModified" || + aType == "DOMNodeInserted" || + aType == "DOMNodeRemoved" || + aType == "DOMNodeRemovedFromDocument" || + aType == "DOMNodeInsertedIntoDocument" || + aType == "DOMAttrModified" || + aType == "DOMCharacterDataModified" ) + { + Reference< XMutationEvent > const aMEvent(i_xEvent, + UNO_QUERY_THROW); + // dispatch a mutation event + // we need to clone the event in order to have complete control + // over the implementation + CMutationEvent* pMEvent = new CMutationEvent; + pMEvent->initMutationEvent( + aType, aMEvent->getBubbles(), aMEvent->getCancelable(), + aMEvent->getRelatedNode(), aMEvent->getPrevValue(), + aMEvent->getNewValue(), aMEvent->getAttrName(), + aMEvent->getAttrChange()); + pEvent = pMEvent; + } else if ( // UIEvent + aType == "DOMFocusIn" || + aType == "DOMFocusOut" || + aType == "DOMActivate" ) + { + Reference< XUIEvent > const aUIEvent(i_xEvent, UNO_QUERY_THROW); + CUIEvent* pUIEvent = new CUIEvent; + pUIEvent->initUIEvent(aType, + aUIEvent->getBubbles(), aUIEvent->getCancelable(), + aUIEvent->getView(), aUIEvent->getDetail()); + pEvent = pUIEvent; + } else if ( // MouseEvent + aType == "click" || + aType == "mousedown" || + aType == "mouseup" || + aType == "mouseover" || + aType == "mousemove" || + aType == "mouseout" ) + { + Reference< XMouseEvent > const aMouseEvent(i_xEvent, + UNO_QUERY_THROW); + CMouseEvent *pMouseEvent = new CMouseEvent; + pMouseEvent->initMouseEvent(aType, + aMouseEvent->getBubbles(), aMouseEvent->getCancelable(), + aMouseEvent->getView(), aMouseEvent->getDetail(), + aMouseEvent->getScreenX(), aMouseEvent->getScreenY(), + aMouseEvent->getClientX(), aMouseEvent->getClientY(), + aMouseEvent->getCtrlKey(), aMouseEvent->getAltKey(), + aMouseEvent->getShiftKey(), aMouseEvent->getMetaKey(), + aMouseEvent->getButton(), aMouseEvent->getRelatedTarget()); + pEvent = pMouseEvent; + } + else // generic event + { + pEvent = new CEvent; + pEvent->initEvent( + aType, i_xEvent->getBubbles(), i_xEvent->getCancelable()); + } + pEvent->m_target.set(xNode, UNO_QUERY_THROW); + pEvent->m_currentTarget = i_xEvent->getCurrentTarget(); + pEvent->m_time = i_xEvent->getTimeStamp(); + + // create the reference to the private event implementation + // that will be dispatched to the listeners + Reference< XEvent > const xEvent(pEvent); + + // build the path from target node to the root + typedef std::vector< ::std::pair<Reference<XEventTarget>, xmlNodePtr> > + NodeVector_t; + NodeVector_t captureVector; + { + ::osl::MutexGuard g(rMutex); + + xmlNodePtr cur = pNode; + while (cur != nullptr) + { + Reference< XEventTarget > const xRef( + rDocument.GetCNode(cur).get()); + captureVector.emplace_back(xRef, cur); + cur = cur->parent; + } + } + + // the capture vector now holds the node path from target to root + // first we must search for capture listeners in order root to + // to target. after that, any target listeners have to be called + // then bubbeling phase listeners are called in target to root + // order + // start at the root + NodeVector_t::const_reverse_iterator rinode = + const_cast<NodeVector_t const&>(captureVector).rbegin(); + if (rinode != const_cast<NodeVector_t const&>(captureVector).rend()) + { + // capturing phase: + pEvent->m_phase = PhaseType_CAPTURING_PHASE; + while (rinode != + const_cast<NodeVector_t const&>(captureVector).rend()) + { + pEvent->m_currentTarget = rinode->first; + callListeners(captureListeners, rinode->second, aType, xEvent); + if (pEvent->m_canceled) return; + ++rinode; + } + + NodeVector_t::const_iterator inode = captureVector.begin(); + + // target phase + pEvent->m_phase = PhaseType_AT_TARGET; + pEvent->m_currentTarget = inode->first; + callListeners(targetListeners, inode->second, aType, xEvent); + if (pEvent->m_canceled) return; + // bubbeling phase + ++inode; + if (i_xEvent->getBubbles()) { + pEvent->m_phase = PhaseType_BUBBLING_PHASE; + while (inode != captureVector.end()) + { + pEvent->m_currentTarget = inode->first; + callListeners(targetListeners, + inode->second, aType, xEvent); + if (pEvent->m_canceled) return; + ++inode; + } + } + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/events/mouseevent.cxx b/unoxml/source/events/mouseevent.cxx new file mode 100644 index 000000000..8f276f0ea --- /dev/null +++ b/unoxml/source/events/mouseevent.cxx @@ -0,0 +1,196 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <mouseevent.hxx> + +using namespace css::uno; +using namespace css::xml::dom::events; +using namespace css::xml::dom::views; + +namespace DOM::events +{ + CMouseEvent::CMouseEvent() + : CMouseEvent_Base() + , m_screenX(0) + , m_screenY(0) + , m_clientX(0) + , m_clientY(0) + , m_ctrlKey(false) + , m_shiftKey(false) + , m_altKey(false) + , m_metaKey(false) + , m_button(0) + { + } + + sal_Int32 SAL_CALL CMouseEvent::getScreenX() + { + ::osl::MutexGuard const g(m_Mutex); + return m_screenX; + } + sal_Int32 SAL_CALL CMouseEvent::getScreenY() + { + ::osl::MutexGuard const g(m_Mutex); + return m_screenY; + } + sal_Int32 SAL_CALL CMouseEvent::getClientX() + { + ::osl::MutexGuard const g(m_Mutex); + return m_clientX; + } + sal_Int32 SAL_CALL CMouseEvent::getClientY() + { + ::osl::MutexGuard const g(m_Mutex); + return m_clientY; + } + sal_Bool SAL_CALL CMouseEvent::getCtrlKey() + { + ::osl::MutexGuard const g(m_Mutex); + return m_ctrlKey; + } + sal_Bool SAL_CALL CMouseEvent::getShiftKey() + { + ::osl::MutexGuard const g(m_Mutex); + return m_shiftKey; + } + sal_Bool SAL_CALL CMouseEvent::getAltKey() + { + ::osl::MutexGuard const g(m_Mutex); + return m_altKey; + } + sal_Bool SAL_CALL CMouseEvent::getMetaKey() + { + ::osl::MutexGuard const g(m_Mutex); + return m_metaKey; + } + sal_Int16 SAL_CALL CMouseEvent::getButton() + { + ::osl::MutexGuard const g(m_Mutex); + return m_button; + } + Reference< XEventTarget > SAL_CALL CMouseEvent::getRelatedTarget() + { + return Reference< XEventTarget >(); + } + + void SAL_CALL CMouseEvent::initMouseEvent( + const OUString& typeArg, + sal_Bool canBubbleArg, + sal_Bool cancelableArg, + const Reference< XAbstractView >& viewArg, + sal_Int32 detailArg, + sal_Int32 screenXArg, + sal_Int32 screenYArg, + sal_Int32 clientXArg, + sal_Int32 clientYArg, + sal_Bool ctrlKeyArg, + sal_Bool altKeyArg, + sal_Bool shiftKeyArg, + sal_Bool metaKeyArg, + sal_Int16 buttonArg, + const Reference< XEventTarget >& /*relatedTargetArg*/) + { + ::osl::MutexGuard const g(m_Mutex); + + CUIEvent::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg); + m_screenX = screenXArg; + m_screenY = screenYArg; + m_clientX = clientXArg; + m_clientY = clientYArg; + m_ctrlKey = ctrlKeyArg; + m_altKey = altKeyArg; + m_shiftKey = shiftKeyArg; + m_metaKey = metaKeyArg; + m_button = buttonArg; + } + + // delegate to CUIEvent, since we are inheriting from CUIEvent and XUIEvent + Reference< XAbstractView > SAL_CALL CMouseEvent::getView() + { + return CUIEvent::getView(); + } + + sal_Int32 SAL_CALL CMouseEvent::getDetail() + { + return CUIEvent::getDetail(); + } + + void SAL_CALL CMouseEvent::initUIEvent(const OUString& typeArg, + sal_Bool canBubbleArg, + sal_Bool cancelableArg, + const Reference< XAbstractView >& viewArg, + sal_Int32 detailArg) + { + CUIEvent::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg); + } + + OUString SAL_CALL CMouseEvent::getType() + { + return CUIEvent::getType(); + } + + Reference< XEventTarget > SAL_CALL CMouseEvent::getTarget() + { + return CUIEvent::getTarget(); + } + + Reference< XEventTarget > SAL_CALL CMouseEvent::getCurrentTarget() + { + return CUIEvent::getCurrentTarget(); + } + + PhaseType SAL_CALL CMouseEvent::getEventPhase() + { + return CUIEvent::getEventPhase(); + } + + sal_Bool SAL_CALL CMouseEvent::getBubbles() + { + return CEvent::getBubbles(); + } + + sal_Bool SAL_CALL CMouseEvent::getCancelable() + { + return CUIEvent::getCancelable(); + } + + css::util::Time SAL_CALL CMouseEvent::getTimeStamp() + { + return CUIEvent::getTimeStamp(); + } + + void SAL_CALL CMouseEvent::stopPropagation() + { + CUIEvent::stopPropagation(); + } + + void SAL_CALL CMouseEvent::preventDefault() + { + CUIEvent::preventDefault(); + } + + void SAL_CALL CMouseEvent::initEvent(const OUString& eventTypeArg, sal_Bool canBubbleArg, + sal_Bool cancelableArg) + { + // base initializer + CUIEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/events/mutationevent.cxx b/unoxml/source/events/mutationevent.cxx new file mode 100644 index 000000000..a81720c7c --- /dev/null +++ b/unoxml/source/events/mutationevent.cxx @@ -0,0 +1,137 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <mutationevent.hxx> + +using namespace css::uno; +using namespace css::xml::dom; +using namespace css::xml::dom::events; + +namespace DOM::events +{ + CMutationEvent::CMutationEvent() + : CMutationEvent_Base() + , m_attrChangeType(AttrChangeType_MODIFICATION) + { + } + + CMutationEvent::~CMutationEvent() + { + } + + Reference< XNode > SAL_CALL CMutationEvent::getRelatedNode() + { + ::osl::MutexGuard const g(m_Mutex); + return m_relatedNode; + } + + OUString SAL_CALL CMutationEvent::getPrevValue() + { + ::osl::MutexGuard const g(m_Mutex); + return m_prevValue; + } + + OUString SAL_CALL CMutationEvent::getNewValue() + { + ::osl::MutexGuard const g(m_Mutex); + return m_newValue; + } + + OUString SAL_CALL CMutationEvent::getAttrName() + { + ::osl::MutexGuard const g(m_Mutex); + return m_attrName; + } + + AttrChangeType SAL_CALL CMutationEvent::getAttrChange() + { + ::osl::MutexGuard const g(m_Mutex); + return m_attrChangeType; + } + + void SAL_CALL CMutationEvent::initMutationEvent(const OUString& typeArg, + sal_Bool canBubbleArg, sal_Bool cancelableArg, + const Reference< XNode >& relatedNodeArg, const OUString& prevValueArg, + const OUString& newValueArg, const OUString& attrNameArg, + AttrChangeType attrChangeArg) + { + ::osl::MutexGuard const g(m_Mutex); + + CEvent::initEvent(typeArg, canBubbleArg, cancelableArg); + m_relatedNode = relatedNodeArg; + m_prevValue = prevValueArg; + m_newValue = newValueArg; + m_attrName = attrNameArg; + m_attrChangeType = attrChangeArg; + } + + // delegate to CEvent, since we are inheriting from CEvent and XEvent + OUString SAL_CALL CMutationEvent::getType() + { + return CEvent::getType(); + } + + Reference< XEventTarget > SAL_CALL CMutationEvent::getTarget() + { + return CEvent::getTarget(); + } + + Reference< XEventTarget > SAL_CALL CMutationEvent::getCurrentTarget() + { + return CEvent::getCurrentTarget(); + } + + PhaseType SAL_CALL CMutationEvent::getEventPhase() + { + return CEvent::getEventPhase(); + } + + sal_Bool SAL_CALL CMutationEvent::getBubbles() + { + return CEvent::getBubbles(); + } + + sal_Bool SAL_CALL CMutationEvent::getCancelable() + { + return CEvent::getCancelable(); + } + + css::util::Time SAL_CALL CMutationEvent::getTimeStamp() + { + return CEvent::getTimeStamp(); + } + + void SAL_CALL CMutationEvent::stopPropagation() + { + CEvent::stopPropagation(); + } + void SAL_CALL CMutationEvent::preventDefault() + { + CEvent::preventDefault(); + } + + void SAL_CALL CMutationEvent::initEvent(const OUString& eventTypeArg, sal_Bool canBubbleArg, + sal_Bool cancelableArg) + { + // base initializer + CEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/events/uievent.cxx b/unoxml/source/events/uievent.cxx new file mode 100644 index 000000000..faa15113b --- /dev/null +++ b/unoxml/source/events/uievent.cxx @@ -0,0 +1,115 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <uievent.hxx> + +using namespace css::uno; +using namespace css::xml::dom::events; +using namespace css::xml::dom::views; + +namespace DOM::events +{ + CUIEvent::CUIEvent() + : CUIEvent_Base() + , m_detail(0) + { + } + + Reference< XAbstractView > SAL_CALL + CUIEvent::getView() + { + ::osl::MutexGuard const g(m_Mutex); + return m_view; + } + + sal_Int32 SAL_CALL CUIEvent::getDetail() + { + ::osl::MutexGuard const g(m_Mutex); + return m_detail; + } + + void SAL_CALL CUIEvent::initUIEvent(const OUString& typeArg, + sal_Bool canBubbleArg, + sal_Bool cancelableArg, + const Reference< XAbstractView >& viewArg, + sal_Int32 detailArg) + { + ::osl::MutexGuard const g(m_Mutex); + + CEvent::initEvent(typeArg, canBubbleArg, cancelableArg); + m_view = viewArg; + m_detail = detailArg; + } + + + // delegate to CEvent, since we are inheriting from CEvent and XEvent + OUString SAL_CALL CUIEvent::getType() + { + return CEvent::getType(); + } + + Reference< XEventTarget > SAL_CALL CUIEvent::getTarget() + { + return CEvent::getTarget(); + } + + Reference< XEventTarget > SAL_CALL CUIEvent::getCurrentTarget() + { + return CEvent::getCurrentTarget(); + } + + PhaseType SAL_CALL CUIEvent::getEventPhase() + { + return CEvent::getEventPhase(); + } + + sal_Bool SAL_CALL CUIEvent::getBubbles() + { + return CEvent::getBubbles(); + } + + sal_Bool SAL_CALL CUIEvent::getCancelable() + { + // mutation events cannot be canceled + return false; + } + + css::util::Time SAL_CALL CUIEvent::getTimeStamp() + { + return CEvent::getTimeStamp(); + } + + void SAL_CALL CUIEvent::stopPropagation() + { + CEvent::stopPropagation(); + } + void SAL_CALL CUIEvent::preventDefault() + { + CEvent::preventDefault(); + } + + void SAL_CALL CUIEvent::initEvent(const OUString& eventTypeArg, sal_Bool canBubbleArg, + sal_Bool cancelableArg) + { + // base initializer + CEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |