1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef USERINPUTINTERCEPTION_HXX 25 #define USERINPUTINTERCEPTION_HXX 26 27 #include "sfx2/dllapi.h" 28 29 /** === begin UNO includes === **/ 30 #include <com/sun/star/awt/XUserInputInterception.hpp> 31 /** === end UNO includes === **/ 32 33 #include <boost/noncopyable.hpp> 34 #include <memory> 35 36 class NotifyEvent; 37 38 namespace cppu { class OWeakObject; } 39 40 //........................................................................ 41 namespace sfx2 42 { 43 //........................................................................ 44 45 //==================================================================== 46 //= UserInputInterception 47 //==================================================================== 48 struct UserInputInterception_Data; 49 /** helper class for implementing the XUserInputInterception interface 50 for a controller implementation 51 */ 52 class SFX2_DLLPUBLIC UserInputInterception : public ::boost::noncopyable 53 { 54 public: 55 UserInputInterception( ::cppu::OWeakObject& _rControllerImpl, ::osl::Mutex& _rMutex ); 56 ~UserInputInterception(); 57 58 // delegator functions for your XUserInputInterception implementation 59 void addKeyHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); 60 void removeKeyHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); 61 void addMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); 62 void removeMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); 63 64 // state 65 bool hasKeyHandlers() const; 66 bool hasMouseClickListeners() const; 67 68 // forwarding a NotifyEvent to the KeyListeners respectively MouseClickListeners 69 bool handleNotifyEvent( const NotifyEvent& _rEvent ); 70 71 private: 72 ::std::auto_ptr< UserInputInterception_Data > m_pData; 73 }; 74 75 //........................................................................ 76 } // namespace sfx2 77 //........................................................................ 78 79 #endif // USERINPUTINTERCEPTION_HXX 80