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 SVTOOLS_ASYNCLINK_HXX 25 #define SVTOOLS_ASYNCLINK_HXX 26 27 #include "svtools/svtdllapi.h" 28 #include <tools/solar.h> 29 #include <tools/link.hxx> 30 31 class Timer; 32 33 namespace vos 34 { 35 class OMutex; 36 } 37 38 namespace svtools { 39 40 class SVT_DLLPUBLIC AsynchronLink 41 { 42 Link _aLink; 43 sal_uLong _nEventId; 44 Timer* _pTimer; 45 sal_Bool _bInCall; 46 sal_Bool* _pDeleted; 47 void* _pArg; 48 vos::OMutex* _pMutex; 49 50 DECL_DLLPRIVATE_STATIC_LINK( AsynchronLink, HandleCall, void* ); 51 SVT_DLLPRIVATE void Call_Impl( void* pArg ); 52 53 public: AsynchronLink(const Link & rLink)54 AsynchronLink( const Link& rLink ) : 55 _aLink( rLink ), _nEventId( 0 ), _pTimer( 0 ), _bInCall( sal_False ), 56 _pDeleted( 0 ), _pMutex( 0 ){} AsynchronLink()57 AsynchronLink() : _nEventId( 0 ), _pTimer( 0 ), _bInCall( sal_False ), 58 _pDeleted( 0 ), _pMutex( 0 ){} 59 ~AsynchronLink(); 60 61 void CreateMutex(); operator =(const Link & rLink)62 void operator=( const Link& rLink ) { _aLink = rLink; } 63 void Call( void* pObj, sal_Bool bAllowDoubles = sal_False, 64 sal_Bool bUseTimer = sal_False ); 65 void ForcePendingCall( ); 66 void ClearPendingCall( ); IsSet() const67 sal_Bool IsSet() const { return _aLink.IsSet(); } GetLink() const68 Link GetLink() const { return _aLink; } 69 }; 70 71 } 72 73 #endif 74