Update ooo320-m1
[ooovba.git] / unoxml / source / events / testlistener.hxx
blob59aa42c10166cf538d9ec8c68cb9ca98858123b4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: testlistener.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _TESTLISTENER_HXX
32 #define _TESTLISTENER_HXX
34 #include <map>
36 #include <sal/types.h>
37 #include <cppuhelper/implbase3.hxx>
38 #include <com/sun/star/uno/Reference.h>
39 #include <com/sun/star/uno/Sequence.h>
41 #include <com/sun/star/uno/XInterface.hpp>
42 #include <com/sun/star/uno/Exception.hpp>
43 #include <com/sun/star/xml/dom/XNode.hpp>
44 #include <com/sun/star/lang/XServiceInfo.hpp>
45 #include <com/sun/star/lang/XInitialization.hpp>
46 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
47 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
48 #include <com/sun/star/lang/XUnoTunnel.hpp>
49 #include <com/sun/star/xml/dom/events/XEventTarget.hpp>
50 #include <com/sun/star/xml/dom/events/XEventListener.hpp>
51 #include <com/sun/star/xml/dom/events/XEvent.hpp>
52 #include <com/sun/star/xml/dom/events/EventType.hpp>
53 #include <com/sun/star/xml/dom/events/XMutationEvent.hpp>
55 #include "libxml/tree.h"
57 using ::rtl::OUString;
58 using namespace com::sun::star::uno;
59 using namespace com::sun::star::lang;
60 using namespace com::sun::star::xml::dom;
61 using namespace com::sun::star::xml::dom::events;
63 namespace DOM { namespace events
66 class CTestListener
67 : public ::cppu::WeakImplHelper3< com::sun::star::xml::dom::events::XEventListener, XInitialization, XServiceInfo >
70 private:
71 Reference< XMultiServiceFactory > m_factory;
72 Reference <XEventTarget> m_target;
73 OUString m_type;
74 sal_Bool m_capture;
75 OUString m_name;
77 public:
79 // static helpers for service info and component management
80 static const char* aImplementationName;
81 static const char* aSupportedServiceNames[];
82 static OUString _getImplementationName();
83 static Sequence< OUString > _getSupportedServiceNames();
84 static Reference< XInterface > _getInstance(const Reference< XMultiServiceFactory >& rSMgr);
86 CTestListener(const Reference< XMultiServiceFactory >& rSMgr)
87 : m_factory(rSMgr){};
89 virtual ~CTestListener();
91 // XServiceInfo
92 virtual OUString SAL_CALL getImplementationName()
93 throw (RuntimeException);
94 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
95 throw (RuntimeException);
96 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames ()
97 throw (RuntimeException);
100 // XEventListener
101 virtual void SAL_CALL initialize(const Sequence< Any >& args) throw (RuntimeException);
103 virtual void SAL_CALL handleEvent(const Reference< XEvent >& evt) throw (RuntimeException);
109 #endif