Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / unoxml / source / events / testlistener.hxx
blob117fca9c32c5c237604e242d7d13f4c70914259f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef EVENT_TESTLISTENER_HXX
30 #define EVENT_TESTLISTENER_HXX
32 #include <sal/types.h>
34 #include <com/sun/star/uno/Reference.h>
35 #include <com/sun/star/uno/Sequence.h>
37 #include <com/sun/star/uno/XInterface.hpp>
38 #include <com/sun/star/uno/Exception.hpp>
39 #include <com/sun/star/lang/XServiceInfo.hpp>
40 #include <com/sun/star/lang/XInitialization.hpp>
41 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
42 #include <com/sun/star/xml/dom/events/XEventTarget.hpp>
43 #include <com/sun/star/xml/dom/events/XEventListener.hpp>
44 #include <com/sun/star/xml/dom/events/XEvent.hpp>
46 #include <cppuhelper/implbase3.hxx>
49 using ::rtl::OUString;
50 using namespace com::sun::star::uno;
51 using namespace com::sun::star::xml::dom;
52 using namespace com::sun::star::xml::dom::events;
54 namespace DOM { namespace events
57 typedef ::cppu::WeakImplHelper3
58 < ::com::sun::star::xml::dom::events::XEventListener
59 , ::com::sun::star::lang::XInitialization
60 , ::com::sun::star::lang::XServiceInfo
61 > CTestListener_Base;
63 class CTestListener
64 : public CTestListener_Base
67 private:
68 Reference< ::com::sun::star::lang::XMultiServiceFactory > m_factory;
69 Reference <XEventTarget> m_target;
70 OUString m_type;
71 sal_Bool m_capture;
72 OUString m_name;
74 public:
76 // static helpers for service info and component management
77 static const char* aImplementationName;
78 static const char* aSupportedServiceNames[];
79 static OUString _getImplementationName();
80 static Sequence< OUString > _getSupportedServiceNames();
81 static Reference< XInterface > _getInstance(
82 const Reference< ::com::sun::star::lang::XMultiServiceFactory >&
83 rSMgr);
85 CTestListener(
86 const Reference< ::com::sun::star::lang::XMultiServiceFactory >&
87 rSMgr)
88 : m_factory(rSMgr){};
90 virtual ~CTestListener();
92 // XServiceInfo
93 virtual OUString SAL_CALL getImplementationName()
94 throw (RuntimeException);
95 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
96 throw (RuntimeException);
97 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames ()
98 throw (RuntimeException);
101 // XEventListener
102 virtual void SAL_CALL initialize(const Sequence< Any >& args) throw (RuntimeException);
104 virtual void SAL_CALL handleEvent(const Reference< XEvent >& evt) throw (RuntimeException);
110 #endif
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */