1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: accessibletabbarbase.cxx,v $
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/accessibletabbarbase.hxx"
34 #ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST
35 #include "accessibility/extended/accessibletabbarpagelist.hxx"
37 #include <toolkit/helper/externallock.hxx>
38 #include <svtools/tabbar.hxx>
40 //.........................................................................
41 namespace accessibility
43 //.........................................................................
45 AccessibleTabBarBase::AccessibleTabBarBase( TabBar
* pTabBar
) :
46 AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() ),
49 m_pExternalLock
= static_cast< VCLExternalSolarLock
* >( getExternalLock() );
50 SetTabBarPointer( pTabBar
);
53 AccessibleTabBarBase::~AccessibleTabBarBase()
56 DELETEZ( m_pExternalLock
);
59 IMPL_LINK( AccessibleTabBarBase
, WindowEventListener
, VclSimpleEvent
*, pEvent
)
61 VclWindowEvent
* pWinEvent
= dynamic_cast< VclWindowEvent
* >( pEvent
);
62 DBG_ASSERT( pWinEvent
, "AccessibleTabBarBase::WindowEventListener - unknown window event" );
65 Window
* pEventWindow
= pWinEvent
->GetWindow();
66 DBG_ASSERT( pEventWindow
, "AccessibleTabBarBase::WindowEventListener: no window!" );
68 if( ( pWinEvent
->GetId() == VCLEVENT_TABBAR_PAGEREMOVED
) &&
69 ( (sal_uInt16
)(sal_IntPtr
) pWinEvent
->GetData() == TABBAR_PAGE_NOTFOUND
) &&
70 ( dynamic_cast< AccessibleTabBarPageList
*> (this) != NULL
) )
75 if ( !pEventWindow
->IsAccessibilityEventsSuppressed() || (pWinEvent
->GetId() == VCLEVENT_OBJECT_DYING
) )
76 ProcessWindowEvent( *pWinEvent
);
81 void AccessibleTabBarBase::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
83 if( rVclWindowEvent
.GetId() == VCLEVENT_OBJECT_DYING
)
89 void AccessibleTabBarBase::disposing()
91 AccessibleExtendedComponentHelper_BASE::disposing();
97 void AccessibleTabBarBase::SetTabBarPointer( TabBar
* pTabBar
)
99 DBG_ASSERT( !m_pTabBar
, "AccessibleTabBarBase::SetTabBarPointer - multiple call" );
102 m_pTabBar
->AddEventListener( LINK( this, AccessibleTabBarBase
, WindowEventListener
) );
105 void AccessibleTabBarBase::ClearTabBarPointer()
109 m_pTabBar
->RemoveEventListener( LINK( this, AccessibleTabBarBase
, WindowEventListener
) );
114 //.........................................................................
115 } // namespace accessibility
116 //.........................................................................