update dev300-m58
[ooovba.git] / accessibility / source / extended / listboxaccessible.cxx
blobeb64ba13e05f720ad65493805e3d5b9c7d5646a4
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: listboxaccessible.cxx,v $
10 * $Revision: 1.3 $
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_accessibility.hxx"
33 #include <accessibility/extended/listboxaccessible.hxx>
34 #include <svtools/svtreebx.hxx>
36 //........................................................................
37 namespace accessibility
39 //........................................................................
41 //====================================================================
42 //= ListBoxAccessibleBase
43 //====================================================================
44 //--------------------------------------------------------------------
45 ListBoxAccessibleBase::ListBoxAccessibleBase( SvTreeListBox& _rWindow )
46 :m_pWindow( &_rWindow )
48 m_pWindow->AddEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) );
51 //--------------------------------------------------------------------
52 ListBoxAccessibleBase::~ListBoxAccessibleBase( )
54 if ( m_pWindow )
56 // cannot call "dispose" here, as it is abstract, so the VTABLE of the derived class
57 // is not intact anymore
58 // so we call our "disposing" only
59 disposing();
63 //--------------------------------------------------------------------
64 IMPL_LINK( ListBoxAccessibleBase, WindowEventListener, VclSimpleEvent*, pEvent )
66 DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "ListBoxAccessibleBase::WindowEventListener: unexpected WindowEvent!" );
67 if ( pEvent && pEvent->ISA( VclWindowEvent ) )
69 DBG_ASSERT( static_cast< VclWindowEvent* >( pEvent )->GetWindow() , "ListBoxAccessibleBase::WindowEventListener: no event window!" );
70 DBG_ASSERT( static_cast< VclWindowEvent* >( pEvent )->GetWindow() == m_pWindow, "ListBoxAccessibleBase::WindowEventListener: where did this come from?" );
72 ProcessWindowEvent( *static_cast< VclWindowEvent* >( pEvent ) );
74 return 0;
77 // -----------------------------------------------------------------------------
78 void ListBoxAccessibleBase::disposing()
80 if ( m_pWindow )
81 m_pWindow->RemoveEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) );
82 m_pWindow = NULL;
85 // -----------------------------------------------------------------------------
86 void ListBoxAccessibleBase::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
88 if ( isAlive() )
90 switch ( _rVclWindowEvent.GetId() )
92 case VCLEVENT_OBJECT_DYING :
94 if ( m_pWindow )
95 m_pWindow->RemoveEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) );
96 m_pWindow = NULL;
97 dispose();
98 break;
104 //........................................................................
105 } // namespace accessibility
106 //........................................................................