summaryrefslogtreecommitdiff
path: root/unoxml/source/events
diff options
context:
space:
mode:
Diffstat (limited to 'unoxml/source/events')
-rw-r--r--unoxml/source/events/event.cxx62
-rw-r--r--unoxml/source/events/event.hxx70
-rw-r--r--unoxml/source/events/eventdispatcher.cxx198
-rw-r--r--unoxml/source/events/eventdispatcher.hxx51
-rw-r--r--unoxml/source/events/makefile.mk56
-rw-r--r--unoxml/source/events/mouseevent.cxx149
-rw-r--r--unoxml/source/events/mouseevent.hxx92
-rw-r--r--unoxml/source/events/mutationevent.cxx100
-rw-r--r--unoxml/source/events/mutationevent.hxx66
-rw-r--r--unoxml/source/events/testlistener.cxx137
-rw-r--r--unoxml/source/events/testlistener.hxx106
-rw-r--r--unoxml/source/events/uievent.cxx81
-rw-r--r--unoxml/source/events/uievent.hxx55
13 files changed, 1223 insertions, 0 deletions
diff --git a/unoxml/source/events/event.cxx b/unoxml/source/events/event.cxx
new file mode 100644
index 000000000000..1d41bbba9911
--- /dev/null
+++ b/unoxml/source/events/event.cxx
@@ -0,0 +1,62 @@
+#include "event.hxx"
+
+namespace DOM { namespace events
+{
+
+ CEvent::~CEvent()
+ {
+ }
+
+ OUString SAL_CALL CEvent::getType() throw (RuntimeException)
+ {
+ return m_eventType;
+ }
+
+ Reference< XEventTarget > SAL_CALL CEvent::getTarget() throw (RuntimeException)
+ {
+ return m_target;
+ }
+
+ Reference< XEventTarget > SAL_CALL CEvent::getCurrentTarget() throw (RuntimeException)
+ {
+ return m_currentTarget;
+ }
+
+ PhaseType SAL_CALL CEvent::getEventPhase() throw (RuntimeException)
+ {
+ return m_phase;
+ }
+
+ sal_Bool SAL_CALL CEvent::getBubbles() throw (RuntimeException)
+ {
+ return m_bubbles;
+ }
+
+ sal_Bool SAL_CALL CEvent::getCancelable() throw (RuntimeException)
+ {
+ return m_cancelable;
+ }
+
+ com::sun::star::util::Time SAL_CALL CEvent::getTimeStamp() throw (RuntimeException)
+ {
+ return m_time;
+ }
+
+ void SAL_CALL CEvent::stopPropagation() throw (RuntimeException)
+ {
+ if (m_cancelable) m_canceled = sal_True;
+ }
+
+ void SAL_CALL CEvent::preventDefault() throw (RuntimeException)
+ {
+ }
+
+ void SAL_CALL CEvent::initEvent(const OUString& eventTypeArg, sal_Bool canBubbleArg,
+ sal_Bool cancelableArg) throw (RuntimeException)
+ {
+ m_eventType = eventTypeArg;
+ m_bubbles = canBubbleArg;
+ m_cancelable = cancelableArg;
+ }
+
+}}
diff --git a/unoxml/source/events/event.hxx b/unoxml/source/events/event.hxx
new file mode 100644
index 000000000000..3620d84374dc
--- /dev/null
+++ b/unoxml/source/events/event.hxx
@@ -0,0 +1,70 @@
+#ifndef __EVENT_HXX
+#define __EVENT_HXX
+
+#include <sal/types.h>
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/events/XEventTarget.hpp>
+#include <com/sun/star/util/Time.hpp>
+
+#include "../dom/node.hxx"
+
+#include <libxml/tree.h>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::xml::dom;
+using namespace com::sun::star::xml::dom::events;
+
+
+namespace DOM {namespace events
+{
+class CEvent : public cppu::WeakImplHelper1< XEvent >
+{
+friend class CEventDispatcher;
+friend class CNode;
+friend class CDocument;
+friend class CElement;
+friend class CText;
+friend class CCharacterData;
+friend class CAttr;
+
+
+private:
+ sal_Bool m_canceled;
+
+protected:
+ OUString m_eventType;
+ Reference< XEventTarget > m_target;
+ Reference< XEventTarget > m_currentTarget;
+ //xmlNodePtr m_target;
+ //xmlNodePtr m_currentTarget;
+ PhaseType m_phase;
+ sal_Bool m_bubbles;
+ sal_Bool m_cancelable;
+ com::sun::star::util::Time m_time;
+
+public:
+
+ CEvent() : m_canceled(sal_False){}
+
+ virtual ~CEvent();
+ virtual OUString SAL_CALL getType() throw (RuntimeException);
+ virtual Reference< XEventTarget > SAL_CALL getTarget() throw (RuntimeException);
+ virtual Reference< XEventTarget > SAL_CALL getCurrentTarget() throw (RuntimeException);
+ virtual PhaseType SAL_CALL getEventPhase() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL getBubbles() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL getCancelable() throw (RuntimeException);
+ virtual com::sun::star::util::Time SAL_CALL getTimeStamp() throw (RuntimeException);
+ virtual void SAL_CALL stopPropagation() throw (RuntimeException);
+ virtual void SAL_CALL preventDefault() throw (RuntimeException);
+ virtual void SAL_CALL initEvent(
+ const OUString& eventTypeArg,
+ sal_Bool canBubbleArg,
+ sal_Bool cancelableArg) throw (RuntimeException);
+};
+}}
+#endif
diff --git a/unoxml/source/events/eventdispatcher.cxx b/unoxml/source/events/eventdispatcher.cxx
new file mode 100644
index 000000000000..4b1c1548bf38
--- /dev/null
+++ b/unoxml/source/events/eventdispatcher.cxx
@@ -0,0 +1,198 @@
+#include "eventdispatcher.hxx"
+#include "event.hxx"
+#include "mutationevent.hxx"
+#include "uievent.hxx"
+#include "mouseevent.hxx"
+#include "../dom/node.hxx"
+
+namespace DOM { namespace events {
+
+ TypeListenerMap CEventDispatcher::captureListeners;
+ TypeListenerMap CEventDispatcher::targetListeners;
+
+ void CEventDispatcher::addListener(xmlNodePtr pNode, OUString aType, const Reference<XEventListener>& aListener, sal_Bool bCapture)
+ {
+ TypeListenerMap* pTMap = &targetListeners;
+ if (bCapture) pTMap = &captureListeners;
+
+ // get the multimap for the specified type
+ ListenerMap *pMap = 0;
+ TypeListenerMap::const_iterator tIter = pTMap->find(aType);
+ if (tIter == pTMap->end()) {
+ // the map has to be created
+ pMap = new ListenerMap();
+ pTMap->insert(TypeListenerMap::value_type(aType, pMap));
+ } else {
+ pMap = tIter->second;
+ }
+ if (pMap !=0)
+ pMap->insert(ListenerMap::value_type(pNode, aListener));
+ }
+
+ void CEventDispatcher::removeListener(xmlNodePtr pNode, OUString aType, const Reference<XEventListener>& aListener, sal_Bool bCapture)
+ {
+ TypeListenerMap *pTMap = &targetListeners;
+ if (bCapture) pTMap = &captureListeners;
+
+ // get the multimap for the specified type
+ TypeListenerMap::const_iterator tIter = pTMap->find(aType);
+ if (tIter != pTMap->end()) {
+ ListenerMap *pMap = tIter->second;
+ // find listeners of specied type for specified node
+ ListenerMap::iterator iter = pMap->find(pNode);
+ while (iter != pMap->end() && iter->first == pNode)
+ {
+ // erase all references to specified listener
+ if ((iter->second).is() && iter->second == aListener)
+ {
+ ListenerMap::iterator tmp_iter = iter;
+ iter++;
+ pMap->erase(tmp_iter);
+ }
+ else
+ iter++;
+ }
+ }
+ }
+
+ void CEventDispatcher::callListeners(xmlNodePtr pNode, OUString aType, const Reference< XEvent >& xEvent, sal_Bool bCapture)
+ {
+ TypeListenerMap *pTMap = &targetListeners;
+ if (bCapture) pTMap = &captureListeners;
+
+ // get the multimap for the specified type
+ TypeListenerMap::const_iterator tIter = pTMap->find(aType);
+ if (tIter != pTMap->end()) {
+ ListenerMap *pMap = tIter->second;
+ ListenerMap::const_iterator iter = pMap->lower_bound(pNode);
+ ListenerMap::const_iterator ibound = pMap->upper_bound(pNode);
+ for( ; iter != ibound; iter++ )
+ {
+ if((iter->second).is())
+ (iter->second)->handleEvent(xEvent);
+ }
+ }
+ }
+
+ sal_Bool CEventDispatcher::dispatchEvent(xmlNodePtr aNodePtr, const Reference< XEvent >& aEvent)
+ {
+ CEvent *pEvent = 0; // pointer to internal event representation
+ Reference< XEvent > xEvent; // reference to the event being dispatched;
+
+ OUString aType = aEvent->getType();
+ if (aType.compareToAscii("DOMSubtreeModified") == 0||
+ aType.compareToAscii("DOMNodeInserted") == 0||
+ aType.compareToAscii("DOMNodeRemoved") == 0||
+ aType.compareToAscii("DOMNodeRemovedFromDocument") == 0||
+ aType.compareToAscii("DOMNodeInsertedIntoDocument") == 0||
+ aType.compareToAscii("DOMAttrModified") == 0||
+ aType.compareToAscii("DOMCharacterDataModified") == 0)
+ {
+ Reference< XMutationEvent > aMEvent(aEvent, UNO_QUERY);
+ // 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.compareToAscii("DOMFocusIn") == 0||
+ aType.compareToAscii("DOMFocusOut") == 0||
+ aType.compareToAscii("DOMActivate") == 0)
+ {
+ Reference< XUIEvent > aUIEvent(aEvent, UNO_QUERY);
+ CUIEvent* pUIEvent = new CUIEvent;
+ pUIEvent->initUIEvent(aType,
+ aUIEvent->getBubbles(), aUIEvent->getCancelable(),
+ aUIEvent->getView(), aUIEvent->getDetail());
+ pEvent = pUIEvent;
+ } else if ( // MouseEvent
+ aType.compareToAscii("click") == 0||
+ aType.compareToAscii("mousedown") == 0||
+ aType.compareToAscii("mouseup") == 0||
+ aType.compareToAscii("mouseover") == 0||
+ aType.compareToAscii("mousemove") == 0||
+ aType.compareToAscii("mouseout") == 0)
+ {
+ Reference< XMouseEvent > aMouseEvent(aEvent, UNO_QUERY);
+ 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, aEvent->getBubbles(), aEvent->getCancelable());
+ }
+ pEvent->m_target = Reference< XEventTarget >(DOM::CNode::get(aNodePtr));
+ pEvent->m_currentTarget = aEvent->getCurrentTarget();
+ pEvent->m_time = aEvent->getTimeStamp();
+
+ // create the reference to the provate event implementation
+ // that will be dispatched to the listeners
+ xEvent = Reference< XEvent >(pEvent);
+
+ // build the path from target node to the root
+ NodeVector captureVector;
+ xmlNodePtr cur = DOM::CNode::getNodePtr(Reference< XNode >(xEvent->getTarget(), UNO_QUERY_THROW));
+ while (cur != NULL)
+ {
+ captureVector.push_back(cur);
+ cur = cur->parent;
+ }
+
+ // the caputre vector now holds the node path from target to root
+ // first we must search for capture listernes 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
+ NodeVector::const_iterator inode;
+
+ // start at the root
+ inode = captureVector.end();
+ inode--;
+ if (inode != captureVector.end())
+ {
+ // capturing phase:
+ pEvent->m_phase = PhaseType_CAPTURING_PHASE;
+ while (inode != captureVector.begin())
+ {
+ //pEvent->m_currentTarget = *inode;
+ pEvent->m_currentTarget = Reference< XEventTarget >(DOM::CNode::get(*inode));
+ callListeners(*inode, aType, xEvent, sal_True);
+ if (pEvent->m_canceled) return sal_True;
+ inode--;
+ }
+
+ // target phase
+ pEvent->m_phase = PhaseType_AT_TARGET;
+ callListeners(*inode, aType, xEvent, sal_False);
+ if (pEvent->m_canceled) return sal_True;
+ // bubbeling phase
+ inode++;
+ if (aEvent->getBubbles()) {
+ pEvent->m_phase = PhaseType_BUBBLING_PHASE;
+ while (inode != captureVector.end())
+ {
+ pEvent->m_currentTarget = Reference< XEventTarget >(DOM::CNode::get(*inode));
+ callListeners(*inode, aType, xEvent, sal_False);
+ if (pEvent->m_canceled) return sal_True;
+ inode++;
+ }
+ }
+ }
+ return sal_True;
+ }
+}}
diff --git a/unoxml/source/events/eventdispatcher.hxx b/unoxml/source/events/eventdispatcher.hxx
new file mode 100644
index 000000000000..2af5884842f6
--- /dev/null
+++ b/unoxml/source/events/eventdispatcher.hxx
@@ -0,0 +1,51 @@
+
+//#include <multimap>
+#include <map>
+#include <vector>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/xml/dom/events/EventType.hpp>
+#include <com/sun/star/xml/dom/events/PhaseType.hpp>
+#include <com/sun/star/xml/dom/events/XEvent.hpp>
+#include "event.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::xml::dom;
+using namespace com::sun::star::xml::dom::events;
+
+namespace DOM { namespace events
+{
+
+typedef std::vector< xmlNodePtr > NodeVector;
+typedef std::multimap< xmlNodePtr, Reference< com::sun::star::xml::dom::events::XEventListener> > ListenerMap;
+typedef std::map<OUString, ListenerMap*> TypeListenerMap;
+typedef std::vector<ListenerMap::value_type> ListenerPairVector;
+
+class CEventDispatcher
+{
+private:
+ static TypeListenerMap captureListeners;
+ static TypeListenerMap targetListeners;
+
+public:
+ static sal_Bool dispatchEvent(xmlNodePtr aNode, const Reference< XEvent >& aEvent);
+
+ static void addListener(
+ xmlNodePtr pNode,
+ OUString aType,
+ const Reference<com::sun::star::xml::dom::events::XEventListener>& aListener,
+ sal_Bool bCapture);
+
+ static void removeListener(
+ xmlNodePtr pNode,
+ OUString aType,
+ const Reference<com::sun::star::xml::dom::events::XEventListener>& aListener,
+ sal_Bool bCapture);
+
+ static void callListeners(
+ xmlNodePtr pNode,
+ OUString aType,
+ const Reference< XEvent >& xEvent,
+ sal_Bool bCapture);
+};
+}}
diff --git a/unoxml/source/events/makefile.mk b/unoxml/source/events/makefile.mk
new file mode 100644
index 000000000000..2ec7489e1a8d
--- /dev/null
+++ b/unoxml/source/events/makefile.mk
@@ -0,0 +1,56 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=../..
+
+PRJNAME=unoxml
+TARGET=eventsimpl
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(SYSTEM_LIBXML)" == "YES"
+CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS)
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SLOFILES =\
+ $(SLO)$/event.obj \
+ $(SLO)$/eventdispatcher.obj \
+ $(SLO)$/mutationevent.obj \
+ $(SLO)$/uievent.obj \
+ $(SLO)$/mouseevent.obj \
+ $(SLO)$/testlistener.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
diff --git a/unoxml/source/events/mouseevent.cxx b/unoxml/source/events/mouseevent.cxx
new file mode 100644
index 000000000000..362a1149ba72
--- /dev/null
+++ b/unoxml/source/events/mouseevent.cxx
@@ -0,0 +1,149 @@
+#include "mouseevent.hxx"
+
+namespace DOM { namespace events
+{
+
+ sal_Int32 SAL_CALL CMouseEvent::getScreenX() throw (RuntimeException)
+ {
+ return m_screenX;
+ }
+ sal_Int32 SAL_CALL CMouseEvent::getScreenY() throw (RuntimeException)
+ {
+ return m_screenY;
+ }
+ sal_Int32 SAL_CALL CMouseEvent::getClientX() throw (RuntimeException)
+ {
+ return m_clientX;
+ }
+ sal_Int32 SAL_CALL CMouseEvent::getClientY() throw (RuntimeException)
+ {
+ return m_clientY;
+ }
+ sal_Bool SAL_CALL CMouseEvent::getCtrlKey() throw (RuntimeException)
+ {
+ return m_ctrlKey;
+ }
+ sal_Bool SAL_CALL CMouseEvent::getShiftKey() throw (RuntimeException)
+ {
+ return m_shiftKey;
+ }
+ sal_Bool SAL_CALL CMouseEvent::getAltKey() throw (RuntimeException)
+ {
+ return m_altKey;
+ }
+ sal_Bool SAL_CALL CMouseEvent::getMetaKey() throw (RuntimeException)
+ {
+ return m_metaKey;
+ }
+ sal_Int16 SAL_CALL CMouseEvent::getButton() throw (RuntimeException)
+ {
+ return m_button;
+ }
+ Reference< XEventTarget > SAL_CALL CMouseEvent::getRelatedTarget() throw(RuntimeException)
+ {
+ return m_relatedTarget;
+ }
+
+ 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*/)
+ throw(RuntimeException)
+ {
+ 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() throw(RuntimeException)
+ {
+ return CUIEvent::getView();
+ }
+
+ sal_Int32 SAL_CALL CMouseEvent::getDetail() throw(RuntimeException)
+ {
+ return CUIEvent::getDetail();
+ }
+
+ void SAL_CALL CMouseEvent::initUIEvent(const OUString& typeArg,
+ sal_Bool canBubbleArg,
+ sal_Bool cancelableArg,
+ const Reference< XAbstractView >& viewArg,
+ sal_Int32 detailArg) throw(RuntimeException)
+ {
+ CUIEvent::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
+ }
+
+ OUString SAL_CALL CMouseEvent::getType() throw (RuntimeException)
+ {
+ return CUIEvent::getType();
+ }
+
+ Reference< XEventTarget > SAL_CALL CMouseEvent::getTarget() throw (RuntimeException)
+ {
+ return CUIEvent::getTarget();
+ }
+
+ Reference< XEventTarget > SAL_CALL CMouseEvent::getCurrentTarget() throw (RuntimeException)
+ {
+ return CUIEvent::getCurrentTarget();
+ }
+
+ PhaseType SAL_CALL CMouseEvent::getEventPhase() throw (RuntimeException)
+ {
+ return CUIEvent::getEventPhase();
+ }
+
+ sal_Bool SAL_CALL CMouseEvent::getBubbles() throw (RuntimeException)
+ {
+ return CEvent::getBubbles();
+ }
+
+ sal_Bool SAL_CALL CMouseEvent::getCancelable() throw (RuntimeException)
+ {
+ return CUIEvent::getCancelable();
+ }
+
+ com::sun::star::util::Time SAL_CALL CMouseEvent::getTimeStamp() throw (RuntimeException)
+ {
+ return CUIEvent::getTimeStamp();
+ }
+
+ void SAL_CALL CMouseEvent::stopPropagation() throw (RuntimeException)
+ {
+ CUIEvent::stopPropagation();
+ }
+
+ void SAL_CALL CMouseEvent::preventDefault() throw (RuntimeException)
+ {
+ CUIEvent::preventDefault();
+ }
+
+ void SAL_CALL CMouseEvent::initEvent(const OUString& eventTypeArg, sal_Bool canBubbleArg,
+ sal_Bool cancelableArg) throw (RuntimeException)
+ {
+ // base initializer
+ CUIEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg);
+ }
+}}
+
diff --git a/unoxml/source/events/mouseevent.hxx b/unoxml/source/events/mouseevent.hxx
new file mode 100644
index 000000000000..d70f1c1ac605
--- /dev/null
+++ b/unoxml/source/events/mouseevent.hxx
@@ -0,0 +1,92 @@
+#ifndef __MOUSEEVENT_HXX
+#define __MOUSEEVENT_HXX
+
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/xml/dom/events/EventType.hpp>
+#include <com/sun/star/xml/dom/events/PhaseType.hpp>
+#include <com/sun/star/xml/dom/events/AttrChangeType.hpp>
+#include <com/sun/star/xml/dom/events/XEvent.hpp>
+#include <com/sun/star/xml/dom/events/XUIEvent.hpp>
+#include <com/sun/star/xml/dom/events/XMouseEvent.hpp>
+#include "event.hxx"
+#include "uievent.hxx"
+
+using ::rtl::OUString;
+
+namespace DOM { namespace events {
+
+class CMouseEvent : public cppu::ImplInheritanceHelper1< CUIEvent, XMouseEvent >
+{
+ friend class CEventDispatcher;
+protected:
+ sal_Int32 m_screenX;
+ sal_Int32 m_screenY;
+ sal_Int32 m_clientX;
+ sal_Int32 m_clientY;
+ sal_Bool m_ctrlKey;
+ sal_Bool m_shiftKey;
+ sal_Bool m_altKey;
+ sal_Bool m_metaKey;
+ sal_Int16 m_button;
+ Reference< XEventTarget > m_relatedTarget;
+
+public:
+
+ virtual sal_Int32 SAL_CALL getScreenX() throw (RuntimeException);
+ virtual sal_Int32 SAL_CALL getScreenY() throw (RuntimeException);
+ virtual sal_Int32 SAL_CALL getClientX() throw (RuntimeException);
+ virtual sal_Int32 SAL_CALL getClientY() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL getCtrlKey() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL getShiftKey() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL getAltKey() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL getMetaKey() throw (RuntimeException);
+ virtual sal_Int16 SAL_CALL getButton() throw (RuntimeException);
+ virtual Reference< XEventTarget > SAL_CALL getRelatedTarget() throw(RuntimeException);
+
+ virtual void SAL_CALL 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)
+ throw(RuntimeException);
+
+ // delegate to CUIevent
+ virtual Reference< XAbstractView > SAL_CALL getView() throw (RuntimeException);
+ virtual sal_Int32 SAL_CALL getDetail() throw (RuntimeException);
+ virtual void SAL_CALL initUIEvent(const OUString& typeArg,
+ sal_Bool canBubbleArg,
+ sal_Bool cancelableArg,
+ const Reference< XAbstractView >& viewArg,
+ sal_Int32 detailArg) throw (RuntimeException);
+ virtual OUString SAL_CALL getType() throw (RuntimeException);
+ virtual Reference< XEventTarget > SAL_CALL getTarget() throw (RuntimeException);
+ virtual Reference< XEventTarget > SAL_CALL getCurrentTarget() throw (RuntimeException);
+ virtual PhaseType SAL_CALL getEventPhase() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL getBubbles() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL getCancelable() throw (RuntimeException);
+ virtual com::sun::star::util::Time SAL_CALL getTimeStamp() throw (RuntimeException);
+ virtual void SAL_CALL stopPropagation() throw (RuntimeException);
+ virtual void SAL_CALL preventDefault() throw (RuntimeException);
+ virtual void SAL_CALL initEvent(
+ const OUString& eventTypeArg,
+ sal_Bool canBubbleArg,
+ sal_Bool cancelableArg)
+ throw (RuntimeException);
+};
+}}
+#endif
diff --git a/unoxml/source/events/mutationevent.cxx b/unoxml/source/events/mutationevent.cxx
new file mode 100644
index 000000000000..bc06cb2af61a
--- /dev/null
+++ b/unoxml/source/events/mutationevent.cxx
@@ -0,0 +1,100 @@
+#include "mutationevent.hxx"
+
+namespace DOM { namespace events
+{
+ CMutationEvent::~CMutationEvent()
+ {
+ }
+
+ Reference< XNode > SAL_CALL CMutationEvent::getRelatedNode() throw (RuntimeException)
+ {
+ return m_relatedNode;
+ }
+
+ OUString SAL_CALL CMutationEvent::getPrevValue() throw (RuntimeException)
+ {
+ return m_prevValue;
+ }
+
+ OUString SAL_CALL CMutationEvent::getNewValue() throw (RuntimeException)
+ {
+ return m_newValue;
+ }
+
+ OUString SAL_CALL CMutationEvent::getAttrName() throw (RuntimeException)
+ {
+ return m_attrName;
+ }
+
+ AttrChangeType SAL_CALL CMutationEvent::getAttrChange() throw (RuntimeException)
+ {
+ 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) throw (RuntimeException)
+ {
+ 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() throw (RuntimeException)
+ {
+ return CEvent::getType();
+ }
+
+ Reference< XEventTarget > SAL_CALL CMutationEvent::getTarget() throw (RuntimeException)
+ {
+ return CEvent::getTarget();
+ }
+
+ Reference< XEventTarget > SAL_CALL CMutationEvent::getCurrentTarget() throw (RuntimeException)
+ {
+ return CEvent::getCurrentTarget();
+ }
+
+ PhaseType SAL_CALL CMutationEvent::getEventPhase() throw (RuntimeException)
+ {
+ return CEvent::getEventPhase();
+ }
+
+ sal_Bool SAL_CALL CMutationEvent::getBubbles() throw (RuntimeException)
+ {
+ return CEvent::getBubbles();
+ }
+
+ sal_Bool SAL_CALL CMutationEvent::getCancelable() throw (RuntimeException)
+ {
+ return CEvent::getCancelable();
+ }
+
+ com::sun::star::util::Time SAL_CALL CMutationEvent::getTimeStamp() throw (RuntimeException)
+ {
+ return CEvent::getTimeStamp();
+ }
+
+ void SAL_CALL CMutationEvent::stopPropagation() throw (RuntimeException)
+ {
+ CEvent::stopPropagation();
+ }
+ void SAL_CALL CMutationEvent::preventDefault() throw (RuntimeException)
+ {
+ CEvent::preventDefault();
+ }
+
+ void SAL_CALL CMutationEvent::initEvent(const OUString& eventTypeArg, sal_Bool canBubbleArg,
+ sal_Bool cancelableArg) throw (RuntimeException)
+ {
+ // base initializer
+ CEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg);
+ }
+}}
+
diff --git a/unoxml/source/events/mutationevent.hxx b/unoxml/source/events/mutationevent.hxx
new file mode 100644
index 000000000000..e28613ad5df9
--- /dev/null
+++ b/unoxml/source/events/mutationevent.hxx
@@ -0,0 +1,66 @@
+#ifndef __MUTATIONEVENT_HXX
+#define __MUTATIONEVENT_HXX
+
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/xml/dom/events/EventType.hpp>
+#include <com/sun/star/xml/dom/events/PhaseType.hpp>
+#include <com/sun/star/xml/dom/events/AttrChangeType.hpp>
+#include <com/sun/star/xml/dom/events/XEvent.hpp>
+#include <com/sun/star/xml/dom/events/XMutationEvent.hpp>
+#include "event.hxx"
+
+using ::rtl::OUString;
+
+namespace DOM { namespace events {
+
+class CMutationEvent : public cppu::ImplInheritanceHelper1< CEvent, XMutationEvent >
+{
+ friend class CEventDispatcher;
+protected:
+ Reference< XNode > m_relatedNode;
+ OUString m_prevValue;
+ OUString m_newValue;
+ OUString m_attrName;
+ AttrChangeType m_attrChangeType;
+
+public:
+
+ virtual ~CMutationEvent();
+
+ virtual Reference< XNode > SAL_CALL getRelatedNode() throw (RuntimeException);
+ virtual OUString SAL_CALL getPrevValue() throw (RuntimeException);
+ virtual OUString SAL_CALL getNewValue() throw (RuntimeException);
+ virtual OUString SAL_CALL getAttrName() throw (RuntimeException);
+ virtual AttrChangeType SAL_CALL getAttrChange() throw (RuntimeException);
+ virtual void SAL_CALL 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) throw (RuntimeException);
+
+ // delegate to CEvent, since we are inheriting from CEvent and XEvent
+ virtual OUString SAL_CALL getType() throw (RuntimeException);
+ virtual Reference< XEventTarget > SAL_CALL getTarget() throw (RuntimeException);
+ virtual Reference< XEventTarget > SAL_CALL getCurrentTarget() throw (RuntimeException);
+ virtual PhaseType SAL_CALL getEventPhase() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL getBubbles() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL getCancelable() throw (RuntimeException);
+ virtual com::sun::star::util::Time SAL_CALL getTimeStamp() throw (RuntimeException);
+ virtual void SAL_CALL stopPropagation() throw (RuntimeException);
+ virtual void SAL_CALL preventDefault() throw (RuntimeException);
+ virtual void SAL_CALL initEvent(
+ const OUString& eventTypeArg,
+ sal_Bool canBubbleArg,
+ sal_Bool cancelableArg)
+ throw (RuntimeException);
+};
+}}
+#endif
diff --git a/unoxml/source/events/testlistener.cxx b/unoxml/source/events/testlistener.cxx
new file mode 100644
index 000000000000..64806c84017d
--- /dev/null
+++ b/unoxml/source/events/testlistener.cxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <stdio.h>
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+
+#include "testlistener.hxx"
+
+#define U2S(s) OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr()
+
+
+namespace DOM { namespace events
+{
+
+ Reference< XInterface > CTestListener::_getInstance(const Reference< XMultiServiceFactory >& rSMgr)
+ {
+ // XXX
+ // return static_cast< XXPathAPI* >(new CTestListener());
+ return Reference< XInterface >(static_cast<XEventListener*>(new CTestListener(rSMgr)));
+ }
+
+ const char* CTestListener::aImplementationName = "com.sun.star.comp.xml.dom.events.TestListener";
+ const char* CTestListener::aSupportedServiceNames[] = {
+ "com.sun.star.comp.xml.dom.events.TestListener",
+ NULL
+ };
+
+ OUString CTestListener::_getImplementationName()
+ {
+ return OUString::createFromAscii(aImplementationName);
+ }
+ Sequence<OUString> CTestListener::_getSupportedServiceNames()
+ {
+ Sequence<OUString> aSequence;
+ for (int i=0; aSupportedServiceNames[i]!=NULL; i++) {
+ aSequence.realloc(i+1);
+ aSequence[i]=(OUString::createFromAscii(aSupportedServiceNames[i]));
+ }
+ return aSequence;
+ }
+
+ Sequence< OUString > SAL_CALL CTestListener::getSupportedServiceNames()
+ throw (RuntimeException)
+ {
+ return CTestListener::_getSupportedServiceNames();
+ }
+
+ OUString SAL_CALL CTestListener::getImplementationName()
+ throw (RuntimeException)
+ {
+ return CTestListener::_getImplementationName();
+ }
+
+ sal_Bool SAL_CALL CTestListener::supportsService(const OUString& aServiceName)
+ throw (RuntimeException)
+ {
+ Sequence< OUString > supported = CTestListener::_getSupportedServiceNames();
+ for (sal_Int32 i=0; i<supported.getLength(); i++)
+ {
+ if (supported[i] == aServiceName) return sal_True;
+ }
+ return sal_False;
+ }
+
+ // --- XInitialize
+
+ void SAL_CALL CTestListener::initialize(const Sequence< Any >& args) throw(RuntimeException)
+ {
+ if (args.getLength() < 3) throw IllegalArgumentException(
+ OUString::createFromAscii("Wrong number of arguments"), Reference< XInterface >(), 0);
+
+ Reference <XEventTarget> aTarget;
+ if(! (args[0] >>= aTarget)) throw IllegalArgumentException(
+ OUString::createFromAscii("Illegal argument 1"), Reference< XInterface >(), 1);
+
+ OUString aType;
+ if (! (args[1] >>= aType))
+ throw IllegalArgumentException(OUString::createFromAscii("Illegal argument 2"), Reference< XInterface >(), 2);
+
+ sal_Bool bCapture = sal_False;
+ if(! (args[2] >>= bCapture)) throw IllegalArgumentException(
+ OUString::createFromAscii("Illegal argument 3"), Reference< XInterface >(), 3);
+
+ if(! (args[3] >>= m_name)) m_name = OUString::createFromAscii("<unnamed listener>");
+
+ m_target = aTarget;
+ m_type = aType;
+ m_capture = bCapture;
+
+ m_target->addEventListener(m_type, Reference< XEventListener >(this), m_capture);
+
+
+ }
+
+ CTestListener::~CTestListener()
+ {
+ fprintf(stderr, "CTestListener::~CTestListener()\n");
+ if( m_target.is())
+ m_target->removeEventListener(m_type, Reference< XEventListener >(this), m_capture);
+ }
+
+ // --- XEventListener
+
+ void SAL_CALL CTestListener::handleEvent(const Reference< XEvent >& evt) throw (RuntimeException)
+ {
+ FILE* f = fopen("C:\\listener.out", "a");
+ fprintf(f, "CTestListener::handleEvent in %s\n", U2S(m_name));
+ fprintf(f, " type: %s\n\n", OUStringToOString(evt->getType(), RTL_TEXTENCODING_ASCII_US).getStr());
+ fclose(f);
+
+ }
+
+}}
diff --git a/unoxml/source/events/testlistener.hxx b/unoxml/source/events/testlistener.hxx
new file mode 100644
index 000000000000..b6d6abdc700f
--- /dev/null
+++ b/unoxml/source/events/testlistener.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TESTLISTENER_HXX
+#define _TESTLISTENER_HXX
+
+#include <map>
+
+#include <sal/types.h>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/xml/dom/events/XEventTarget.hpp>
+#include <com/sun/star/xml/dom/events/XEventListener.hpp>
+#include <com/sun/star/xml/dom/events/XEvent.hpp>
+#include <com/sun/star/xml/dom/events/EventType.hpp>
+#include <com/sun/star/xml/dom/events/XMutationEvent.hpp>
+
+#include "libxml/tree.h"
+
+using ::rtl::OUString;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+using namespace com::sun::star::xml::dom::events;
+
+namespace DOM { namespace events
+{
+
+ class CTestListener
+ : public ::cppu::WeakImplHelper3< com::sun::star::xml::dom::events::XEventListener, XInitialization, XServiceInfo >
+ {
+
+ private:
+ Reference< XMultiServiceFactory > m_factory;
+ Reference <XEventTarget> m_target;
+ OUString m_type;
+ sal_Bool m_capture;
+ OUString m_name;
+
+ public:
+
+ // static helpers for service info and component management
+ static const char* aImplementationName;
+ static const char* aSupportedServiceNames[];
+ static OUString _getImplementationName();
+ static Sequence< OUString > _getSupportedServiceNames();
+ static Reference< XInterface > _getInstance(const Reference< XMultiServiceFactory >& rSMgr);
+
+ CTestListener(const Reference< XMultiServiceFactory >& rSMgr)
+ : m_factory(rSMgr){};
+
+ virtual ~CTestListener();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName()
+ throw (RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
+ throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames ()
+ throw (RuntimeException);
+
+
+ // XEventListener
+ virtual void SAL_CALL initialize(const Sequence< Any >& args) throw (RuntimeException);
+
+ virtual void SAL_CALL handleEvent(const Reference< XEvent >& evt) throw (RuntimeException);
+
+
+ };
+}}
+
+#endif
diff --git a/unoxml/source/events/uievent.cxx b/unoxml/source/events/uievent.cxx
new file mode 100644
index 000000000000..29d2e10e57dc
--- /dev/null
+++ b/unoxml/source/events/uievent.cxx
@@ -0,0 +1,81 @@
+#include "event.hxx"
+#include "uievent.hxx"
+
+namespace DOM { namespace events
+{
+
+ Reference< XAbstractView > SAL_CALL CUIEvent::getView() throw(RuntimeException)
+ {
+ return m_view;
+ }
+
+ sal_Int32 SAL_CALL CUIEvent::getDetail() throw(RuntimeException)
+ {
+ return m_detail;
+ }
+
+ void SAL_CALL CUIEvent::initUIEvent(const OUString& typeArg,
+ sal_Bool canBubbleArg,
+ sal_Bool cancelableArg,
+ const Reference< XAbstractView >& viewArg,
+ sal_Int32 detailArg) throw(RuntimeException)
+ {
+ 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() throw (RuntimeException)
+ {
+ return CEvent::getType();
+ }
+
+ Reference< XEventTarget > SAL_CALL CUIEvent::getTarget() throw (RuntimeException)
+ {
+ return CEvent::getTarget();
+ }
+
+ Reference< XEventTarget > SAL_CALL CUIEvent::getCurrentTarget() throw (RuntimeException)
+ {
+ return CEvent::getCurrentTarget();
+ }
+
+ PhaseType SAL_CALL CUIEvent::getEventPhase() throw (RuntimeException)
+ {
+ return CEvent::getEventPhase();
+ }
+
+ sal_Bool SAL_CALL CUIEvent::getBubbles() throw (RuntimeException)
+ {
+ return CEvent::getBubbles();
+ }
+
+ sal_Bool SAL_CALL CUIEvent::getCancelable() throw (RuntimeException)
+ {
+ // mutation events cannot be canceled
+ return sal_False;
+ }
+
+ com::sun::star::util::Time SAL_CALL CUIEvent::getTimeStamp() throw (RuntimeException)
+ {
+ return CEvent::getTimeStamp();
+ }
+
+ void SAL_CALL CUIEvent::stopPropagation() throw (RuntimeException)
+ {
+ CEvent::stopPropagation();
+ }
+ void SAL_CALL CUIEvent::preventDefault() throw (RuntimeException)
+ {
+ CEvent::preventDefault();
+ }
+
+ void SAL_CALL CUIEvent::initEvent(const OUString& eventTypeArg, sal_Bool canBubbleArg,
+ sal_Bool cancelableArg) throw (RuntimeException)
+ {
+ // base initializer
+ CEvent::initEvent(eventTypeArg, canBubbleArg, cancelableArg);
+ }
+}}
diff --git a/unoxml/source/events/uievent.hxx b/unoxml/source/events/uievent.hxx
new file mode 100644
index 000000000000..f7c5806e48e0
--- /dev/null
+++ b/unoxml/source/events/uievent.hxx
@@ -0,0 +1,55 @@
+#ifndef __UIEVENT_HXX
+#define __UIEVENT_HXX
+
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/xml/dom/events/EventType.hpp>
+#include <com/sun/star/xml/dom/events/PhaseType.hpp>
+#include <com/sun/star/xml/dom/events/AttrChangeType.hpp>
+#include <com/sun/star/xml/dom/events/XEvent.hpp>
+#include <com/sun/star/xml/dom/events/XUIEvent.hpp>
+#include <com/sun/star/xml/dom/views/XAbstractView.hpp>
+#include "event.hxx"
+
+using ::rtl::OUString;
+using namespace com::sun::star::xml::dom::views;
+
+namespace DOM { namespace events {
+
+class CUIEvent : public cppu::ImplInheritanceHelper1< CEvent, XUIEvent >
+{
+ friend class CEventDispatcher;
+protected:
+ sal_Int32 m_detail;
+ Reference< XAbstractView > m_view;
+
+public:
+ virtual Reference< XAbstractView > SAL_CALL getView() throw(RuntimeException);
+ virtual sal_Int32 SAL_CALL getDetail() throw(RuntimeException);
+ virtual void SAL_CALL initUIEvent(const OUString& typeArg,
+ sal_Bool canBubbleArg,
+ sal_Bool cancelableArg,
+ const Reference< XAbstractView >& viewArg,
+ sal_Int32 detailArg) throw(RuntimeException);
+
+ // delegate to CEvent, since we are inheriting from CEvent and XEvent
+ virtual OUString SAL_CALL getType() throw (RuntimeException);
+ virtual Reference< XEventTarget > SAL_CALL getTarget() throw (RuntimeException);
+ virtual Reference< XEventTarget > SAL_CALL getCurrentTarget() throw (RuntimeException);
+ virtual PhaseType SAL_CALL getEventPhase() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL getBubbles() throw (RuntimeException);
+ virtual sal_Bool SAL_CALL getCancelable() throw (RuntimeException);
+ virtual com::sun::star::util::Time SAL_CALL getTimeStamp() throw (RuntimeException);
+ virtual void SAL_CALL stopPropagation() throw (RuntimeException);
+ virtual void SAL_CALL preventDefault() throw (RuntimeException);
+ virtual void SAL_CALL initEvent(
+ const OUString& eventTypeArg,
+ sal_Bool canBubbleArg,
+ sal_Bool cancelableArg)
+ throw (RuntimeException);
+};
+}}
+#endif