1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "accessibility/extended/accessibletabbarbase.hxx"
21 #ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST
22 #include "accessibility/extended/accessibletabbarpagelist.hxx"
24 #include <toolkit/helper/externallock.hxx>
25 #include <svtools/tabbar.hxx>
28 namespace accessibility
32 AccessibleTabBarBase::AccessibleTabBarBase( TabBar
* pTabBar
) :
33 AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() ),
36 m_pExternalLock
= static_cast< VCLExternalSolarLock
* >( getExternalLock() );
37 SetTabBarPointer( pTabBar
);
40 AccessibleTabBarBase::~AccessibleTabBarBase()
43 DELETEZ( m_pExternalLock
);
46 IMPL_LINK( AccessibleTabBarBase
, WindowEventListener
, VclSimpleEvent
*, pEvent
)
48 VclWindowEvent
* pWinEvent
= dynamic_cast< VclWindowEvent
* >( pEvent
);
49 OSL_ENSURE( pWinEvent
, "AccessibleTabBarBase::WindowEventListener - unknown window event" );
52 vcl::Window
* pEventWindow
= pWinEvent
->GetWindow();
53 OSL_ENSURE( pEventWindow
, "AccessibleTabBarBase::WindowEventListener: no window!" );
55 if( ( pWinEvent
->GetId() == VCLEVENT_TABBAR_PAGEREMOVED
) &&
56 ( (sal_uInt16
)reinterpret_cast<sal_IntPtr
>(pWinEvent
->GetData()) == TabBar::PAGE_NOT_FOUND
) &&
57 ( dynamic_cast< AccessibleTabBarPageList
*> (this) != NULL
) )
62 if ( !pEventWindow
->IsAccessibilityEventsSuppressed() || (pWinEvent
->GetId() == VCLEVENT_OBJECT_DYING
) )
63 ProcessWindowEvent( *pWinEvent
);
68 void AccessibleTabBarBase::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
70 if( rVclWindowEvent
.GetId() == VCLEVENT_OBJECT_DYING
)
76 void AccessibleTabBarBase::disposing()
78 AccessibleExtendedComponentHelper_BASE::disposing();
84 void AccessibleTabBarBase::SetTabBarPointer( TabBar
* pTabBar
)
86 OSL_ENSURE( !m_pTabBar
, "AccessibleTabBarBase::SetTabBarPointer - multiple call" );
89 m_pTabBar
->AddEventListener( LINK( this, AccessibleTabBarBase
, WindowEventListener
) );
92 void AccessibleTabBarBase::ClearTabBarPointer()
96 m_pTabBar
->RemoveEventListener( LINK( this, AccessibleTabBarBase
, WindowEventListener
) );
102 } // namespace accessibility
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */