summaryrefslogtreecommitdiff
path: root/unoxml/source/events/eventdispatcher.hxx
blob: cd8f7fd608d6512b2a6ee280c43be0093ccce6ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

#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);
};
}}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */