update dev300-m58
[ooovba.git] / vcl / source / app / vclevent.cxx
blobfef22ff7f1cbf22a8c9d2af74a13209ae74bfce3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: vclevent.cxx,v $
10 * $Revision: 1.7 $
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.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_vcl.hxx"
34 #include "vcl/vclevent.hxx"
35 #include "vcl/svdata.hxx"
37 #include <com/sun/star/accessibility/XAccessible.hpp>
39 using ::com::sun::star::uno::Reference;
40 using ::com::sun::star::accessibility::XAccessible;
42 TYPEINIT0(VclSimpleEvent);
43 TYPEINIT1(VclWindowEvent, VclSimpleEvent);
44 TYPEINIT1(VclMenuEvent, VclSimpleEvent);
46 VclAccessibleEvent::VclAccessibleEvent( ULONG n, const Reference<XAccessible>& rxAccessible ) :
47 VclSimpleEvent(n),
48 mxAccessible(rxAccessible) {}
50 Reference<XAccessible> VclAccessibleEvent::GetAccessible() const
52 return mxAccessible;
55 void VclEventListeners::Call( VclSimpleEvent* pEvent ) const
57 // Copy the list, because this can be destroyed when calling a Link...
58 std::list<Link> aCopy( *this );
59 std::list<Link>::iterator aIter( aCopy.begin() );
60 if( pEvent->IsA( VclWindowEvent::StaticType() ) )
62 VclWindowEvent* pWinEvent = static_cast<VclWindowEvent*>(pEvent);
63 ImplDelData aDel( pWinEvent->GetWindow() );
64 while ( aIter != aCopy.end() && ! aDel.IsDead() )
66 (*aIter).Call( pEvent );
67 aIter++;
70 else
72 while ( aIter != aCopy.end() )
74 (*aIter).Call( pEvent );
75 aIter++;
80 BOOL VclEventListeners::Process( VclSimpleEvent* pEvent ) const
82 BOOL bProcessed = FALSE;
83 // Copy the list, because this can be destroyed when calling a Link...
84 std::list<Link> aCopy( *this );
85 std::list<Link>::iterator aIter( aCopy.begin() );
86 while ( aIter != aCopy.end() )
88 if( (*aIter).Call( pEvent ) != 0 )
90 bProcessed = TRUE;
91 break;
93 aIter++;
95 return bProcessed;