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