Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef EVENT_TESTLISTENER_HXX
21 : #define EVENT_TESTLISTENER_HXX
22 :
23 : #include <sal/types.h>
24 :
25 : #include <com/sun/star/uno/Reference.h>
26 : #include <com/sun/star/uno/Sequence.h>
27 :
28 : #include <com/sun/star/uno/XInterface.hpp>
29 : #include <com/sun/star/uno/Exception.hpp>
30 : #include <com/sun/star/lang/XServiceInfo.hpp>
31 : #include <com/sun/star/lang/XInitialization.hpp>
32 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 : #include <com/sun/star/xml/dom/events/XEventTarget.hpp>
34 : #include <com/sun/star/xml/dom/events/XEventListener.hpp>
35 : #include <com/sun/star/xml/dom/events/XEvent.hpp>
36 :
37 : #include <cppuhelper/implbase3.hxx>
38 :
39 :
40 : using ::rtl::OUString;
41 : using namespace com::sun::star::uno;
42 : using namespace com::sun::star::xml::dom;
43 : using namespace com::sun::star::xml::dom::events;
44 :
45 : namespace DOM { namespace events
46 : {
47 :
48 : typedef ::cppu::WeakImplHelper3
49 : < ::com::sun::star::xml::dom::events::XEventListener
50 : , ::com::sun::star::lang::XInitialization
51 : , ::com::sun::star::lang::XServiceInfo
52 : > CTestListener_Base;
53 :
54 : class CTestListener
55 : : public CTestListener_Base
56 : {
57 :
58 : private:
59 : Reference< ::com::sun::star::lang::XMultiServiceFactory > m_factory;
60 : Reference <XEventTarget> m_target;
61 : OUString m_type;
62 : sal_Bool m_capture;
63 : OUString m_name;
64 :
65 : public:
66 :
67 : // static helpers for service info and component management
68 : static const char* aImplementationName;
69 : static const char* aSupportedServiceNames[];
70 : static OUString _getImplementationName();
71 : static Sequence< OUString > _getSupportedServiceNames();
72 : static Reference< XInterface > _getInstance(
73 : const Reference< ::com::sun::star::lang::XMultiServiceFactory >&
74 : rSMgr);
75 :
76 0 : CTestListener(
77 : const Reference< ::com::sun::star::lang::XMultiServiceFactory >&
78 : rSMgr)
79 0 : : m_factory(rSMgr){};
80 :
81 : virtual ~CTestListener();
82 :
83 : // XServiceInfo
84 : virtual OUString SAL_CALL getImplementationName()
85 : throw (RuntimeException);
86 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
87 : throw (RuntimeException);
88 : virtual Sequence< OUString > SAL_CALL getSupportedServiceNames ()
89 : throw (RuntimeException);
90 :
91 :
92 : // XEventListener
93 : virtual void SAL_CALL initialize(const Sequence< Any >& args) throw (RuntimeException);
94 :
95 : virtual void SAL_CALL handleEvent(const Reference< XEvent >& evt) throw (RuntimeException);
96 :
97 :
98 : };
99 : }}
100 :
101 : #endif
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|