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 INCLUDED_UNOXML_SOURCE_EVENTS_TESTLISTENER_HXX
21 : #define INCLUDED_UNOXML_SOURCE_EVENTS_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 namespace com::sun::star::uno;
41 : using namespace com::sun::star::xml::dom;
42 : using namespace com::sun::star::xml::dom::events;
43 :
44 : namespace DOM { namespace events
45 : {
46 :
47 : typedef ::cppu::WeakImplHelper3
48 : < ::com::sun::star::xml::dom::events::XEventListener
49 : , ::com::sun::star::lang::XInitialization
50 : , ::com::sun::star::lang::XServiceInfo
51 : > CTestListener_Base;
52 :
53 : class CTestListener
54 : : public CTestListener_Base
55 : {
56 :
57 : private:
58 : Reference< ::com::sun::star::lang::XMultiServiceFactory > m_factory;
59 : Reference <XEventTarget> m_target;
60 : OUString m_type;
61 : sal_Bool m_capture;
62 : OUString m_name;
63 :
64 : public:
65 :
66 : // static helpers for service info and component management
67 : static const char* aImplementationName;
68 : static const char* aSupportedServiceNames[];
69 : static OUString _getImplementationName();
70 : static Sequence< OUString > _getSupportedServiceNames();
71 : static Reference< XInterface > _getInstance(
72 : const Reference< ::com::sun::star::lang::XMultiServiceFactory >&
73 : rSMgr);
74 :
75 0 : CTestListener(
76 : const Reference< ::com::sun::star::lang::XMultiServiceFactory >&
77 : rSMgr)
78 : : m_factory(rSMgr)
79 0 : , m_capture(sal_False)
80 : {
81 0 : }
82 :
83 : virtual ~CTestListener();
84 :
85 : // XServiceInfo
86 : virtual OUString SAL_CALL getImplementationName()
87 : throw (RuntimeException, std::exception) SAL_OVERRIDE;
88 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
89 : throw (RuntimeException, std::exception) SAL_OVERRIDE;
90 : virtual Sequence< OUString > SAL_CALL getSupportedServiceNames ()
91 : throw (RuntimeException, std::exception) SAL_OVERRIDE;
92 :
93 :
94 : // XEventListener
95 : virtual void SAL_CALL initialize(const Sequence< Any >& args) throw (RuntimeException, std::exception) SAL_OVERRIDE;
96 :
97 : virtual void SAL_CALL handleEvent(const Reference< XEvent >& evt) throw (RuntimeException, std::exception) SAL_OVERRIDE;
98 :
99 :
100 : };
101 : }}
102 :
103 : #endif
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|