xref: /AOO41X/main/accessibility/source/standard/vclxaccessiblelistitem.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/standard/vclxaccessiblelistitem.hxx>
31*cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
32*cdf0e10cSrcweir #include <accessibility/helper/listboxhelper.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 
37*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
42*cdf0e10cSrcweir #include <tools/debug.hxx>
43*cdf0e10cSrcweir #include <vcl/svapp.hxx>
44*cdf0e10cSrcweir #include <vcl/controllayout.hxx>
45*cdf0e10cSrcweir #include <vcl/unohelp2.hxx>
46*cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
47*cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
48*cdf0e10cSrcweir #include <unotools/accessiblerelationsethelper.hxx>
49*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
50*cdf0e10cSrcweir #include <comphelper/sequence.hxx>
51*cdf0e10cSrcweir #include <comphelper/accessibleeventnotifier.hxx>
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir namespace
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir 	void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException)
56*cdf0e10cSrcweir 	{
57*cdf0e10cSrcweir 		if ( _nIndex < 0 || _nIndex > _sText.getLength() )
58*cdf0e10cSrcweir 			throw ::com::sun::star::lang::IndexOutOfBoundsException();
59*cdf0e10cSrcweir 	}
60*cdf0e10cSrcweir }
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir // class VCLXAccessibleListItem ------------------------------------------
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
65*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
66*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
67*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
68*cdf0e10cSrcweir using namespace ::com::sun::star;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir DBG_NAME(VCLXAccessibleListItem)
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir // -----------------------------------------------------------------------------
73*cdf0e10cSrcweir // Ctor() and Dtor()
74*cdf0e10cSrcweir // -----------------------------------------------------------------------------
75*cdf0e10cSrcweir VCLXAccessibleListItem::VCLXAccessibleListItem( ::accessibility::IComboListBoxHelper* _pListBoxHelper, sal_Int32 _nIndexInParent, const Reference< XAccessible >& _xParent ) :
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir 	VCLXAccessibleListItem_BASE	( m_aMutex ),
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 	m_nIndexInParent( _nIndexInParent ),
80*cdf0e10cSrcweir 	m_bSelected		( sal_False ),
81*cdf0e10cSrcweir 	m_bVisible		( sal_False ),
82*cdf0e10cSrcweir     m_nClientId     ( 0 ),
83*cdf0e10cSrcweir 	m_pListBoxHelper( _pListBoxHelper ),
84*cdf0e10cSrcweir 	m_xParent		( _xParent )
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir {
87*cdf0e10cSrcweir 	DBG_CTOR( VCLXAccessibleListItem, NULL );
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 	if ( m_xParent.is() )
90*cdf0e10cSrcweir 		m_xParentContext = m_xParent->getAccessibleContext();
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 	if ( m_pListBoxHelper )
93*cdf0e10cSrcweir 		m_sEntryText = m_pListBoxHelper->GetEntry( (sal_uInt16)_nIndexInParent );
94*cdf0e10cSrcweir }
95*cdf0e10cSrcweir // -----------------------------------------------------------------------------
96*cdf0e10cSrcweir VCLXAccessibleListItem::~VCLXAccessibleListItem()
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir 	DBG_DTOR( VCLXAccessibleListItem, NULL );
99*cdf0e10cSrcweir }
100*cdf0e10cSrcweir // -----------------------------------------------------------------------------
101*cdf0e10cSrcweir void VCLXAccessibleListItem::SetSelected( sal_Bool _bSelected )
102*cdf0e10cSrcweir {
103*cdf0e10cSrcweir 	if ( m_bSelected != _bSelected )
104*cdf0e10cSrcweir 	{
105*cdf0e10cSrcweir 		Any aOldValue;
106*cdf0e10cSrcweir 		Any aNewValue;
107*cdf0e10cSrcweir 		if ( m_bSelected )
108*cdf0e10cSrcweir 			aOldValue <<= AccessibleStateType::SELECTED;
109*cdf0e10cSrcweir 		else
110*cdf0e10cSrcweir 			aNewValue <<= AccessibleStateType::SELECTED;
111*cdf0e10cSrcweir 		m_bSelected = _bSelected;
112*cdf0e10cSrcweir         NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
113*cdf0e10cSrcweir 	}
114*cdf0e10cSrcweir }
115*cdf0e10cSrcweir // -----------------------------------------------------------------------------
116*cdf0e10cSrcweir void VCLXAccessibleListItem::SetVisible( sal_Bool _bVisible )
117*cdf0e10cSrcweir {
118*cdf0e10cSrcweir 	if ( m_bVisible != _bVisible )
119*cdf0e10cSrcweir 	{
120*cdf0e10cSrcweir 		Any aOldValue, aNewValue;
121*cdf0e10cSrcweir 		m_bVisible = _bVisible;
122*cdf0e10cSrcweir 		(_bVisible ? aNewValue : aOldValue ) <<= AccessibleStateType::VISIBLE;
123*cdf0e10cSrcweir 		NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
124*cdf0e10cSrcweir 		(_bVisible ? aNewValue : aOldValue ) <<= AccessibleStateType::SHOWING;
125*cdf0e10cSrcweir 		NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
126*cdf0e10cSrcweir 	}
127*cdf0e10cSrcweir }
128*cdf0e10cSrcweir // -----------------------------------------------------------------------------
129*cdf0e10cSrcweir void VCLXAccessibleListItem::NotifyAccessibleEvent( sal_Int16 _nEventId,
130*cdf0e10cSrcweir 													const ::com::sun::star::uno::Any& _aOldValue,
131*cdf0e10cSrcweir 													const ::com::sun::star::uno::Any& _aNewValue )
132*cdf0e10cSrcweir {
133*cdf0e10cSrcweir 	AccessibleEventObject aEvt;
134*cdf0e10cSrcweir 	aEvt.Source = *this;
135*cdf0e10cSrcweir 	aEvt.EventId = _nEventId;
136*cdf0e10cSrcweir     aEvt.OldValue = _aOldValue;
137*cdf0e10cSrcweir     aEvt.NewValue = _aNewValue;
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 	if (m_nClientId)
140*cdf0e10cSrcweir 		comphelper::AccessibleEventNotifier::addEvent( m_nClientId, aEvt );
141*cdf0e10cSrcweir }
142*cdf0e10cSrcweir // -----------------------------------------------------------------------------
143*cdf0e10cSrcweir // OCommonAccessibleText
144*cdf0e10cSrcweir // -----------------------------------------------------------------------------
145*cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleListItem::implGetText()
146*cdf0e10cSrcweir {
147*cdf0e10cSrcweir 	return m_sEntryText;
148*cdf0e10cSrcweir }
149*cdf0e10cSrcweir // -----------------------------------------------------------------------------
150*cdf0e10cSrcweir Locale VCLXAccessibleListItem::implGetLocale()
151*cdf0e10cSrcweir {
152*cdf0e10cSrcweir 	return Application::GetSettings().GetLocale();
153*cdf0e10cSrcweir }
154*cdf0e10cSrcweir // -----------------------------------------------------------------------------
155*cdf0e10cSrcweir void VCLXAccessibleListItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
156*cdf0e10cSrcweir {
157*cdf0e10cSrcweir 	nStartIndex = 0;
158*cdf0e10cSrcweir 	nEndIndex = 0;
159*cdf0e10cSrcweir }
160*cdf0e10cSrcweir // -----------------------------------------------------------------------------
161*cdf0e10cSrcweir // XInterface
162*cdf0e10cSrcweir // -----------------------------------------------------------------------------
163*cdf0e10cSrcweir Any SAL_CALL VCLXAccessibleListItem::queryInterface( Type const & rType ) throw (RuntimeException)
164*cdf0e10cSrcweir {
165*cdf0e10cSrcweir 	return VCLXAccessibleListItem_BASE::queryInterface( rType );
166*cdf0e10cSrcweir }
167*cdf0e10cSrcweir // -----------------------------------------------------------------------------
168*cdf0e10cSrcweir void SAL_CALL VCLXAccessibleListItem::acquire() throw ()
169*cdf0e10cSrcweir {
170*cdf0e10cSrcweir 	VCLXAccessibleListItem_BASE::acquire();
171*cdf0e10cSrcweir }
172*cdf0e10cSrcweir // -----------------------------------------------------------------------------
173*cdf0e10cSrcweir void SAL_CALL VCLXAccessibleListItem::release() throw ()
174*cdf0e10cSrcweir {
175*cdf0e10cSrcweir 	VCLXAccessibleListItem_BASE::release();
176*cdf0e10cSrcweir }
177*cdf0e10cSrcweir // -----------------------------------------------------------------------------
178*cdf0e10cSrcweir // XTypeProvider
179*cdf0e10cSrcweir // -----------------------------------------------------------------------------
180*cdf0e10cSrcweir Sequence< Type > SAL_CALL VCLXAccessibleListItem::getTypes(  ) throw (RuntimeException)
181*cdf0e10cSrcweir {
182*cdf0e10cSrcweir 	return VCLXAccessibleListItem_BASE::getTypes();
183*cdf0e10cSrcweir }
184*cdf0e10cSrcweir // -----------------------------------------------------------------------------
185*cdf0e10cSrcweir Sequence< sal_Int8 > VCLXAccessibleListItem::getImplementationId() throw (RuntimeException)
186*cdf0e10cSrcweir {
187*cdf0e10cSrcweir 	static ::cppu::OImplementationId* pId = NULL;
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir 	if ( !pId )
190*cdf0e10cSrcweir 	{
191*cdf0e10cSrcweir 		::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 		if ( !pId )
194*cdf0e10cSrcweir 		{
195*cdf0e10cSrcweir 			static ::cppu::OImplementationId aId;
196*cdf0e10cSrcweir 			pId = &aId;
197*cdf0e10cSrcweir 		}
198*cdf0e10cSrcweir 	}
199*cdf0e10cSrcweir 	return pId->getImplementationId();
200*cdf0e10cSrcweir }
201*cdf0e10cSrcweir // -----------------------------------------------------------------------------
202*cdf0e10cSrcweir // XComponent
203*cdf0e10cSrcweir // -----------------------------------------------------------------------------
204*cdf0e10cSrcweir void SAL_CALL VCLXAccessibleListItem::disposing()
205*cdf0e10cSrcweir {
206*cdf0e10cSrcweir 	comphelper::AccessibleEventNotifier::TClientId nId( 0 );
207*cdf0e10cSrcweir 	Reference< XInterface > xEventSource;
208*cdf0e10cSrcweir 	{
209*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 		VCLXAccessibleListItem_BASE::disposing();
212*cdf0e10cSrcweir 		m_sEntryText		= ::rtl::OUString();
213*cdf0e10cSrcweir 		m_pListBoxHelper	= NULL;
214*cdf0e10cSrcweir 		m_xParent			= NULL;
215*cdf0e10cSrcweir 		m_xParentContext	= NULL;
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir 		nId = m_nClientId;
218*cdf0e10cSrcweir 		m_nClientId =  0;
219*cdf0e10cSrcweir 		if ( nId )
220*cdf0e10cSrcweir 			xEventSource = *this;
221*cdf0e10cSrcweir 	}
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir     // Send a disposing to all listeners.
224*cdf0e10cSrcweir 	if ( nId )
225*cdf0e10cSrcweir         	comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
226*cdf0e10cSrcweir }
227*cdf0e10cSrcweir // -----------------------------------------------------------------------------
228*cdf0e10cSrcweir // XServiceInfo
229*cdf0e10cSrcweir // -----------------------------------------------------------------------------
230*cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleListItem::getImplementationName() throw (RuntimeException)
231*cdf0e10cSrcweir {
232*cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleListItem" );
233*cdf0e10cSrcweir }
234*cdf0e10cSrcweir // -----------------------------------------------------------------------------
235*cdf0e10cSrcweir sal_Bool VCLXAccessibleListItem::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
236*cdf0e10cSrcweir {
237*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
238*cdf0e10cSrcweir 	const ::rtl::OUString* pNames = aNames.getConstArray();
239*cdf0e10cSrcweir 	const ::rtl::OUString* pEnd = pNames + aNames.getLength();
240*cdf0e10cSrcweir 	for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
241*cdf0e10cSrcweir 		;
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 	return pNames != pEnd;
244*cdf0e10cSrcweir }
245*cdf0e10cSrcweir // -----------------------------------------------------------------------------
246*cdf0e10cSrcweir Sequence< ::rtl::OUString > VCLXAccessibleListItem::getSupportedServiceNames() throw (RuntimeException)
247*cdf0e10cSrcweir {
248*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aNames(3);
249*cdf0e10cSrcweir 	aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.accessibility.AccessibleContext" );
250*cdf0e10cSrcweir 	aNames[1] = ::rtl::OUString::createFromAscii( "com.sun.star.accessibility.AccessibleComponent" );
251*cdf0e10cSrcweir 	aNames[2] = ::rtl::OUString::createFromAscii( "com.sun.star.accessibility.AccessibleListItem" );
252*cdf0e10cSrcweir 	return aNames;
253*cdf0e10cSrcweir }
254*cdf0e10cSrcweir // -----------------------------------------------------------------------------
255*cdf0e10cSrcweir // XAccessible
256*cdf0e10cSrcweir // -----------------------------------------------------------------------------
257*cdf0e10cSrcweir Reference< XAccessibleContext > SAL_CALL VCLXAccessibleListItem::getAccessibleContext(  ) throw (RuntimeException)
258*cdf0e10cSrcweir {
259*cdf0e10cSrcweir 	return this;
260*cdf0e10cSrcweir }
261*cdf0e10cSrcweir // -----------------------------------------------------------------------------
262*cdf0e10cSrcweir // XAccessibleContext
263*cdf0e10cSrcweir // -----------------------------------------------------------------------------
264*cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleListItem::getAccessibleChildCount(  ) throw (RuntimeException)
265*cdf0e10cSrcweir {
266*cdf0e10cSrcweir 	return 0;
267*cdf0e10cSrcweir }
268*cdf0e10cSrcweir // -----------------------------------------------------------------------------
269*cdf0e10cSrcweir Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleChild( sal_Int32 ) throw (RuntimeException)
270*cdf0e10cSrcweir {
271*cdf0e10cSrcweir 	return Reference< XAccessible >();
272*cdf0e10cSrcweir }
273*cdf0e10cSrcweir // -----------------------------------------------------------------------------
274*cdf0e10cSrcweir Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleParent(  ) throw (RuntimeException)
275*cdf0e10cSrcweir {
276*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir 	return m_xParent;
279*cdf0e10cSrcweir }
280*cdf0e10cSrcweir // -----------------------------------------------------------------------------
281*cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleListItem::getAccessibleIndexInParent(  ) throw (RuntimeException)
282*cdf0e10cSrcweir {
283*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
284*cdf0e10cSrcweir 	return m_nIndexInParent;
285*cdf0e10cSrcweir }
286*cdf0e10cSrcweir // -----------------------------------------------------------------------------
287*cdf0e10cSrcweir sal_Int16 SAL_CALL VCLXAccessibleListItem::getAccessibleRole(  ) throw (RuntimeException)
288*cdf0e10cSrcweir {
289*cdf0e10cSrcweir 	return AccessibleRole::LIST_ITEM;
290*cdf0e10cSrcweir     //	return AccessibleRole::LABEL;
291*cdf0e10cSrcweir }
292*cdf0e10cSrcweir // -----------------------------------------------------------------------------
293*cdf0e10cSrcweir ::rtl::OUString SAL_CALL VCLXAccessibleListItem::getAccessibleDescription(  ) throw (RuntimeException)
294*cdf0e10cSrcweir {
295*cdf0e10cSrcweir 	// no description for every item
296*cdf0e10cSrcweir 	return ::rtl::OUString();
297*cdf0e10cSrcweir }
298*cdf0e10cSrcweir // -----------------------------------------------------------------------------
299*cdf0e10cSrcweir ::rtl::OUString SAL_CALL VCLXAccessibleListItem::getAccessibleName(  ) throw (RuntimeException)
300*cdf0e10cSrcweir {
301*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 	// entry text == accessible name
304*cdf0e10cSrcweir 	return implGetText();
305*cdf0e10cSrcweir }
306*cdf0e10cSrcweir // -----------------------------------------------------------------------------
307*cdf0e10cSrcweir Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleListItem::getAccessibleRelationSet(  ) throw (RuntimeException)
308*cdf0e10cSrcweir {
309*cdf0e10cSrcweir     utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
310*cdf0e10cSrcweir 	Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
311*cdf0e10cSrcweir     return xSet;
312*cdf0e10cSrcweir }
313*cdf0e10cSrcweir // -----------------------------------------------------------------------------
314*cdf0e10cSrcweir Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleListItem::getAccessibleStateSet(  ) throw (RuntimeException)
315*cdf0e10cSrcweir {
316*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir     utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
319*cdf0e10cSrcweir 	Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 	if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
322*cdf0e10cSrcweir 	{
323*cdf0e10cSrcweir         pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
324*cdf0e10cSrcweir         pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
325*cdf0e10cSrcweir         pStateSetHelper->AddState( AccessibleStateType::ENABLED );
326*cdf0e10cSrcweir         pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
327*cdf0e10cSrcweir         if ( m_bSelected )
328*cdf0e10cSrcweir 			pStateSetHelper->AddState( AccessibleStateType::SELECTED );
329*cdf0e10cSrcweir 		if ( m_bVisible )
330*cdf0e10cSrcweir 		{
331*cdf0e10cSrcweir 			pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
332*cdf0e10cSrcweir 			pStateSetHelper->AddState( AccessibleStateType::SHOWING );
333*cdf0e10cSrcweir 		}
334*cdf0e10cSrcweir 	}
335*cdf0e10cSrcweir 	else
336*cdf0e10cSrcweir         pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir     return xStateSet;
339*cdf0e10cSrcweir }
340*cdf0e10cSrcweir // -----------------------------------------------------------------------------
341*cdf0e10cSrcweir Locale SAL_CALL VCLXAccessibleListItem::getLocale(  ) throw (IllegalAccessibleComponentStateException, RuntimeException)
342*cdf0e10cSrcweir {
343*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
344*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir     return implGetLocale();
347*cdf0e10cSrcweir }
348*cdf0e10cSrcweir // -----------------------------------------------------------------------------
349*cdf0e10cSrcweir // XAccessibleComponent
350*cdf0e10cSrcweir // -----------------------------------------------------------------------------
351*cdf0e10cSrcweir sal_Bool SAL_CALL VCLXAccessibleListItem::containsPoint( const awt::Point& _aPoint ) throw (RuntimeException)
352*cdf0e10cSrcweir {
353*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
354*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir 	sal_Bool bInside = sal_False;
357*cdf0e10cSrcweir 	if ( m_pListBoxHelper )
358*cdf0e10cSrcweir 	{
359*cdf0e10cSrcweir 		Rectangle aRect( m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ) );
360*cdf0e10cSrcweir 		aRect.Move(-aRect.TopLeft().X(),-aRect.TopLeft().Y());
361*cdf0e10cSrcweir 		bInside = aRect.IsInside( VCLPoint( _aPoint ) );
362*cdf0e10cSrcweir 	}
363*cdf0e10cSrcweir 	return bInside;
364*cdf0e10cSrcweir }
365*cdf0e10cSrcweir // -----------------------------------------------------------------------------
366*cdf0e10cSrcweir Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
367*cdf0e10cSrcweir {
368*cdf0e10cSrcweir 	return Reference< XAccessible >();
369*cdf0e10cSrcweir }
370*cdf0e10cSrcweir // -----------------------------------------------------------------------------
371*cdf0e10cSrcweir awt::Rectangle SAL_CALL VCLXAccessibleListItem::getBounds(  ) throw (RuntimeException)
372*cdf0e10cSrcweir {
373*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
374*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir 	awt::Rectangle aRect;
377*cdf0e10cSrcweir 	if ( m_pListBoxHelper )
378*cdf0e10cSrcweir 		aRect = AWTRectangle( m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ) );
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir 	return aRect;
381*cdf0e10cSrcweir }
382*cdf0e10cSrcweir // -----------------------------------------------------------------------------
383*cdf0e10cSrcweir awt::Point SAL_CALL VCLXAccessibleListItem::getLocation(  ) throw (RuntimeException)
384*cdf0e10cSrcweir {
385*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
386*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir 	Point aPoint(0,0);
389*cdf0e10cSrcweir 	if ( m_pListBoxHelper )
390*cdf0e10cSrcweir 	{
391*cdf0e10cSrcweir 		Rectangle aRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent );
392*cdf0e10cSrcweir 		aPoint = aRect.TopLeft();
393*cdf0e10cSrcweir 	}
394*cdf0e10cSrcweir 	return AWTPoint( aPoint );
395*cdf0e10cSrcweir }
396*cdf0e10cSrcweir // -----------------------------------------------------------------------------
397*cdf0e10cSrcweir awt::Point SAL_CALL VCLXAccessibleListItem::getLocationOnScreen(  ) throw (RuntimeException)
398*cdf0e10cSrcweir {
399*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
400*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir 	Point aPoint(0,0);
403*cdf0e10cSrcweir 	if ( m_pListBoxHelper )
404*cdf0e10cSrcweir 	{
405*cdf0e10cSrcweir 		Rectangle aRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent );
406*cdf0e10cSrcweir 		aPoint = aRect.TopLeft();
407*cdf0e10cSrcweir 		aPoint += m_pListBoxHelper->GetWindowExtentsRelative( NULL ).TopLeft();
408*cdf0e10cSrcweir 	}
409*cdf0e10cSrcweir 	return AWTPoint( aPoint );
410*cdf0e10cSrcweir }
411*cdf0e10cSrcweir // -----------------------------------------------------------------------------
412*cdf0e10cSrcweir awt::Size SAL_CALL VCLXAccessibleListItem::getSize(  ) throw (RuntimeException)
413*cdf0e10cSrcweir {
414*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
415*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir 	Size aSize;
418*cdf0e10cSrcweir 	if ( m_pListBoxHelper )
419*cdf0e10cSrcweir 		aSize = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ).GetSize();
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir 	return AWTSize( aSize );
422*cdf0e10cSrcweir }
423*cdf0e10cSrcweir // -----------------------------------------------------------------------------
424*cdf0e10cSrcweir void SAL_CALL VCLXAccessibleListItem::grabFocus(  ) throw (RuntimeException)
425*cdf0e10cSrcweir {
426*cdf0e10cSrcweir 	// no focus for each item
427*cdf0e10cSrcweir }
428*cdf0e10cSrcweir // -----------------------------------------------------------------------------
429*cdf0e10cSrcweir // XAccessibleText
430*cdf0e10cSrcweir // -----------------------------------------------------------------------------
431*cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleListItem::getCaretPosition() throw (RuntimeException)
432*cdf0e10cSrcweir {
433*cdf0e10cSrcweir 	return -1;
434*cdf0e10cSrcweir }
435*cdf0e10cSrcweir // -----------------------------------------------------------------------------
436*cdf0e10cSrcweir sal_Bool SAL_CALL VCLXAccessibleListItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
437*cdf0e10cSrcweir {
438*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
439*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir     if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
442*cdf0e10cSrcweir         throw IndexOutOfBoundsException();
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir 	return sal_False;
445*cdf0e10cSrcweir }
446*cdf0e10cSrcweir // -----------------------------------------------------------------------------
447*cdf0e10cSrcweir sal_Unicode SAL_CALL VCLXAccessibleListItem::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
448*cdf0e10cSrcweir {
449*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
450*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
451*cdf0e10cSrcweir 
452*cdf0e10cSrcweir 	return OCommonAccessibleText::getCharacter( nIndex );
453*cdf0e10cSrcweir }
454*cdf0e10cSrcweir // -----------------------------------------------------------------------------
455*cdf0e10cSrcweir Sequence< PropertyValue > SAL_CALL VCLXAccessibleListItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& ) throw (IndexOutOfBoundsException, RuntimeException)
456*cdf0e10cSrcweir {
457*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
458*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir 	::rtl::OUString sText( implGetText() );
461*cdf0e10cSrcweir     if ( !implIsValidIndex( nIndex, sText.getLength() ) )
462*cdf0e10cSrcweir         throw IndexOutOfBoundsException();
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir 	return Sequence< PropertyValue >();
465*cdf0e10cSrcweir }
466*cdf0e10cSrcweir // -----------------------------------------------------------------------------
467*cdf0e10cSrcweir awt::Rectangle SAL_CALL VCLXAccessibleListItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
468*cdf0e10cSrcweir {
469*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
470*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir 	::rtl::OUString sText( implGetText() );
473*cdf0e10cSrcweir     if ( !implIsValidIndex( nIndex, sText.getLength() ) )
474*cdf0e10cSrcweir         throw IndexOutOfBoundsException();
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir 	awt::Rectangle aBounds( 0, 0, 0, 0 );
477*cdf0e10cSrcweir 	if ( m_pListBoxHelper )
478*cdf0e10cSrcweir 	{
479*cdf0e10cSrcweir 		Rectangle aCharRect = m_pListBoxHelper->GetEntryCharacterBounds( m_nIndexInParent, nIndex );
480*cdf0e10cSrcweir 		Rectangle aItemRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent );
481*cdf0e10cSrcweir 		aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
482*cdf0e10cSrcweir 		aBounds = AWTRectangle( aCharRect );
483*cdf0e10cSrcweir 	}
484*cdf0e10cSrcweir 
485*cdf0e10cSrcweir 	return aBounds;
486*cdf0e10cSrcweir }
487*cdf0e10cSrcweir // -----------------------------------------------------------------------------
488*cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleListItem::getCharacterCount() throw (RuntimeException)
489*cdf0e10cSrcweir {
490*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
491*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir 	return OCommonAccessibleText::getCharacterCount();
494*cdf0e10cSrcweir }
495*cdf0e10cSrcweir // -----------------------------------------------------------------------------
496*cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleListItem::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
497*cdf0e10cSrcweir {
498*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
499*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
500*cdf0e10cSrcweir 
501*cdf0e10cSrcweir 	sal_Int32 nIndex = -1;
502*cdf0e10cSrcweir 	if ( m_pListBoxHelper )
503*cdf0e10cSrcweir 	{
504*cdf0e10cSrcweir         sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND;
505*cdf0e10cSrcweir         Rectangle aItemRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent );
506*cdf0e10cSrcweir 		Point aPnt( VCLPoint( aPoint ) );
507*cdf0e10cSrcweir 		aPnt += aItemRect.TopLeft();
508*cdf0e10cSrcweir         sal_Int32 nI = m_pListBoxHelper->GetIndexForPoint( aPnt, nPos );
509*cdf0e10cSrcweir         if ( nI != -1 && (sal_uInt16)m_nIndexInParent == nPos )
510*cdf0e10cSrcweir             nIndex = nI;
511*cdf0e10cSrcweir 	}
512*cdf0e10cSrcweir     return nIndex;
513*cdf0e10cSrcweir }
514*cdf0e10cSrcweir // -----------------------------------------------------------------------------
515*cdf0e10cSrcweir ::rtl::OUString SAL_CALL VCLXAccessibleListItem::getSelectedText() throw (RuntimeException)
516*cdf0e10cSrcweir {
517*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
518*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir 	return OCommonAccessibleText::getSelectedText();
521*cdf0e10cSrcweir }
522*cdf0e10cSrcweir // -----------------------------------------------------------------------------
523*cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleListItem::getSelectionStart() throw (RuntimeException)
524*cdf0e10cSrcweir {
525*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
526*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir 	return OCommonAccessibleText::getSelectionStart();
529*cdf0e10cSrcweir }
530*cdf0e10cSrcweir // -----------------------------------------------------------------------------
531*cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleListItem::getSelectionEnd() throw (RuntimeException)
532*cdf0e10cSrcweir {
533*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
534*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
535*cdf0e10cSrcweir 
536*cdf0e10cSrcweir 	return OCommonAccessibleText::getSelectionEnd();
537*cdf0e10cSrcweir }
538*cdf0e10cSrcweir // -----------------------------------------------------------------------------
539*cdf0e10cSrcweir sal_Bool SAL_CALL VCLXAccessibleListItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
540*cdf0e10cSrcweir {
541*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
542*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
543*cdf0e10cSrcweir 
544*cdf0e10cSrcweir     if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
545*cdf0e10cSrcweir         throw IndexOutOfBoundsException();
546*cdf0e10cSrcweir 
547*cdf0e10cSrcweir 	return sal_False;
548*cdf0e10cSrcweir }
549*cdf0e10cSrcweir // -----------------------------------------------------------------------------
550*cdf0e10cSrcweir ::rtl::OUString SAL_CALL VCLXAccessibleListItem::getText() throw (RuntimeException)
551*cdf0e10cSrcweir {
552*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
553*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
554*cdf0e10cSrcweir 
555*cdf0e10cSrcweir 	return OCommonAccessibleText::getText();
556*cdf0e10cSrcweir }
557*cdf0e10cSrcweir // -----------------------------------------------------------------------------
558*cdf0e10cSrcweir ::rtl::OUString SAL_CALL VCLXAccessibleListItem::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
559*cdf0e10cSrcweir {
560*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
561*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir 	return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
564*cdf0e10cSrcweir }
565*cdf0e10cSrcweir // -----------------------------------------------------------------------------
566*cdf0e10cSrcweir ::com::sun::star::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
567*cdf0e10cSrcweir {
568*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
569*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
570*cdf0e10cSrcweir 
571*cdf0e10cSrcweir 	return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
572*cdf0e10cSrcweir }
573*cdf0e10cSrcweir // -----------------------------------------------------------------------------
574*cdf0e10cSrcweir ::com::sun::star::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
575*cdf0e10cSrcweir {
576*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
577*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
578*cdf0e10cSrcweir 
579*cdf0e10cSrcweir 	return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
580*cdf0e10cSrcweir }
581*cdf0e10cSrcweir // -----------------------------------------------------------------------------
582*cdf0e10cSrcweir ::com::sun::star::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
583*cdf0e10cSrcweir {
584*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
585*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir 	return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
588*cdf0e10cSrcweir }
589*cdf0e10cSrcweir // -----------------------------------------------------------------------------
590*cdf0e10cSrcweir sal_Bool SAL_CALL VCLXAccessibleListItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
591*cdf0e10cSrcweir {
592*cdf0e10cSrcweir 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
593*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir 	checkIndex_Impl( nStartIndex, m_sEntryText );
596*cdf0e10cSrcweir 	checkIndex_Impl( nEndIndex, m_sEntryText );
597*cdf0e10cSrcweir 
598*cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
599*cdf0e10cSrcweir 	if ( m_pListBoxHelper )
600*cdf0e10cSrcweir 	{
601*cdf0e10cSrcweir 		Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pListBoxHelper->GetClipboard();
602*cdf0e10cSrcweir 		if ( xClipboard.is() )
603*cdf0e10cSrcweir 		{
604*cdf0e10cSrcweir 			::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) );
605*cdf0e10cSrcweir 			::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir 			const sal_uInt32 nRef = Application::ReleaseSolarMutex();
608*cdf0e10cSrcweir 			xClipboard->setContents( pDataObj, NULL );
609*cdf0e10cSrcweir 			Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
610*cdf0e10cSrcweir 			if( xFlushableClipboard.is() )
611*cdf0e10cSrcweir 				xFlushableClipboard->flushClipboard();
612*cdf0e10cSrcweir 			Application::AcquireSolarMutex( nRef );
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir 			bRet = sal_True;
615*cdf0e10cSrcweir 		}
616*cdf0e10cSrcweir 	}
617*cdf0e10cSrcweir 
618*cdf0e10cSrcweir     return bRet;
619*cdf0e10cSrcweir }
620*cdf0e10cSrcweir // -----------------------------------------------------------------------------
621*cdf0e10cSrcweir // XAccessibleEventBroadcaster
622*cdf0e10cSrcweir // -----------------------------------------------------------------------------
623*cdf0e10cSrcweir void SAL_CALL VCLXAccessibleListItem::addEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
624*cdf0e10cSrcweir {
625*cdf0e10cSrcweir 	if (xListener.is())
626*cdf0e10cSrcweir     {
627*cdf0e10cSrcweir 		if (!m_nClientId)
628*cdf0e10cSrcweir             m_nClientId = comphelper::AccessibleEventNotifier::registerClient( );
629*cdf0e10cSrcweir 		comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener );
630*cdf0e10cSrcweir     }
631*cdf0e10cSrcweir }
632*cdf0e10cSrcweir // -----------------------------------------------------------------------------
633*cdf0e10cSrcweir void SAL_CALL VCLXAccessibleListItem::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
634*cdf0e10cSrcweir {
635*cdf0e10cSrcweir 	if ( xListener.is() && m_nClientId )
636*cdf0e10cSrcweir 	{
637*cdf0e10cSrcweir         sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener );
638*cdf0e10cSrcweir 		if ( !nListenerCount )
639*cdf0e10cSrcweir 		{
640*cdf0e10cSrcweir 			// no listeners anymore
641*cdf0e10cSrcweir 			// -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
642*cdf0e10cSrcweir 			// and at least to us not firing any events anymore, in case somebody calls
643*cdf0e10cSrcweir 			// NotifyAccessibleEvent, again
644*cdf0e10cSrcweir 			if ( m_nClientId )
645*cdf0e10cSrcweir 			{
646*cdf0e10cSrcweir 				comphelper::AccessibleEventNotifier::TClientId nId( m_nClientId );
647*cdf0e10cSrcweir 				m_nClientId = 0;
648*cdf0e10cSrcweir 				comphelper::AccessibleEventNotifier::revokeClient( nId );
649*cdf0e10cSrcweir 			}
650*cdf0e10cSrcweir 		}
651*cdf0e10cSrcweir 	}
652*cdf0e10cSrcweir }
653*cdf0e10cSrcweir // -----------------------------------------------------------------------------
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir 
657*cdf0e10cSrcweir // AF (Oct. 29 2002): Return black as constant foreground color.  This is an
658*cdf0e10cSrcweir // initial implementation and has to be substituted by code that determines
659*cdf0e10cSrcweir // the color that is actually used.
660*cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleListItem::getForeground (void)
661*cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
662*cdf0e10cSrcweir {
663*cdf0e10cSrcweir     return COL_BLACK;
664*cdf0e10cSrcweir }
665*cdf0e10cSrcweir 
666*cdf0e10cSrcweir // AF (Oct. 29 2002): Return white as constant background color.  This is an
667*cdf0e10cSrcweir // initial implementation and has to be substituted by code that determines
668*cdf0e10cSrcweir // the color that is actually used.
669*cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleListItem::getBackground (void)
670*cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
671*cdf0e10cSrcweir {
672*cdf0e10cSrcweir     return COL_WHITE;
673*cdf0e10cSrcweir }
674*cdf0e10cSrcweir // -----------------------------------------------------------------------------
675