xref: /AOO41X/main/accessibility/source/extended/accessiblelistboxentry.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/accessiblelistboxentry.hxx"
31*cdf0e10cSrcweir #include <svtools/svtreebx.hxx>
32*cdf0e10cSrcweir #include <svtools/stringtransfer.hxx>
33*cdf0e10cSrcweir #include <com/sun/star/awt/Point.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
40*cdf0e10cSrcweir #include <tools/debug.hxx>
41*cdf0e10cSrcweir #include <vcl/svapp.hxx>
42*cdf0e10cSrcweir #include <vcl/controllayout.hxx>
43*cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
44*cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
45*cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
46*cdf0e10cSrcweir #include <unotools/accessiblerelationsethelper.hxx>
47*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
48*cdf0e10cSrcweir #include <comphelper/sequence.hxx>
49*cdf0e10cSrcweir #include <comphelper/accessibleeventnotifier.hxx>
50*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir #define ACCESSIBLE_ACTION_COUNT	1
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir namespace
55*cdf0e10cSrcweir {
56*cdf0e10cSrcweir 	void checkActionIndex_Impl( sal_Int32 _nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException)
57*cdf0e10cSrcweir 	{
58*cdf0e10cSrcweir 		if ( _nIndex < 0 || _nIndex >= ACCESSIBLE_ACTION_COUNT )
59*cdf0e10cSrcweir 			// only three actions
60*cdf0e10cSrcweir 			throw ::com::sun::star::lang::IndexOutOfBoundsException();
61*cdf0e10cSrcweir 	}
62*cdf0e10cSrcweir }
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir //........................................................................
65*cdf0e10cSrcweir namespace accessibility
66*cdf0e10cSrcweir {
67*cdf0e10cSrcweir 	//........................................................................
68*cdf0e10cSrcweir 	// class ALBSolarGuard ---------------------------------------------------------
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 	/** Aquire the solar mutex. */
71*cdf0e10cSrcweir 	class ALBSolarGuard : public ::vos::OGuard
72*cdf0e10cSrcweir 	{
73*cdf0e10cSrcweir 	public:
74*cdf0e10cSrcweir     	inline ALBSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {}
75*cdf0e10cSrcweir 	};
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir 	// class AccessibleListBoxEntry -----------------------------------------------------
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 	using namespace ::com::sun::star::accessibility;
80*cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
81*cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
82*cdf0e10cSrcweir 	using namespace ::com::sun::star;
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir 	DBG_NAME(AccessibleListBoxEntry)
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
87*cdf0e10cSrcweir 	// Ctor() and Dtor()
88*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
89*cdf0e10cSrcweir 	AccessibleListBoxEntry::AccessibleListBoxEntry( SvTreeListBox& _rListBox,
90*cdf0e10cSrcweir 													SvLBoxEntry* _pEntry,
91*cdf0e10cSrcweir 													const Reference< XAccessible >& _xParent ) :
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 		AccessibleListBoxEntry_BASE	( m_aMutex ),
94*cdf0e10cSrcweir 		ListBoxAccessibleBase( _rListBox ),
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir         m_nClientId     ( 0 ),
97*cdf0e10cSrcweir 		m_aParent		( _xParent )
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 	{
100*cdf0e10cSrcweir 		DBG_CTOR( AccessibleListBoxEntry, NULL );
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 		_rListBox.FillEntryPath( _pEntry, m_aEntryPath );
103*cdf0e10cSrcweir 	}
104*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
105*cdf0e10cSrcweir 	AccessibleListBoxEntry::~AccessibleListBoxEntry()
106*cdf0e10cSrcweir 	{
107*cdf0e10cSrcweir 		DBG_DTOR( AccessibleListBoxEntry, NULL );
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 		if ( IsAlive_Impl() )
110*cdf0e10cSrcweir 		{
111*cdf0e10cSrcweir         	// increment ref count to prevent double call of Dtor
112*cdf0e10cSrcweir         	osl_incrementInterlockedCount( &m_refCount );
113*cdf0e10cSrcweir         	dispose();
114*cdf0e10cSrcweir 		}
115*cdf0e10cSrcweir 	}
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
118*cdf0e10cSrcweir 	Rectangle AccessibleListBoxEntry::GetBoundingBox_Impl() const
119*cdf0e10cSrcweir 	{
120*cdf0e10cSrcweir 		Rectangle aRect;
121*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
122*cdf0e10cSrcweir 		if ( pEntry )
123*cdf0e10cSrcweir 		{
124*cdf0e10cSrcweir 			aRect = getListBox()->GetBoundingRect( pEntry );
125*cdf0e10cSrcweir 			SvLBoxEntry* pParent = getListBox()->GetParent( pEntry );
126*cdf0e10cSrcweir 			if ( pParent )
127*cdf0e10cSrcweir 			{
128*cdf0e10cSrcweir 				// position relative to parent entry
129*cdf0e10cSrcweir 				Point aTopLeft = aRect.TopLeft();
130*cdf0e10cSrcweir     			aTopLeft -= getListBox()->GetBoundingRect( pParent ).TopLeft();
131*cdf0e10cSrcweir 				aRect = Rectangle( aTopLeft, aRect.GetSize() );
132*cdf0e10cSrcweir 			}
133*cdf0e10cSrcweir 		}
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 		return aRect;
136*cdf0e10cSrcweir 	}
137*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
138*cdf0e10cSrcweir 	Rectangle AccessibleListBoxEntry::GetBoundingBoxOnScreen_Impl() const
139*cdf0e10cSrcweir 	{
140*cdf0e10cSrcweir 		Rectangle aRect;
141*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
142*cdf0e10cSrcweir 		if ( pEntry )
143*cdf0e10cSrcweir 		{
144*cdf0e10cSrcweir 			aRect = getListBox()->GetBoundingRect( pEntry );
145*cdf0e10cSrcweir 			Point aTopLeft = aRect.TopLeft();
146*cdf0e10cSrcweir     		aTopLeft += getListBox()->GetWindowExtentsRelative( NULL ).TopLeft();
147*cdf0e10cSrcweir 			aRect = Rectangle( aTopLeft, aRect.GetSize() );
148*cdf0e10cSrcweir 		}
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 		return aRect;
151*cdf0e10cSrcweir 	}
152*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
153*cdf0e10cSrcweir 	sal_Bool AccessibleListBoxEntry::IsAlive_Impl() const
154*cdf0e10cSrcweir 	{
155*cdf0e10cSrcweir     	return ( !rBHelper.bDisposed && !rBHelper.bInDispose && isAlive() );
156*cdf0e10cSrcweir 	}
157*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
158*cdf0e10cSrcweir 	sal_Bool AccessibleListBoxEntry::IsShowing_Impl() const
159*cdf0e10cSrcweir 	{
160*cdf0e10cSrcweir 		Reference< XAccessible > xParent = implGetParentAccessible( );
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 		sal_Bool bShowing = sal_False;
163*cdf0e10cSrcweir 		Reference< XAccessibleContext > m_xParentContext =
164*cdf0e10cSrcweir 			xParent.is() ? xParent->getAccessibleContext() : Reference< XAccessibleContext >();
165*cdf0e10cSrcweir     	if( m_xParentContext.is() )
166*cdf0e10cSrcweir     	{
167*cdf0e10cSrcweir         	Reference< XAccessibleComponent > xParentComp( m_xParentContext, uno::UNO_QUERY );
168*cdf0e10cSrcweir         	if( xParentComp.is() )
169*cdf0e10cSrcweir             	bShowing = GetBoundingBox_Impl().IsOver( VCLRectangle( xParentComp->getBounds() ) );
170*cdf0e10cSrcweir     	}
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 		return bShowing;
173*cdf0e10cSrcweir 	}
174*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
175*cdf0e10cSrcweir 	Rectangle AccessibleListBoxEntry::GetBoundingBox() throw ( lang::DisposedException )
176*cdf0e10cSrcweir 	{
177*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
178*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 		EnsureIsAlive();
181*cdf0e10cSrcweir     	return GetBoundingBox_Impl();
182*cdf0e10cSrcweir 	}
183*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
184*cdf0e10cSrcweir 	Rectangle AccessibleListBoxEntry::GetBoundingBoxOnScreen() throw ( lang::DisposedException )
185*cdf0e10cSrcweir 	{
186*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
187*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir 		EnsureIsAlive();
190*cdf0e10cSrcweir     	return GetBoundingBoxOnScreen_Impl();
191*cdf0e10cSrcweir 	}
192*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
193*cdf0e10cSrcweir 	void AccessibleListBoxEntry::EnsureIsAlive() const throw ( lang::DisposedException )
194*cdf0e10cSrcweir 	{
195*cdf0e10cSrcweir     	if ( !IsAlive_Impl() )
196*cdf0e10cSrcweir         	throw lang::DisposedException();
197*cdf0e10cSrcweir 	}
198*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
199*cdf0e10cSrcweir 	::rtl::OUString AccessibleListBoxEntry::implGetText()
200*cdf0e10cSrcweir 	{
201*cdf0e10cSrcweir 		::rtl::OUString sRet;
202*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
203*cdf0e10cSrcweir 		if ( pEntry )
204*cdf0e10cSrcweir 			sRet = getListBox()->SearchEntryText( pEntry );
205*cdf0e10cSrcweir 		return sRet;
206*cdf0e10cSrcweir 	}
207*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
208*cdf0e10cSrcweir 	Locale AccessibleListBoxEntry::implGetLocale()
209*cdf0e10cSrcweir 	{
210*cdf0e10cSrcweir     	Locale aLocale;
211*cdf0e10cSrcweir 		aLocale = Application::GetSettings().GetUILocale();
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir     	return aLocale;
214*cdf0e10cSrcweir 	}
215*cdf0e10cSrcweir 	void AccessibleListBoxEntry::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
216*cdf0e10cSrcweir 	{
217*cdf0e10cSrcweir 		nStartIndex = 0;
218*cdf0e10cSrcweir 		nEndIndex = 0;
219*cdf0e10cSrcweir 	}
220*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
221*cdf0e10cSrcweir 	// XTypeProvider
222*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
223*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
224*cdf0e10cSrcweir 	Sequence< sal_Int8 > AccessibleListBoxEntry::getImplementationId() throw (RuntimeException)
225*cdf0e10cSrcweir 	{
226*cdf0e10cSrcweir 		static ::cppu::OImplementationId* pId = NULL;
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 		if ( !pId )
229*cdf0e10cSrcweir 		{
230*cdf0e10cSrcweir 			::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir 			if ( !pId )
233*cdf0e10cSrcweir 			{
234*cdf0e10cSrcweir 				static ::cppu::OImplementationId aId;
235*cdf0e10cSrcweir 				pId = &aId;
236*cdf0e10cSrcweir 			}
237*cdf0e10cSrcweir 		}
238*cdf0e10cSrcweir 		return pId->getImplementationId();
239*cdf0e10cSrcweir 	}
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
242*cdf0e10cSrcweir 	// XComponent/ListBoxAccessibleBase
243*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
244*cdf0e10cSrcweir 	void SAL_CALL AccessibleListBoxEntry::dispose() throw ( uno::RuntimeException )
245*cdf0e10cSrcweir 	{
246*cdf0e10cSrcweir 		AccessibleListBoxEntry_BASE::dispose();
247*cdf0e10cSrcweir 	}
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
250*cdf0e10cSrcweir 	// XComponent
251*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
252*cdf0e10cSrcweir 	void SAL_CALL AccessibleListBoxEntry::disposing()
253*cdf0e10cSrcweir 	{
254*cdf0e10cSrcweir 		ALBSolarGuard();
255*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir 		Reference< XAccessible > xKeepAlive( this );
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir         // Send a disposing to all listeners.
260*cdf0e10cSrcweir 	    if ( m_nClientId )
261*cdf0e10cSrcweir 	    {
262*cdf0e10cSrcweir 			::comphelper::AccessibleEventNotifier::TClientId nId = m_nClientId;
263*cdf0e10cSrcweir 		    m_nClientId =  0;
264*cdf0e10cSrcweir             ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
265*cdf0e10cSrcweir 	    }
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir 		// clean up
268*cdf0e10cSrcweir 		{
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir 			ListBoxAccessibleBase::disposing();
271*cdf0e10cSrcweir 		}
272*cdf0e10cSrcweir 	    m_aParent = WeakReference< XAccessible >();
273*cdf0e10cSrcweir 	}
274*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
275*cdf0e10cSrcweir 	// XServiceInfo
276*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
277*cdf0e10cSrcweir 	::rtl::OUString SAL_CALL AccessibleListBoxEntry::getImplementationName() throw(RuntimeException)
278*cdf0e10cSrcweir 	{
279*cdf0e10cSrcweir 		return getImplementationName_Static();
280*cdf0e10cSrcweir 	}
281*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
282*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > SAL_CALL AccessibleListBoxEntry::getSupportedServiceNames() throw(RuntimeException)
283*cdf0e10cSrcweir 	{
284*cdf0e10cSrcweir 		return getSupportedServiceNames_Static();
285*cdf0e10cSrcweir 	}
286*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
287*cdf0e10cSrcweir 	sal_Bool SAL_CALL AccessibleListBoxEntry::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
288*cdf0e10cSrcweir 	{
289*cdf0e10cSrcweir 		Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() );
290*cdf0e10cSrcweir 		const ::rtl::OUString* pSupported = aSupported.getConstArray();
291*cdf0e10cSrcweir 		const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
292*cdf0e10cSrcweir 		for ( ; pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported )
293*cdf0e10cSrcweir 			;
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 		return pSupported != pEnd;
296*cdf0e10cSrcweir 	}
297*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
298*cdf0e10cSrcweir 	// XServiceInfo - static methods
299*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
300*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > AccessibleListBoxEntry::getSupportedServiceNames_Static(void) throw( RuntimeException )
301*cdf0e10cSrcweir 	{
302*cdf0e10cSrcweir 		Sequence< ::rtl::OUString > aSupported(3);
303*cdf0e10cSrcweir 		aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext") );
304*cdf0e10cSrcweir 		aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleComponent") );
305*cdf0e10cSrcweir 		aSupported[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleTreeListBoxEntry") );
306*cdf0e10cSrcweir 		return aSupported;
307*cdf0e10cSrcweir 	}
308*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
309*cdf0e10cSrcweir 	::rtl::OUString AccessibleListBoxEntry::getImplementationName_Static(void) throw( RuntimeException )
310*cdf0e10cSrcweir 	{
311*cdf0e10cSrcweir 		return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.svtools.AccessibleTreeListBoxEntry") );
312*cdf0e10cSrcweir 	}
313*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
314*cdf0e10cSrcweir 	// XAccessible
315*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
316*cdf0e10cSrcweir 	Reference< XAccessibleContext > SAL_CALL AccessibleListBoxEntry::getAccessibleContext(  ) throw (RuntimeException)
317*cdf0e10cSrcweir 	{
318*cdf0e10cSrcweir 		EnsureIsAlive();
319*cdf0e10cSrcweir 		return this;
320*cdf0e10cSrcweir 	}
321*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
322*cdf0e10cSrcweir 	// XAccessibleContext
323*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
324*cdf0e10cSrcweir 	sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleChildCount(  ) throw (RuntimeException)
325*cdf0e10cSrcweir 	{
326*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
327*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir 		EnsureIsAlive();
330*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
331*cdf0e10cSrcweir 		sal_Int32 nCount = 0;
332*cdf0e10cSrcweir 		if ( pEntry )
333*cdf0e10cSrcweir 			nCount = getListBox()->GetLevelChildCount( pEntry );
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir 		return nCount;
336*cdf0e10cSrcweir 	}
337*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
338*cdf0e10cSrcweir 	Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException,RuntimeException)
339*cdf0e10cSrcweir 	{
340*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
341*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
342*cdf0e10cSrcweir 		EnsureIsAlive();
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir 		SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
345*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = pParent ? getListBox()->GetEntry( pParent, i ) : NULL;
346*cdf0e10cSrcweir 		if ( !pEntry )
347*cdf0e10cSrcweir 			throw IndexOutOfBoundsException();
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir 		return new AccessibleListBoxEntry( *getListBox(), pEntry, this );
350*cdf0e10cSrcweir 	}
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
353*cdf0e10cSrcweir 	Reference< XAccessible > AccessibleListBoxEntry::implGetParentAccessible( ) const
354*cdf0e10cSrcweir 	{
355*cdf0e10cSrcweir 		Reference< XAccessible > xParent = (Reference< XAccessible >)m_aParent;
356*cdf0e10cSrcweir 		if ( !xParent.is() )
357*cdf0e10cSrcweir 		{
358*cdf0e10cSrcweir 			DBG_ASSERT( m_aEntryPath.size(), "AccessibleListBoxEntry::getAccessibleParent: invalid path!" );
359*cdf0e10cSrcweir 			if ( 1 == m_aEntryPath.size() )
360*cdf0e10cSrcweir 			{	// we're a top level entry
361*cdf0e10cSrcweir 				// -> our parent is the tree listbox itself
362*cdf0e10cSrcweir 				if ( getListBox() )
363*cdf0e10cSrcweir 					xParent = getListBox()->GetAccessible( );
364*cdf0e10cSrcweir 			}
365*cdf0e10cSrcweir 			else
366*cdf0e10cSrcweir 			{	// we have a entry as parent -> get it's accessible
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 				// shorten our access path by one
369*cdf0e10cSrcweir 				::std::deque< sal_Int32 > aParentPath( m_aEntryPath );
370*cdf0e10cSrcweir 				aParentPath.pop_back();
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir 				// get the entry for this shortened access path
373*cdf0e10cSrcweir 				SvLBoxEntry* pParentEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
374*cdf0e10cSrcweir 				DBG_ASSERT( pParentEntry, "AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!" );
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir 				if ( pParentEntry )
377*cdf0e10cSrcweir 					xParent = new AccessibleListBoxEntry( *getListBox(), pParentEntry, NULL );
378*cdf0e10cSrcweir 					// note that we pass NULL here as parent-accessible:
379*cdf0e10cSrcweir 					// this is allowed, as the AccessibleListBoxEntry class will create it's parent
380*cdf0e10cSrcweir 					// when needed
381*cdf0e10cSrcweir 			}
382*cdf0e10cSrcweir 		}
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 		return xParent;
385*cdf0e10cSrcweir 	}
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
388*cdf0e10cSrcweir 	Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleParent(  ) throw (RuntimeException)
389*cdf0e10cSrcweir 	{
390*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
391*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
392*cdf0e10cSrcweir 		EnsureIsAlive();
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir 		return implGetParentAccessible( );
395*cdf0e10cSrcweir 	}
396*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
397*cdf0e10cSrcweir 	sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleIndexInParent(  ) throw (RuntimeException)
398*cdf0e10cSrcweir 	{
399*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir 		DBG_ASSERT( !m_aEntryPath.empty(), "empty path" );
402*cdf0e10cSrcweir     	return m_aEntryPath.empty() ? -1 : m_aEntryPath.back();
403*cdf0e10cSrcweir 	}
404*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
405*cdf0e10cSrcweir 	sal_Int16 SAL_CALL AccessibleListBoxEntry::getAccessibleRole(  ) throw (RuntimeException)
406*cdf0e10cSrcweir 	{
407*cdf0e10cSrcweir 		return AccessibleRole::LABEL;
408*cdf0e10cSrcweir 	}
409*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
410*cdf0e10cSrcweir 	::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription(  ) throw (RuntimeException)
411*cdf0e10cSrcweir 	{
412*cdf0e10cSrcweir 		// no description for every item
413*cdf0e10cSrcweir 		return ::rtl::OUString();
414*cdf0e10cSrcweir 	}
415*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
416*cdf0e10cSrcweir 	::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleName(  ) throw (RuntimeException)
417*cdf0e10cSrcweir 	{
418*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir 		EnsureIsAlive();
421*cdf0e10cSrcweir 		return implGetText();
422*cdf0e10cSrcweir 	}
423*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
424*cdf0e10cSrcweir 	Reference< XAccessibleRelationSet > SAL_CALL AccessibleListBoxEntry::getAccessibleRelationSet(  ) throw (RuntimeException)
425*cdf0e10cSrcweir 	{
426*cdf0e10cSrcweir         Reference< XAccessibleRelationSet > xRelSet;
427*cdf0e10cSrcweir         Reference< XAccessible > xParent;
428*cdf0e10cSrcweir         if ( m_aEntryPath.size() > 1 ) // not a root entry
429*cdf0e10cSrcweir             xParent = implGetParentAccessible();
430*cdf0e10cSrcweir         if ( xParent.is() )
431*cdf0e10cSrcweir         {
432*cdf0e10cSrcweir             utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
433*cdf0e10cSrcweir             Sequence< Reference< XInterface > > aSequence(1);
434*cdf0e10cSrcweir             aSequence[0] = xParent;
435*cdf0e10cSrcweir             pRelationSetHelper->AddRelation(
436*cdf0e10cSrcweir                 AccessibleRelation( AccessibleRelationType::NODE_CHILD_OF, aSequence ) );
437*cdf0e10cSrcweir             xRelSet = pRelationSetHelper;
438*cdf0e10cSrcweir         }
439*cdf0e10cSrcweir         return xRelSet;
440*cdf0e10cSrcweir 	}
441*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
442*cdf0e10cSrcweir 	Reference< XAccessibleStateSet > SAL_CALL AccessibleListBoxEntry::getAccessibleStateSet(  ) throw (RuntimeException)
443*cdf0e10cSrcweir 	{
444*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir     	utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
447*cdf0e10cSrcweir 		Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir 		if ( IsAlive_Impl() )
450*cdf0e10cSrcweir 		{
451*cdf0e10cSrcweir 	       	pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
452*cdf0e10cSrcweir 	       	pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
453*cdf0e10cSrcweir 	       	pStateSetHelper->AddState( AccessibleStateType::ENABLED );
454*cdf0e10cSrcweir             pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
455*cdf0e10cSrcweir 			if ( getListBox()->IsInplaceEditingEnabled() )
456*cdf0e10cSrcweir 		       	pStateSetHelper->AddState( AccessibleStateType::EDITABLE );
457*cdf0e10cSrcweir 			if ( IsShowing_Impl() )
458*cdf0e10cSrcweir 	        	pStateSetHelper->AddState( AccessibleStateType::SHOWING );
459*cdf0e10cSrcweir 			getListBox()->FillAccessibleEntryStateSet(
460*cdf0e10cSrcweir 				getListBox()->GetEntryFromPath( m_aEntryPath ), *pStateSetHelper );
461*cdf0e10cSrcweir 		}
462*cdf0e10cSrcweir 		else
463*cdf0e10cSrcweir         	pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir     	return xStateSet;
466*cdf0e10cSrcweir 	}
467*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
468*cdf0e10cSrcweir 	Locale SAL_CALL AccessibleListBoxEntry::getLocale(  ) throw (IllegalAccessibleComponentStateException, RuntimeException)
469*cdf0e10cSrcweir 	{
470*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
471*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir 		return implGetLocale();
474*cdf0e10cSrcweir 	}
475*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
476*cdf0e10cSrcweir 	// XAccessibleComponent
477*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
478*cdf0e10cSrcweir 	sal_Bool SAL_CALL AccessibleListBoxEntry::containsPoint( const awt::Point& rPoint ) throw (RuntimeException)
479*cdf0e10cSrcweir 	{
480*cdf0e10cSrcweir     	return Rectangle( Point(), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
481*cdf0e10cSrcweir 	}
482*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
483*cdf0e10cSrcweir 	Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleAtPoint( const awt::Point& _aPoint ) throw (RuntimeException)
484*cdf0e10cSrcweir 	{
485*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
486*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir 		EnsureIsAlive();
489*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = getListBox()->GetEntry( VCLPoint( _aPoint ) );
490*cdf0e10cSrcweir 		if ( !pEntry )
491*cdf0e10cSrcweir 			throw RuntimeException();
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir 		Reference< XAccessible > xAcc;
494*cdf0e10cSrcweir 		AccessibleListBoxEntry* pAccEntry = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
495*cdf0e10cSrcweir 		Rectangle aRect = pAccEntry->GetBoundingBox_Impl();
496*cdf0e10cSrcweir 		if ( aRect.IsInside( VCLPoint( _aPoint ) ) )
497*cdf0e10cSrcweir 			xAcc = pAccEntry;
498*cdf0e10cSrcweir 		return xAcc;
499*cdf0e10cSrcweir 	}
500*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
501*cdf0e10cSrcweir 	awt::Rectangle SAL_CALL AccessibleListBoxEntry::getBounds(  ) throw (RuntimeException)
502*cdf0e10cSrcweir 	{
503*cdf0e10cSrcweir     	return AWTRectangle( GetBoundingBox() );
504*cdf0e10cSrcweir 	}
505*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
506*cdf0e10cSrcweir 	awt::Point SAL_CALL AccessibleListBoxEntry::getLocation(  ) throw (RuntimeException)
507*cdf0e10cSrcweir 	{
508*cdf0e10cSrcweir     	return AWTPoint( GetBoundingBox().TopLeft() );
509*cdf0e10cSrcweir 	}
510*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
511*cdf0e10cSrcweir 	awt::Point SAL_CALL AccessibleListBoxEntry::getLocationOnScreen(  ) throw (RuntimeException)
512*cdf0e10cSrcweir 	{
513*cdf0e10cSrcweir     	return AWTPoint( GetBoundingBoxOnScreen().TopLeft() );
514*cdf0e10cSrcweir 	}
515*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
516*cdf0e10cSrcweir 	awt::Size SAL_CALL AccessibleListBoxEntry::getSize(  ) throw (RuntimeException)
517*cdf0e10cSrcweir 	{
518*cdf0e10cSrcweir     	return AWTSize( GetBoundingBox().GetSize() );
519*cdf0e10cSrcweir 	}
520*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
521*cdf0e10cSrcweir 	void SAL_CALL AccessibleListBoxEntry::grabFocus(  ) throw (RuntimeException)
522*cdf0e10cSrcweir 	{
523*cdf0e10cSrcweir 		// do nothing, because no focus for each item
524*cdf0e10cSrcweir 	}
525*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
526*cdf0e10cSrcweir 	sal_Int32 AccessibleListBoxEntry::getForeground(	) throw (RuntimeException)
527*cdf0e10cSrcweir 	{
528*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
529*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
530*cdf0e10cSrcweir 
531*cdf0e10cSrcweir 		sal_Int32 nColor = 0;
532*cdf0e10cSrcweir 		Reference< XAccessible > xParent = getAccessibleParent();
533*cdf0e10cSrcweir 		if ( xParent.is() )
534*cdf0e10cSrcweir 		{
535*cdf0e10cSrcweir 			Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
536*cdf0e10cSrcweir 			if ( xParentComp.is() )
537*cdf0e10cSrcweir 				nColor = xParentComp->getForeground();
538*cdf0e10cSrcweir 		}
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir 		return nColor;
541*cdf0e10cSrcweir 	}
542*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
543*cdf0e10cSrcweir 	sal_Int32 AccessibleListBoxEntry::getBackground(  ) throw (RuntimeException)
544*cdf0e10cSrcweir 	{
545*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
546*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
547*cdf0e10cSrcweir 
548*cdf0e10cSrcweir 		sal_Int32 nColor = 0;
549*cdf0e10cSrcweir 		Reference< XAccessible > xParent = getAccessibleParent();
550*cdf0e10cSrcweir 		if ( xParent.is() )
551*cdf0e10cSrcweir 		{
552*cdf0e10cSrcweir 			Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
553*cdf0e10cSrcweir 			if ( xParentComp.is() )
554*cdf0e10cSrcweir 				nColor = xParentComp->getBackground();
555*cdf0e10cSrcweir 		}
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir 		return nColor;
558*cdf0e10cSrcweir 	}
559*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
560*cdf0e10cSrcweir 	// XAccessibleText
561*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
562*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
563*cdf0e10cSrcweir 	awt::Rectangle SAL_CALL AccessibleListBoxEntry::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
564*cdf0e10cSrcweir 	{
565*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
566*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
567*cdf0e10cSrcweir 
568*cdf0e10cSrcweir 		EnsureIsAlive();
569*cdf0e10cSrcweir 
570*cdf0e10cSrcweir         if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
571*cdf0e10cSrcweir             throw IndexOutOfBoundsException();
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir 		awt::Rectangle aBounds( 0, 0, 0, 0 );
574*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
575*cdf0e10cSrcweir 		if ( pEntry )
576*cdf0e10cSrcweir 		{
577*cdf0e10cSrcweir 			::vcl::ControlLayoutData aLayoutData;
578*cdf0e10cSrcweir 			Rectangle aItemRect = GetBoundingBox();
579*cdf0e10cSrcweir 			getListBox()->RecordLayoutData( &aLayoutData, aItemRect );
580*cdf0e10cSrcweir 			Rectangle aCharRect = aLayoutData.GetCharacterBounds( nIndex );
581*cdf0e10cSrcweir 			aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
582*cdf0e10cSrcweir 			aBounds = AWTRectangle( aCharRect );
583*cdf0e10cSrcweir 		}
584*cdf0e10cSrcweir 
585*cdf0e10cSrcweir 		return aBounds;
586*cdf0e10cSrcweir 	}
587*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
588*cdf0e10cSrcweir 	sal_Int32 SAL_CALL AccessibleListBoxEntry::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
589*cdf0e10cSrcweir 	{
590*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
591*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
592*cdf0e10cSrcweir 		EnsureIsAlive();
593*cdf0e10cSrcweir 
594*cdf0e10cSrcweir 		sal_Int32 nIndex = -1;
595*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
596*cdf0e10cSrcweir 		if ( pEntry )
597*cdf0e10cSrcweir 		{
598*cdf0e10cSrcweir 			::vcl::ControlLayoutData aLayoutData;
599*cdf0e10cSrcweir 			Rectangle aItemRect = GetBoundingBox();
600*cdf0e10cSrcweir 			getListBox()->RecordLayoutData( &aLayoutData, aItemRect );
601*cdf0e10cSrcweir 			Point aPnt( VCLPoint( aPoint ) );
602*cdf0e10cSrcweir 			aPnt += aItemRect.TopLeft();
603*cdf0e10cSrcweir 			nIndex = aLayoutData.GetIndexForPoint( aPnt );
604*cdf0e10cSrcweir 		}
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir 	    return nIndex;
607*cdf0e10cSrcweir 	}
608*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
609*cdf0e10cSrcweir 	sal_Bool SAL_CALL AccessibleListBoxEntry::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
610*cdf0e10cSrcweir 	{
611*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
612*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
613*cdf0e10cSrcweir 		EnsureIsAlive();
614*cdf0e10cSrcweir 
615*cdf0e10cSrcweir 		String sText = getText();
616*cdf0e10cSrcweir 		if	( ( 0 > nStartIndex ) || ( sText.Len() <= nStartIndex )
617*cdf0e10cSrcweir 			|| ( 0 > nEndIndex ) || ( sText.Len() <= nEndIndex ) )
618*cdf0e10cSrcweir 			throw IndexOutOfBoundsException();
619*cdf0e10cSrcweir 
620*cdf0e10cSrcweir 		sal_Int32 nLen = nEndIndex - nStartIndex + 1;
621*cdf0e10cSrcweir         ::svt::OStringTransfer::CopyString( sText.Copy( (sal_uInt16)nStartIndex, (sal_uInt16)nLen ), getListBox() );
622*cdf0e10cSrcweir 
623*cdf0e10cSrcweir 		return sal_True;
624*cdf0e10cSrcweir 	}
625*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
626*cdf0e10cSrcweir 	// XAccessibleEventBroadcaster
627*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
628*cdf0e10cSrcweir 	void SAL_CALL AccessibleListBoxEntry::addEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
629*cdf0e10cSrcweir 	{
630*cdf0e10cSrcweir 	    if (xListener.is())
631*cdf0e10cSrcweir         {
632*cdf0e10cSrcweir 			::osl::MutexGuard aGuard( m_aMutex );
633*cdf0e10cSrcweir 		    if (!m_nClientId)
634*cdf0e10cSrcweir                 m_nClientId = comphelper::AccessibleEventNotifier::registerClient( );
635*cdf0e10cSrcweir 		    comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener );
636*cdf0e10cSrcweir         }
637*cdf0e10cSrcweir 	}
638*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
639*cdf0e10cSrcweir 	void SAL_CALL AccessibleListBoxEntry::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
640*cdf0e10cSrcweir 	{
641*cdf0e10cSrcweir 	    if (xListener.is())
642*cdf0e10cSrcweir 	    {
643*cdf0e10cSrcweir 			::osl::MutexGuard aGuard( m_aMutex );
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir             sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener );
646*cdf0e10cSrcweir 		    if ( !nListenerCount )
647*cdf0e10cSrcweir 		    {
648*cdf0e10cSrcweir 			    // no listeners anymore
649*cdf0e10cSrcweir 			    // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
650*cdf0e10cSrcweir 			    // and at least to us not firing any events anymore, in case somebody calls
651*cdf0e10cSrcweir 			    // NotifyAccessibleEvent, again
652*cdf0e10cSrcweir 				sal_Int32 nId = m_nClientId;
653*cdf0e10cSrcweir 				m_nClientId = 0;
654*cdf0e10cSrcweir 			    comphelper::AccessibleEventNotifier::revokeClient( nId );
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir 		    }
657*cdf0e10cSrcweir 	    }
658*cdf0e10cSrcweir 	}
659*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
660*cdf0e10cSrcweir 	// XAccessibleAction
661*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
662*cdf0e10cSrcweir     sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleActionCount(  ) throw (RuntimeException)
663*cdf0e10cSrcweir 	{
664*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
665*cdf0e10cSrcweir 
666*cdf0e10cSrcweir 		// three actions supported
667*cdf0e10cSrcweir 		return ACCESSIBLE_ACTION_COUNT;
668*cdf0e10cSrcweir 	}
669*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
670*cdf0e10cSrcweir     sal_Bool SAL_CALL AccessibleListBoxEntry::doAccessibleAction( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
671*cdf0e10cSrcweir 	{
672*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
673*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
674*cdf0e10cSrcweir 
675*cdf0e10cSrcweir 		sal_Bool bRet = sal_False;
676*cdf0e10cSrcweir 		checkActionIndex_Impl( nIndex );
677*cdf0e10cSrcweir 		EnsureIsAlive();
678*cdf0e10cSrcweir 
679*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
680*cdf0e10cSrcweir 		if ( pEntry )
681*cdf0e10cSrcweir 		{
682*cdf0e10cSrcweir 			if ( getListBox()->IsExpanded( pEntry ) )
683*cdf0e10cSrcweir 				getListBox()->Collapse( pEntry );
684*cdf0e10cSrcweir 			else
685*cdf0e10cSrcweir 				getListBox()->Expand( pEntry );
686*cdf0e10cSrcweir 			bRet = sal_True;
687*cdf0e10cSrcweir 		}
688*cdf0e10cSrcweir 
689*cdf0e10cSrcweir 		return bRet;
690*cdf0e10cSrcweir 	}
691*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
692*cdf0e10cSrcweir     ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleActionDescription( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
693*cdf0e10cSrcweir 	{
694*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
695*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
696*cdf0e10cSrcweir 
697*cdf0e10cSrcweir 		checkActionIndex_Impl( nIndex );
698*cdf0e10cSrcweir 		EnsureIsAlive();
699*cdf0e10cSrcweir 
700*cdf0e10cSrcweir 		static const ::rtl::OUString sActionDesc( RTL_CONSTASCII_USTRINGPARAM( "toggleExpand" ) );
701*cdf0e10cSrcweir 		return sActionDesc;
702*cdf0e10cSrcweir 	}
703*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
704*cdf0e10cSrcweir 	Reference< XAccessibleKeyBinding > AccessibleListBoxEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
705*cdf0e10cSrcweir 	{
706*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir 		Reference< XAccessibleKeyBinding > xRet;
709*cdf0e10cSrcweir 		checkActionIndex_Impl( nIndex );
710*cdf0e10cSrcweir 		// ... which key?
711*cdf0e10cSrcweir 		return xRet;
712*cdf0e10cSrcweir 	}
713*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
714*cdf0e10cSrcweir 	// XAccessibleSelection
715*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
716*cdf0e10cSrcweir 	void SAL_CALL AccessibleListBoxEntry::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
717*cdf0e10cSrcweir 	{
718*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
719*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
720*cdf0e10cSrcweir 
721*cdf0e10cSrcweir 		EnsureIsAlive();
722*cdf0e10cSrcweir 
723*cdf0e10cSrcweir 		SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
724*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, nChildIndex );
725*cdf0e10cSrcweir 		if ( !pEntry )
726*cdf0e10cSrcweir 			throw IndexOutOfBoundsException();
727*cdf0e10cSrcweir 
728*cdf0e10cSrcweir 		getListBox()->Select( pEntry, sal_True );
729*cdf0e10cSrcweir 	}
730*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
731*cdf0e10cSrcweir 	sal_Bool SAL_CALL AccessibleListBoxEntry::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
732*cdf0e10cSrcweir 	{
733*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
734*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
735*cdf0e10cSrcweir 
736*cdf0e10cSrcweir 		EnsureIsAlive();
737*cdf0e10cSrcweir 
738*cdf0e10cSrcweir 		SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
739*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, nChildIndex );
740*cdf0e10cSrcweir 		if ( !pEntry )
741*cdf0e10cSrcweir 			throw IndexOutOfBoundsException();
742*cdf0e10cSrcweir 
743*cdf0e10cSrcweir 		return getListBox()->IsSelected( pEntry );
744*cdf0e10cSrcweir 	}
745*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
746*cdf0e10cSrcweir 	void SAL_CALL AccessibleListBoxEntry::clearAccessibleSelection(  ) throw (RuntimeException)
747*cdf0e10cSrcweir 	{
748*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
749*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
750*cdf0e10cSrcweir 
751*cdf0e10cSrcweir 		EnsureIsAlive();
752*cdf0e10cSrcweir 
753*cdf0e10cSrcweir 		SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
754*cdf0e10cSrcweir 		if ( !pParent )
755*cdf0e10cSrcweir 			throw RuntimeException();
756*cdf0e10cSrcweir     	sal_Int32 i, nCount = 0;
757*cdf0e10cSrcweir 		nCount = getListBox()->GetLevelChildCount( pParent );
758*cdf0e10cSrcweir 		for ( i = 0; i < nCount; ++i )
759*cdf0e10cSrcweir 		{
760*cdf0e10cSrcweir 			SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, i );
761*cdf0e10cSrcweir 			if ( getListBox()->IsSelected( pEntry ) )
762*cdf0e10cSrcweir 				getListBox()->Select( pEntry, sal_False );
763*cdf0e10cSrcweir 		}
764*cdf0e10cSrcweir 	}
765*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
766*cdf0e10cSrcweir 	void SAL_CALL AccessibleListBoxEntry::selectAllAccessibleChildren(  ) throw (RuntimeException)
767*cdf0e10cSrcweir 	{
768*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
769*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir 		EnsureIsAlive();
772*cdf0e10cSrcweir 
773*cdf0e10cSrcweir 		SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
774*cdf0e10cSrcweir 		if ( !pParent )
775*cdf0e10cSrcweir 			throw RuntimeException();
776*cdf0e10cSrcweir     	sal_Int32 i, nCount = 0;
777*cdf0e10cSrcweir 		nCount = getListBox()->GetLevelChildCount( pParent );
778*cdf0e10cSrcweir 		for ( i = 0; i < nCount; ++i )
779*cdf0e10cSrcweir 		{
780*cdf0e10cSrcweir 			SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, i );
781*cdf0e10cSrcweir 			if ( !getListBox()->IsSelected( pEntry ) )
782*cdf0e10cSrcweir 				getListBox()->Select( pEntry, sal_True );
783*cdf0e10cSrcweir 		}
784*cdf0e10cSrcweir 	}
785*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
786*cdf0e10cSrcweir 	sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectedAccessibleChildCount(  ) throw (RuntimeException)
787*cdf0e10cSrcweir 	{
788*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
789*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir 		EnsureIsAlive();
792*cdf0e10cSrcweir 
793*cdf0e10cSrcweir     	sal_Int32 i, nSelCount = 0, nCount = 0;
794*cdf0e10cSrcweir 
795*cdf0e10cSrcweir 		SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
796*cdf0e10cSrcweir 		if ( !pParent )
797*cdf0e10cSrcweir 			throw RuntimeException();
798*cdf0e10cSrcweir 		nCount = getListBox()->GetLevelChildCount( pParent );
799*cdf0e10cSrcweir 		for ( i = 0; i < nCount; ++i )
800*cdf0e10cSrcweir 		{
801*cdf0e10cSrcweir 			SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, i );
802*cdf0e10cSrcweir 			if ( getListBox()->IsSelected( pEntry ) )
803*cdf0e10cSrcweir 				++nSelCount;
804*cdf0e10cSrcweir 		}
805*cdf0e10cSrcweir 
806*cdf0e10cSrcweir     	return nSelCount;
807*cdf0e10cSrcweir 	}
808*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
809*cdf0e10cSrcweir 	Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
810*cdf0e10cSrcweir 	{
811*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
812*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
813*cdf0e10cSrcweir 
814*cdf0e10cSrcweir 		EnsureIsAlive();
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir 		if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
817*cdf0e10cSrcweir 			throw IndexOutOfBoundsException();
818*cdf0e10cSrcweir 
819*cdf0e10cSrcweir 		Reference< XAccessible > xChild;
820*cdf0e10cSrcweir     	sal_Int32 i, nSelCount = 0, nCount = 0;
821*cdf0e10cSrcweir 
822*cdf0e10cSrcweir 		SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
823*cdf0e10cSrcweir 		if ( !pParent )
824*cdf0e10cSrcweir 			throw RuntimeException();
825*cdf0e10cSrcweir 		nCount = getListBox()->GetLevelChildCount( pParent );
826*cdf0e10cSrcweir 		for ( i = 0; i < nCount; ++i )
827*cdf0e10cSrcweir 		{
828*cdf0e10cSrcweir 			SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, i );
829*cdf0e10cSrcweir 			if ( getListBox()->IsSelected( pEntry ) )
830*cdf0e10cSrcweir 				++nSelCount;
831*cdf0e10cSrcweir 
832*cdf0e10cSrcweir 			if ( nSelCount == ( nSelectedChildIndex + 1 ) )
833*cdf0e10cSrcweir 			{
834*cdf0e10cSrcweir 				xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
835*cdf0e10cSrcweir 				break;
836*cdf0e10cSrcweir 			}
837*cdf0e10cSrcweir 		}
838*cdf0e10cSrcweir 
839*cdf0e10cSrcweir 		return xChild;
840*cdf0e10cSrcweir 	}
841*cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
842*cdf0e10cSrcweir 	void SAL_CALL AccessibleListBoxEntry::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
843*cdf0e10cSrcweir 	{
844*cdf0e10cSrcweir     	ALBSolarGuard aSolarGuard;
845*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
846*cdf0e10cSrcweir 
847*cdf0e10cSrcweir 		EnsureIsAlive();
848*cdf0e10cSrcweir 
849*cdf0e10cSrcweir 		SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
850*cdf0e10cSrcweir 		SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, nSelectedChildIndex );
851*cdf0e10cSrcweir 		if ( !pEntry )
852*cdf0e10cSrcweir 			throw IndexOutOfBoundsException();
853*cdf0e10cSrcweir 
854*cdf0e10cSrcweir 		getListBox()->Select( pEntry, sal_False );
855*cdf0e10cSrcweir 	}
856*cdf0e10cSrcweir 	sal_Int32 SAL_CALL AccessibleListBoxEntry::getCaretPosition(  ) throw (::com::sun::star::uno::RuntimeException)
857*cdf0e10cSrcweir 	{
858*cdf0e10cSrcweir 		return -1;
859*cdf0e10cSrcweir 	}
860*cdf0e10cSrcweir 	sal_Bool SAL_CALL AccessibleListBoxEntry::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
861*cdf0e10cSrcweir 	{
862*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
863*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
864*cdf0e10cSrcweir 		EnsureIsAlive();
865*cdf0e10cSrcweir 
866*cdf0e10cSrcweir 		if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
867*cdf0e10cSrcweir 			throw IndexOutOfBoundsException();
868*cdf0e10cSrcweir 
869*cdf0e10cSrcweir 		return sal_False;
870*cdf0e10cSrcweir 	}
871*cdf0e10cSrcweir 	sal_Unicode SAL_CALL AccessibleListBoxEntry::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
872*cdf0e10cSrcweir 	{
873*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
874*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
875*cdf0e10cSrcweir 		EnsureIsAlive();
876*cdf0e10cSrcweir 		return OCommonAccessibleText::getCharacter( nIndex );
877*cdf0e10cSrcweir 	}
878*cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleListBoxEntry::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
879*cdf0e10cSrcweir 	{
880*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
881*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
882*cdf0e10cSrcweir 		EnsureIsAlive();
883*cdf0e10cSrcweir 
884*cdf0e10cSrcweir 		::rtl::OUString sText( implGetText() );
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir 		if ( !implIsValidIndex( nIndex, sText.getLength() ) )
887*cdf0e10cSrcweir 			throw IndexOutOfBoundsException();
888*cdf0e10cSrcweir 
889*cdf0e10cSrcweir 		return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >();
890*cdf0e10cSrcweir 	}
891*cdf0e10cSrcweir 	sal_Int32 SAL_CALL AccessibleListBoxEntry::getCharacterCount(  ) throw (::com::sun::star::uno::RuntimeException)
892*cdf0e10cSrcweir 	{
893*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
894*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
895*cdf0e10cSrcweir 		EnsureIsAlive();
896*cdf0e10cSrcweir 		return OCommonAccessibleText::getCharacterCount(  );
897*cdf0e10cSrcweir 	}
898*cdf0e10cSrcweir 
899*cdf0e10cSrcweir 	::rtl::OUString SAL_CALL AccessibleListBoxEntry::getSelectedText(  ) throw (::com::sun::star::uno::RuntimeException)
900*cdf0e10cSrcweir 	{
901*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
902*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
903*cdf0e10cSrcweir 		EnsureIsAlive();
904*cdf0e10cSrcweir 		return OCommonAccessibleText::getSelectedText(  );
905*cdf0e10cSrcweir 	}
906*cdf0e10cSrcweir 	sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectionStart(  ) throw (::com::sun::star::uno::RuntimeException)
907*cdf0e10cSrcweir 	{
908*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
909*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
910*cdf0e10cSrcweir 		EnsureIsAlive();
911*cdf0e10cSrcweir 		return OCommonAccessibleText::getSelectionStart(  );
912*cdf0e10cSrcweir 	}
913*cdf0e10cSrcweir 	sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectionEnd(  ) throw (::com::sun::star::uno::RuntimeException)
914*cdf0e10cSrcweir 	{
915*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
916*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
917*cdf0e10cSrcweir 		EnsureIsAlive();
918*cdf0e10cSrcweir 		return OCommonAccessibleText::getSelectionEnd(  );
919*cdf0e10cSrcweir 	}
920*cdf0e10cSrcweir 	sal_Bool SAL_CALL AccessibleListBoxEntry::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
921*cdf0e10cSrcweir 	{
922*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
923*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
924*cdf0e10cSrcweir 		EnsureIsAlive();
925*cdf0e10cSrcweir 
926*cdf0e10cSrcweir 		if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
927*cdf0e10cSrcweir 			throw IndexOutOfBoundsException();
928*cdf0e10cSrcweir 
929*cdf0e10cSrcweir 		return sal_False;
930*cdf0e10cSrcweir 	}
931*cdf0e10cSrcweir 	::rtl::OUString SAL_CALL AccessibleListBoxEntry::getText(  ) throw (::com::sun::star::uno::RuntimeException)
932*cdf0e10cSrcweir 	{
933*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
934*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
935*cdf0e10cSrcweir 		EnsureIsAlive();
936*cdf0e10cSrcweir 		return OCommonAccessibleText::getText(  );
937*cdf0e10cSrcweir 	}
938*cdf0e10cSrcweir 	::rtl::OUString SAL_CALL AccessibleListBoxEntry::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
939*cdf0e10cSrcweir 	{
940*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
941*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
942*cdf0e10cSrcweir 		EnsureIsAlive();
943*cdf0e10cSrcweir 		return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
944*cdf0e10cSrcweir 	}
945*cdf0e10cSrcweir     ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
946*cdf0e10cSrcweir 	{
947*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
948*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
949*cdf0e10cSrcweir 		EnsureIsAlive();
950*cdf0e10cSrcweir 		return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType);
951*cdf0e10cSrcweir 	}
952*cdf0e10cSrcweir     ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
953*cdf0e10cSrcweir 	{
954*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
955*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
956*cdf0e10cSrcweir 		EnsureIsAlive();
957*cdf0e10cSrcweir 		return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType);
958*cdf0e10cSrcweir 	}
959*cdf0e10cSrcweir     ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
960*cdf0e10cSrcweir 	{
961*cdf0e10cSrcweir 		ALBSolarGuard aSolarGuard;
962*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
963*cdf0e10cSrcweir 		EnsureIsAlive();
964*cdf0e10cSrcweir 
965*cdf0e10cSrcweir 		return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType);
966*cdf0e10cSrcweir 	}
967*cdf0e10cSrcweir //........................................................................
968*cdf0e10cSrcweir }// namespace accessibility
969*cdf0e10cSrcweir //........................................................................
970*cdf0e10cSrcweir 
971