update dev300-m58
[ooovba.git] / svx / source / form / delayedevent.cxx
blobaf986d5c5402de9f4a619547143c140758741db3
1 /*************************************************************************
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * Copyright 2008 by Sun Microsystems, Inc.
6 * OpenOffice.org - a multi-platform office productivity suite
8 * $RCSfile: delayedevent.cxx,v $
10 * $Revision: 1.1.2.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
28 ************************************************************************/
30 #include "precompiled_svx.hxx"
32 #include "delayedevent.hxx"
34 #include <osl/diagnose.h>
35 #include <vcl/svapp.hxx>
37 //........................................................................
38 namespace svxform
40 //........................................................................
42 //====================================================================
43 //= DelayedEvent
44 //====================================================================
45 //--------------------------------------------------------------------
46 void DelayedEvent::Call( void* _pArg )
48 CancelPendingCall();
49 OSL_POSTCOND( m_nEventId == 0, "DelayedEvent::Call: CancelPendingCall did not work!" );
51 m_nEventId = Application::PostUserEvent( LINK( this, DelayedEvent, OnCall ), _pArg );
54 //--------------------------------------------------------------------
55 void DelayedEvent::CancelPendingCall()
57 if ( m_nEventId )
58 Application::RemoveUserEvent( m_nEventId );
59 m_nEventId = 0;
62 //--------------------------------------------------------------------
63 IMPL_LINK( DelayedEvent, OnCall, void*, _pArg )
65 m_nEventId = 0;
66 return m_aHandler.Call( _pArg );
69 //........................................................................
70 } // namespace svxform
71 //........................................................................