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