xref: /AOO41X/main/accessibility/source/extended/accessibletabbar.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_accessibility.hxx"
30*cdf0e10cSrcweir #include <accessibility/extended/accessibletabbar.hxx>
31*cdf0e10cSrcweir #include <svtools/tabbar.hxx>
32*cdf0e10cSrcweir #include <accessibility/extended/accessibletabbarpagelist.hxx>
33*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
36*cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
37*cdf0e10cSrcweir #include <unotools/accessiblerelationsethelper.hxx>
38*cdf0e10cSrcweir #include <vcl/svapp.hxx>
39*cdf0e10cSrcweir #include <toolkit/awt/vclxfont.hxx>
40*cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include <vector>
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir //.........................................................................
46*cdf0e10cSrcweir namespace accessibility
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir //.........................................................................
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir 	using namespace ::com::sun::star;
51*cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
52*cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
53*cdf0e10cSrcweir 	using namespace ::com::sun::star::accessibility;
54*cdf0e10cSrcweir 	using namespace ::comphelper;
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir 	DBG_NAME( AccessibleTabBar )
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir 	//	----------------------------------------------------
59*cdf0e10cSrcweir 	//	class AccessibleTabBar
60*cdf0e10cSrcweir 	//	----------------------------------------------------
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir 	AccessibleTabBar::AccessibleTabBar( TabBar* pTabBar )
63*cdf0e10cSrcweir         :AccessibleTabBarBase( pTabBar )
64*cdf0e10cSrcweir 	{
65*cdf0e10cSrcweir 	    DBG_CTOR( AccessibleTabBar, NULL );
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir 		if ( m_pTabBar )
68*cdf0e10cSrcweir 			m_aAccessibleChildren.assign( m_pTabBar->GetAccessibleChildWindowCount() + 1, Reference< XAccessible >() );
69*cdf0e10cSrcweir 	}
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir 	AccessibleTabBar::~AccessibleTabBar()
74*cdf0e10cSrcweir 	{
75*cdf0e10cSrcweir 	    DBG_DTOR( AccessibleTabBar, NULL );
76*cdf0e10cSrcweir 	}
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir 	void AccessibleTabBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
81*cdf0e10cSrcweir 	{
82*cdf0e10cSrcweir 		Any aOldValue, aNewValue;
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir 		switch ( rVclWindowEvent.GetId() )
85*cdf0e10cSrcweir 		{
86*cdf0e10cSrcweir 			case VCLEVENT_WINDOW_ENABLED:
87*cdf0e10cSrcweir 			{
88*cdf0e10cSrcweir                 aNewValue <<= AccessibleStateType::SENSITIVE;
89*cdf0e10cSrcweir                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
90*cdf0e10cSrcweir 				aNewValue <<= AccessibleStateType::ENABLED;
91*cdf0e10cSrcweir 				NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
92*cdf0e10cSrcweir 			}
93*cdf0e10cSrcweir 			break;
94*cdf0e10cSrcweir 			case VCLEVENT_WINDOW_DISABLED:
95*cdf0e10cSrcweir 			{
96*cdf0e10cSrcweir 				aOldValue <<= AccessibleStateType::ENABLED;
97*cdf0e10cSrcweir 				NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
98*cdf0e10cSrcweir                 aOldValue <<= AccessibleStateType::SENSITIVE;
99*cdf0e10cSrcweir                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
100*cdf0e10cSrcweir 			}
101*cdf0e10cSrcweir 			break;
102*cdf0e10cSrcweir 			case VCLEVENT_WINDOW_GETFOCUS:
103*cdf0e10cSrcweir 			{
104*cdf0e10cSrcweir 				aNewValue <<= AccessibleStateType::FOCUSED;
105*cdf0e10cSrcweir 				NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
106*cdf0e10cSrcweir 			}
107*cdf0e10cSrcweir 			break;
108*cdf0e10cSrcweir 			case VCLEVENT_WINDOW_LOSEFOCUS:
109*cdf0e10cSrcweir 			{
110*cdf0e10cSrcweir 				aOldValue <<= AccessibleStateType::FOCUSED;
111*cdf0e10cSrcweir 				NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
112*cdf0e10cSrcweir 			}
113*cdf0e10cSrcweir 			break;
114*cdf0e10cSrcweir 			case VCLEVENT_WINDOW_SHOW:
115*cdf0e10cSrcweir 			{
116*cdf0e10cSrcweir 				aNewValue <<= AccessibleStateType::SHOWING;
117*cdf0e10cSrcweir 				NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
118*cdf0e10cSrcweir 			}
119*cdf0e10cSrcweir 			break;
120*cdf0e10cSrcweir 			case VCLEVENT_WINDOW_HIDE:
121*cdf0e10cSrcweir 			{
122*cdf0e10cSrcweir 				aOldValue <<= AccessibleStateType::SHOWING;
123*cdf0e10cSrcweir 				NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
124*cdf0e10cSrcweir 			}
125*cdf0e10cSrcweir 			break;
126*cdf0e10cSrcweir 			default:
127*cdf0e10cSrcweir 			{
128*cdf0e10cSrcweir                 AccessibleTabBarBase::ProcessWindowEvent( rVclWindowEvent );
129*cdf0e10cSrcweir 			}
130*cdf0e10cSrcweir 			break;
131*cdf0e10cSrcweir 		}
132*cdf0e10cSrcweir 	}
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir 	void AccessibleTabBar::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
137*cdf0e10cSrcweir 	{
138*cdf0e10cSrcweir 		if ( m_pTabBar )
139*cdf0e10cSrcweir 		{
140*cdf0e10cSrcweir 			if ( m_pTabBar->IsEnabled() )
141*cdf0e10cSrcweir             {
142*cdf0e10cSrcweir                 rStateSet.AddState( AccessibleStateType::ENABLED );
143*cdf0e10cSrcweir                 rStateSet.AddState( AccessibleStateType::SENSITIVE );
144*cdf0e10cSrcweir             }
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 			rStateSet.AddState( AccessibleStateType::FOCUSABLE );
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 			if ( m_pTabBar->HasFocus() )
149*cdf0e10cSrcweir 				rStateSet.AddState( AccessibleStateType::FOCUSED );
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 			rStateSet.AddState( AccessibleStateType::VISIBLE );
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 			if ( m_pTabBar->IsVisible() )
154*cdf0e10cSrcweir 				rStateSet.AddState( AccessibleStateType::SHOWING );
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 			if ( m_pTabBar->GetStyle() & WB_SIZEABLE )
157*cdf0e10cSrcweir 				rStateSet.AddState( AccessibleStateType::RESIZABLE );
158*cdf0e10cSrcweir 		}
159*cdf0e10cSrcweir 	}
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
162*cdf0e10cSrcweir 	// OCommonAccessibleComponent
163*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 	awt::Rectangle AccessibleTabBar::implGetBounds() throw (RuntimeException)
166*cdf0e10cSrcweir 	{
167*cdf0e10cSrcweir 		awt::Rectangle aBounds;
168*cdf0e10cSrcweir 		if ( m_pTabBar )
169*cdf0e10cSrcweir 			aBounds = AWTRectangle( Rectangle( m_pTabBar->GetPosPixel(), m_pTabBar->GetSizePixel() ) );
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 		return aBounds;
172*cdf0e10cSrcweir 	}
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
175*cdf0e10cSrcweir 	// XInterface
176*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 	IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabBar, AccessibleExtendedComponentHelper_BASE, AccessibleTabBar_BASE )
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
181*cdf0e10cSrcweir 	// XTypeProvider
182*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 	IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabBar, AccessibleExtendedComponentHelper_BASE, AccessibleTabBar_BASE )
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
187*cdf0e10cSrcweir 	// XComponent
188*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir 	void AccessibleTabBar::disposing()
191*cdf0e10cSrcweir 	{
192*cdf0e10cSrcweir         AccessibleTabBarBase::disposing();
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir         // dispose all children
195*cdf0e10cSrcweir         for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
196*cdf0e10cSrcweir         {
197*cdf0e10cSrcweir             Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
198*cdf0e10cSrcweir             if ( xComponent.is() )
199*cdf0e10cSrcweir                 xComponent->dispose();
200*cdf0e10cSrcweir         }
201*cdf0e10cSrcweir         m_aAccessibleChildren.clear();
202*cdf0e10cSrcweir 	}
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
205*cdf0e10cSrcweir 	// XServiceInfo
206*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir 	::rtl::OUString AccessibleTabBar::getImplementationName() throw (RuntimeException)
209*cdf0e10cSrcweir 	{
210*cdf0e10cSrcweir 		return ::rtl::OUString::createFromAscii( "com.sun.star.comp.svtools.AccessibleTabBar" );
211*cdf0e10cSrcweir 	}
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir 	sal_Bool AccessibleTabBar::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
216*cdf0e10cSrcweir 	{
217*cdf0e10cSrcweir 		Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
218*cdf0e10cSrcweir 		const ::rtl::OUString* pNames = aNames.getConstArray();
219*cdf0e10cSrcweir 		const ::rtl::OUString* pEnd = pNames + aNames.getLength();
220*cdf0e10cSrcweir 		for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
221*cdf0e10cSrcweir 			;
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir 		return pNames != pEnd;
224*cdf0e10cSrcweir 	}
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > AccessibleTabBar::getSupportedServiceNames() throw (RuntimeException)
229*cdf0e10cSrcweir 	{
230*cdf0e10cSrcweir 		Sequence< ::rtl::OUString > aNames(1);
231*cdf0e10cSrcweir 		aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleTabBar" );
232*cdf0e10cSrcweir 		return aNames;
233*cdf0e10cSrcweir 	}
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
236*cdf0e10cSrcweir 	// XAccessible
237*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 	Reference< XAccessibleContext > AccessibleTabBar::getAccessibleContext(  ) throw (RuntimeException)
240*cdf0e10cSrcweir 	{
241*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 		return this;
244*cdf0e10cSrcweir 	}
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
247*cdf0e10cSrcweir 	// XAccessibleContext
248*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 	sal_Int32 AccessibleTabBar::getAccessibleChildCount() throw (RuntimeException)
251*cdf0e10cSrcweir 	{
252*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 		return m_aAccessibleChildren.size();
255*cdf0e10cSrcweir 	}
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir 	Reference< XAccessible > AccessibleTabBar::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
260*cdf0e10cSrcweir 	{
261*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir 		if ( i < 0 || i >= getAccessibleChildCount() )
264*cdf0e10cSrcweir 			throw IndexOutOfBoundsException();
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 		Reference< XAccessible > xChild = m_aAccessibleChildren[i];
267*cdf0e10cSrcweir 		if ( !xChild.is() )
268*cdf0e10cSrcweir 		{
269*cdf0e10cSrcweir 			if ( m_pTabBar )
270*cdf0e10cSrcweir 			{
271*cdf0e10cSrcweir 				sal_Int32 nCount = m_pTabBar->GetAccessibleChildWindowCount();
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 				if ( i < nCount )
274*cdf0e10cSrcweir 				{
275*cdf0e10cSrcweir 					Window* pChild = m_pTabBar->GetAccessibleChildWindow( (sal_uInt16)i );
276*cdf0e10cSrcweir 					if ( pChild )
277*cdf0e10cSrcweir 						xChild = pChild->GetAccessible();
278*cdf0e10cSrcweir 				}
279*cdf0e10cSrcweir 				else if ( i == nCount )
280*cdf0e10cSrcweir 				{
281*cdf0e10cSrcweir 					xChild = new AccessibleTabBarPageList( m_pTabBar, i );
282*cdf0e10cSrcweir 				}
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir 				// insert into child list
285*cdf0e10cSrcweir 				m_aAccessibleChildren[i] = xChild;
286*cdf0e10cSrcweir 			}
287*cdf0e10cSrcweir 		}
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir 		return xChild;
290*cdf0e10cSrcweir 	}
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 	Reference< XAccessible > AccessibleTabBar::getAccessibleParent(  ) throw (RuntimeException)
295*cdf0e10cSrcweir 	{
296*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir 		Reference< XAccessible > xParent;
299*cdf0e10cSrcweir 		if ( m_pTabBar )
300*cdf0e10cSrcweir 		{
301*cdf0e10cSrcweir 			Window* pParent = m_pTabBar->GetAccessibleParentWindow();
302*cdf0e10cSrcweir 			if ( pParent )
303*cdf0e10cSrcweir 				xParent = pParent->GetAccessible();
304*cdf0e10cSrcweir 		}
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir 		return xParent;
307*cdf0e10cSrcweir 	}
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir 	sal_Int32 AccessibleTabBar::getAccessibleIndexInParent(  ) throw (RuntimeException)
312*cdf0e10cSrcweir 	{
313*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 		sal_Int32 nIndexInParent = -1;
316*cdf0e10cSrcweir 		if ( m_pTabBar )
317*cdf0e10cSrcweir 		{
318*cdf0e10cSrcweir 			Window* pParent = m_pTabBar->GetAccessibleParentWindow();
319*cdf0e10cSrcweir 			if ( pParent )
320*cdf0e10cSrcweir 			{
321*cdf0e10cSrcweir 				for ( sal_uInt16 i = 0, nCount = pParent->GetAccessibleChildWindowCount(); i < nCount; ++i )
322*cdf0e10cSrcweir 				{
323*cdf0e10cSrcweir 					Window* pChild = pParent->GetAccessibleChildWindow( i );
324*cdf0e10cSrcweir 					if ( pChild == static_cast< Window* >( m_pTabBar ) )
325*cdf0e10cSrcweir 					{
326*cdf0e10cSrcweir 						nIndexInParent = i;
327*cdf0e10cSrcweir 						break;
328*cdf0e10cSrcweir 					}
329*cdf0e10cSrcweir 				}
330*cdf0e10cSrcweir 			}
331*cdf0e10cSrcweir 		}
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir 		return nIndexInParent;
334*cdf0e10cSrcweir 	}
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir 	sal_Int16 AccessibleTabBar::getAccessibleRole(  ) throw (RuntimeException)
339*cdf0e10cSrcweir 	{
340*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir 		return AccessibleRole::PANEL;
343*cdf0e10cSrcweir 	}
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir 	::rtl::OUString AccessibleTabBar::getAccessibleDescription(	) throw (RuntimeException)
348*cdf0e10cSrcweir 	{
349*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir 		::rtl::OUString sDescription;
352*cdf0e10cSrcweir 		if ( m_pTabBar )
353*cdf0e10cSrcweir 			sDescription = m_pTabBar->GetAccessibleDescription();
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir 		return sDescription;
356*cdf0e10cSrcweir 	}
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir 	::rtl::OUString AccessibleTabBar::getAccessibleName(  ) throw (RuntimeException)
361*cdf0e10cSrcweir 	{
362*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir 		::rtl::OUString sName;
365*cdf0e10cSrcweir 		if ( m_pTabBar )
366*cdf0e10cSrcweir 			sName = m_pTabBar->GetAccessibleName();
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 		return sName;
369*cdf0e10cSrcweir 	}
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir 	Reference< XAccessibleRelationSet > AccessibleTabBar::getAccessibleRelationSet(  ) throw (RuntimeException)
374*cdf0e10cSrcweir 	{
375*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir 		utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
378*cdf0e10cSrcweir 		Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
379*cdf0e10cSrcweir 		return xSet;
380*cdf0e10cSrcweir 	}
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 	Reference< XAccessibleStateSet > AccessibleTabBar::getAccessibleStateSet(  ) throw (RuntimeException)
385*cdf0e10cSrcweir 	{
386*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir 		utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
389*cdf0e10cSrcweir 		Reference< XAccessibleStateSet > xSet = pStateSetHelper;
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir 		if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
392*cdf0e10cSrcweir 		{
393*cdf0e10cSrcweir 			FillAccessibleStateSet( *pStateSetHelper );
394*cdf0e10cSrcweir 		}
395*cdf0e10cSrcweir 		else
396*cdf0e10cSrcweir 		{
397*cdf0e10cSrcweir 			pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
398*cdf0e10cSrcweir 		}
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir 		return xSet;
401*cdf0e10cSrcweir 	}
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir 	Locale AccessibleTabBar::getLocale(  ) throw (IllegalAccessibleComponentStateException, RuntimeException)
406*cdf0e10cSrcweir 	{
407*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
408*cdf0e10cSrcweir 
409*cdf0e10cSrcweir 		return Application::GetSettings().GetLocale();
410*cdf0e10cSrcweir 	}
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
413*cdf0e10cSrcweir 	// XAccessibleComponent
414*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir 	Reference< XAccessible > AccessibleTabBar::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException)
417*cdf0e10cSrcweir 	{
418*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir 		Reference< XAccessible > xChild;
421*cdf0e10cSrcweir 		for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
422*cdf0e10cSrcweir 		{
423*cdf0e10cSrcweir 			Reference< XAccessible > xAcc = getAccessibleChild( i );
424*cdf0e10cSrcweir 			if ( xAcc.is() )
425*cdf0e10cSrcweir 			{
426*cdf0e10cSrcweir 				Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY );
427*cdf0e10cSrcweir 				if ( xComp.is() )
428*cdf0e10cSrcweir 				{
429*cdf0e10cSrcweir 					Rectangle aRect = VCLRectangle( xComp->getBounds() );
430*cdf0e10cSrcweir 					Point aPos = VCLPoint( rPoint );
431*cdf0e10cSrcweir 					if ( aRect.IsInside( aPos ) )
432*cdf0e10cSrcweir 					{
433*cdf0e10cSrcweir 						xChild = xAcc;
434*cdf0e10cSrcweir 						break;
435*cdf0e10cSrcweir 					}
436*cdf0e10cSrcweir 				}
437*cdf0e10cSrcweir 			}
438*cdf0e10cSrcweir 		}
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir 		return xChild;
441*cdf0e10cSrcweir 	}
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir 	void AccessibleTabBar::grabFocus(  ) throw (RuntimeException)
446*cdf0e10cSrcweir 	{
447*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir 		if ( m_pTabBar )
450*cdf0e10cSrcweir 			m_pTabBar->GrabFocus();
451*cdf0e10cSrcweir 	}
452*cdf0e10cSrcweir 
453*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir 	sal_Int32 AccessibleTabBar::getForeground(	) throw (RuntimeException)
456*cdf0e10cSrcweir 	{
457*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
458*cdf0e10cSrcweir 
459*cdf0e10cSrcweir 		sal_Int32 nColor = 0;
460*cdf0e10cSrcweir 		if ( m_pTabBar )
461*cdf0e10cSrcweir 		{
462*cdf0e10cSrcweir 			if ( m_pTabBar->IsControlForeground() )
463*cdf0e10cSrcweir 				nColor = m_pTabBar->GetControlForeground().GetColor();
464*cdf0e10cSrcweir 			else
465*cdf0e10cSrcweir 			{
466*cdf0e10cSrcweir 				Font aFont;
467*cdf0e10cSrcweir 				if ( m_pTabBar->IsControlFont() )
468*cdf0e10cSrcweir 					aFont = m_pTabBar->GetControlFont();
469*cdf0e10cSrcweir 				else
470*cdf0e10cSrcweir 					aFont = m_pTabBar->GetFont();
471*cdf0e10cSrcweir 				nColor = aFont.GetColor().GetColor();
472*cdf0e10cSrcweir 			}
473*cdf0e10cSrcweir 		}
474*cdf0e10cSrcweir 
475*cdf0e10cSrcweir 		return nColor;
476*cdf0e10cSrcweir 	}
477*cdf0e10cSrcweir 
478*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir 	sal_Int32 AccessibleTabBar::getBackground(  ) throw (RuntimeException)
481*cdf0e10cSrcweir 	{
482*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir 		sal_Int32 nColor = 0;
485*cdf0e10cSrcweir 		if ( m_pTabBar )
486*cdf0e10cSrcweir 		{
487*cdf0e10cSrcweir 			if ( m_pTabBar->IsControlBackground() )
488*cdf0e10cSrcweir 				nColor = m_pTabBar->GetControlBackground().GetColor();
489*cdf0e10cSrcweir 			else
490*cdf0e10cSrcweir 				nColor = m_pTabBar->GetBackground().GetColor().GetColor();
491*cdf0e10cSrcweir 		}
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir 		return nColor;
494*cdf0e10cSrcweir 	}
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
497*cdf0e10cSrcweir 	// XAccessibleExtendedComponent
498*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
499*cdf0e10cSrcweir 
500*cdf0e10cSrcweir 	Reference< awt::XFont > AccessibleTabBar::getFont(  ) throw (RuntimeException)
501*cdf0e10cSrcweir 	{
502*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir 		Reference< awt::XFont > xFont;
505*cdf0e10cSrcweir 		if ( m_pTabBar )
506*cdf0e10cSrcweir 		{
507*cdf0e10cSrcweir 			Reference< awt::XDevice > xDev( m_pTabBar->GetComponentInterface(), UNO_QUERY );
508*cdf0e10cSrcweir 			if ( xDev.is() )
509*cdf0e10cSrcweir 			{
510*cdf0e10cSrcweir 				Font aFont;
511*cdf0e10cSrcweir 				if ( m_pTabBar->IsControlFont() )
512*cdf0e10cSrcweir 					aFont = m_pTabBar->GetControlFont();
513*cdf0e10cSrcweir 				else
514*cdf0e10cSrcweir 					aFont = m_pTabBar->GetFont();
515*cdf0e10cSrcweir 				VCLXFont* pVCLXFont = new VCLXFont;
516*cdf0e10cSrcweir 				pVCLXFont->Init( *xDev.get(), aFont );
517*cdf0e10cSrcweir 				xFont = pVCLXFont;
518*cdf0e10cSrcweir 			}
519*cdf0e10cSrcweir 		}
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir 		return xFont;
522*cdf0e10cSrcweir 	}
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
525*cdf0e10cSrcweir 
526*cdf0e10cSrcweir 	::rtl::OUString AccessibleTabBar::getTitledBorderText(  ) throw (RuntimeException)
527*cdf0e10cSrcweir 	{
528*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
529*cdf0e10cSrcweir 
530*cdf0e10cSrcweir 		::rtl::OUString sText;
531*cdf0e10cSrcweir 		if ( m_pTabBar )
532*cdf0e10cSrcweir 			sText = m_pTabBar->GetText();
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir 		return sText;
535*cdf0e10cSrcweir 	}
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
538*cdf0e10cSrcweir 
539*cdf0e10cSrcweir 	::rtl::OUString AccessibleTabBar::getToolTipText(  ) throw (RuntimeException)
540*cdf0e10cSrcweir 	{
541*cdf0e10cSrcweir 		OExternalLockGuard aGuard( this );
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir 		::rtl::OUString sText;
544*cdf0e10cSrcweir 		if ( m_pTabBar )
545*cdf0e10cSrcweir 			sText = m_pTabBar->GetQuickHelpText();
546*cdf0e10cSrcweir 
547*cdf0e10cSrcweir 		return sText;
548*cdf0e10cSrcweir 	}
549*cdf0e10cSrcweir 
550*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
551*cdf0e10cSrcweir 
552*cdf0e10cSrcweir //.........................................................................
553*cdf0e10cSrcweir }	// namespace accessibility
554*cdf0e10cSrcweir //.........................................................................
555