1*7f654276SAndrew Rist /************************************************************** 2*7f654276SAndrew Rist * 3*7f654276SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*7f654276SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*7f654276SAndrew Rist * distributed with this work for additional information 6*7f654276SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*7f654276SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*7f654276SAndrew Rist * "License"); you may not use this file except in compliance 9*7f654276SAndrew Rist * with the License. You may obtain a copy of the License at 10*7f654276SAndrew Rist * 11*7f654276SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*7f654276SAndrew Rist * 13*7f654276SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*7f654276SAndrew Rist * software distributed under the License is distributed on an 15*7f654276SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*7f654276SAndrew Rist * KIND, either express or implied. See the License for the 17*7f654276SAndrew Rist * specific language governing permissions and limitations 18*7f654276SAndrew Rist * under the License. 19*7f654276SAndrew Rist * 20*7f654276SAndrew Rist *************************************************************/ 21*7f654276SAndrew Rist 22*7f654276SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef EVENT_TESTLISTENER_HXX 25cdf0e10cSrcweir #define EVENT_TESTLISTENER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <sal/types.h> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h> 30cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <com/sun/star/uno/XInterface.hpp> 33cdf0e10cSrcweir #include <com/sun/star/uno/Exception.hpp> 34cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 35cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 36cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 37cdf0e10cSrcweir #include <com/sun/star/xml/dom/events/XEventTarget.hpp> 38cdf0e10cSrcweir #include <com/sun/star/xml/dom/events/XEventListener.hpp> 39cdf0e10cSrcweir #include <com/sun/star/xml/dom/events/XEvent.hpp> 40cdf0e10cSrcweir 41cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir 44cdf0e10cSrcweir using ::rtl::OUString; 45cdf0e10cSrcweir using namespace com::sun::star::uno; 46cdf0e10cSrcweir using namespace com::sun::star::xml::dom; 47cdf0e10cSrcweir using namespace com::sun::star::xml::dom::events; 48cdf0e10cSrcweir 49cdf0e10cSrcweir namespace DOM { namespace events 50cdf0e10cSrcweir { 51cdf0e10cSrcweir 52cdf0e10cSrcweir typedef ::cppu::WeakImplHelper3 53cdf0e10cSrcweir < ::com::sun::star::xml::dom::events::XEventListener 54cdf0e10cSrcweir , ::com::sun::star::lang::XInitialization 55cdf0e10cSrcweir , ::com::sun::star::lang::XServiceInfo 56cdf0e10cSrcweir > CTestListener_Base; 57cdf0e10cSrcweir 58cdf0e10cSrcweir class CTestListener 59cdf0e10cSrcweir : public CTestListener_Base 60cdf0e10cSrcweir { 61cdf0e10cSrcweir 62cdf0e10cSrcweir private: 63cdf0e10cSrcweir Reference< ::com::sun::star::lang::XMultiServiceFactory > m_factory; 64cdf0e10cSrcweir Reference <XEventTarget> m_target; 65cdf0e10cSrcweir OUString m_type; 66cdf0e10cSrcweir sal_Bool m_capture; 67cdf0e10cSrcweir OUString m_name; 68cdf0e10cSrcweir 69cdf0e10cSrcweir public: 70cdf0e10cSrcweir 71cdf0e10cSrcweir // static helpers for service info and component management 72cdf0e10cSrcweir static const char* aImplementationName; 73cdf0e10cSrcweir static const char* aSupportedServiceNames[]; 74cdf0e10cSrcweir static OUString _getImplementationName(); 75cdf0e10cSrcweir static Sequence< OUString > _getSupportedServiceNames(); 76cdf0e10cSrcweir static Reference< XInterface > _getInstance( 77cdf0e10cSrcweir const Reference< ::com::sun::star::lang::XMultiServiceFactory >& 78cdf0e10cSrcweir rSMgr); 79cdf0e10cSrcweir CTestListener(const Reference<::com::sun::star::lang::XMultiServiceFactory> & rSMgr)80cdf0e10cSrcweir CTestListener( 81cdf0e10cSrcweir const Reference< ::com::sun::star::lang::XMultiServiceFactory >& 82cdf0e10cSrcweir rSMgr) 83cdf0e10cSrcweir : m_factory(rSMgr){}; 84cdf0e10cSrcweir 85cdf0e10cSrcweir virtual ~CTestListener(); 86cdf0e10cSrcweir 87cdf0e10cSrcweir // XServiceInfo 88cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName() 89cdf0e10cSrcweir throw (RuntimeException); 90cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) 91cdf0e10cSrcweir throw (RuntimeException); 92cdf0e10cSrcweir virtual Sequence< OUString > SAL_CALL getSupportedServiceNames () 93cdf0e10cSrcweir throw (RuntimeException); 94cdf0e10cSrcweir 95cdf0e10cSrcweir 96cdf0e10cSrcweir // XEventListener 97cdf0e10cSrcweir virtual void SAL_CALL initialize(const Sequence< Any >& args) throw (RuntimeException); 98cdf0e10cSrcweir 99cdf0e10cSrcweir virtual void SAL_CALL handleEvent(const Reference< XEvent >& evt) throw (RuntimeException); 100cdf0e10cSrcweir 101cdf0e10cSrcweir 102cdf0e10cSrcweir }; 103cdf0e10cSrcweir }} 104cdf0e10cSrcweir 105cdf0e10cSrcweir #endif 106