1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_accessibility.hxx"
26 #include <accessibility/standard/vclxaccessiblelist.hxx>
27 #include <accessibility/standard/vclxaccessiblelistitem.hxx>
28 #include <accessibility/helper/listboxhelper.hxx>
29 
30 #include <unotools/accessiblestatesethelper.hxx>
31 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
32 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
33 #include <com/sun/star/accessibility/AccessibleRole.hpp>
34 #include <vcl/svapp.hxx>
35 #include <vcl/combobox.hxx>
36 #include <vcl/lstbox.hxx>
37 #include <toolkit/helper/convert.hxx>
38 
39 #ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
40 #include <unotools/accessiblerelationsethelper.hxx>
41 #endif
42 #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_
43 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
44 #endif
45 using namespace ::com::sun::star;
46 using namespace ::com::sun::star::uno;
47 using namespace ::com::sun::star::lang;
48 using namespace ::com::sun::star::beans;
49 using namespace ::com::sun::star::accessibility;
50 using namespace ::accessibility;
51 
52 namespace
53 {
checkSelection_Impl(sal_Int32 _nIndex,const IComboListBoxHelper & _rListBox,sal_Bool bSelected)54 	void checkSelection_Impl( sal_Int32 _nIndex, const IComboListBoxHelper& _rListBox, sal_Bool bSelected )
55 		throw (::com::sun::star::lang::IndexOutOfBoundsException)
56 	{
57 		sal_Int32 nCount = bSelected ? (sal_Int32)_rListBox.GetSelectEntryCount()
58 									 : (sal_Int32)_rListBox.GetEntryCount();
59 		if ( _nIndex < 0 || _nIndex >= nCount )
60 			throw ::com::sun::star::lang::IndexOutOfBoundsException();
61 	}
62 }
63 
VCLXAccessibleList(VCLXWindow * pVCLWindow,BoxType aBoxType,const Reference<XAccessible> & _xParent)64 VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType,
65 										const Reference< XAccessible >& _xParent)
66 	: VCLXAccessibleComponent	(pVCLWindow),
67 	  m_aBoxType				(aBoxType),
68 	  m_nVisibleLineCount		(0),
69 	  m_nIndexInParent			(DEFAULT_INDEX_IN_PARENT),
70 	  m_nLastTopEntry			( 0 ),
71 	  m_nLastSelectedPos		( LISTBOX_ENTRY_NOTFOUND ),
72 	  m_bDisableProcessEvent	( false ),
73 	  m_bVisible				( true ),
74 	  m_nCurSelectedPos			( LISTBOX_ENTRY_NOTFOUND ),
75 	  m_xParent					( _xParent )
76 {
77 	// Because combo boxes and list boxes have the no common interface for
78 	// methods with identical signature we have to write down twice the
79 	// same code.
80 	switch (m_aBoxType)
81 	{
82 		case COMBOBOX:
83 		{
84 			ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
85 			if ( pBox != NULL )
86 				m_pListBoxHelper = new VCLListBoxHelper<ComboBox> (*pBox);
87 			break;
88 		}
89 
90 		case LISTBOX:
91 		{
92 			ListBox* pBox = static_cast<ListBox*>(GetWindow());
93 			if ( pBox != NULL )
94 				m_pListBoxHelper = new VCLListBoxHelper<ListBox> (*pBox);
95 			break;
96 		}
97 	}
98 	UpdateVisibleLineCount();
99 	m_nCurSelectedPos=m_pListBoxHelper->GetSelectEntryPos();
100 
101 	sal_uInt16 nCount = static_cast<sal_uInt16>(getAccessibleChildCount());
102 	m_aAccessibleChildren.reserve(nCount);
103 }
104 // -----------------------------------------------------------------------------
105 
~VCLXAccessibleList(void)106 VCLXAccessibleList::~VCLXAccessibleList (void)
107 {
108 	delete m_pListBoxHelper;
109 }
110 // -----------------------------------------------------------------------------
111 
SetIndexInParent(sal_Int32 nIndex)112 void VCLXAccessibleList::SetIndexInParent (sal_Int32 nIndex)
113 {
114 	m_nIndexInParent = nIndex;
115 }
116 // -----------------------------------------------------------------------------
117 
disposing(void)118 void SAL_CALL VCLXAccessibleList::disposing (void)
119 {
120 	VCLXAccessibleComponent::disposing();
121 
122 	// Dispose all items in the list.
123 	clearItems();
124 
125 	delete m_pListBoxHelper;
126 	m_pListBoxHelper = NULL;
127 }
128 // -----------------------------------------------------------------------------
129 
clearItems()130 void VCLXAccessibleList::clearItems()
131 {
132 //	ListItems::iterator aEnd = m_aAccessibleChildren.end();
133 //	for (ListItems::iterator aIter = m_aAccessibleChildren.begin(); aIter != aEnd; ++aIter)
134 //		::comphelper::disposeComponent(*aIter);
135 
136 	// Clear the list itself and delete all the rest.
137 	ListItems().swap(m_aAccessibleChildren); // clear and minimize
138 }
139 // -----------------------------------------------------------------------------
140 
FillAccessibleStateSet(utl::AccessibleStateSetHelper & rStateSet)141 void VCLXAccessibleList::FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet)
142 {
143 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
144 
145 	VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
146 	// check if our list should be visible
147 	if (	m_pListBoxHelper
148 		&& (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN
149 		&& !m_pListBoxHelper->IsInDropDown() )
150 	{
151 		rStateSet.RemoveState (AccessibleStateType::VISIBLE);
152 		rStateSet.RemoveState (AccessibleStateType::SHOWING);
153 		m_bVisible = false;
154 	}
155 
156 	// Both the combo box and list box are handled identical in the
157 	// following but for some reason they don't have a common interface for
158 	// the methods used.
159 	if ( m_pListBoxHelper )
160 	{
161 		if ( m_pListBoxHelper->IsMultiSelectionEnabled() )
162 			rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE);
163 		rStateSet.AddState (AccessibleStateType::FOCUSABLE);
164 		// All children are transient.
165 		rStateSet.AddState (AccessibleStateType::MANAGES_DESCENDANTS);
166 	}
167 }
168 // -----------------------------------------------------------------------------
notifyVisibleStates(sal_Bool _bSetNew)169 void VCLXAccessibleList::notifyVisibleStates(sal_Bool _bSetNew )
170 {
171 	m_bVisible = _bSetNew ? true : false;
172 	Any aOldValue, aNewValue;
173 	(_bSetNew ? aNewValue : aOldValue ) <<= AccessibleStateType::VISIBLE;
174 	NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
175 	(_bSetNew ? aNewValue : aOldValue ) <<= AccessibleStateType::SHOWING;
176 	NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
177 
178 	ListItems::iterator aIter = m_aAccessibleChildren.begin();
179 	ListItems::iterator aEnd = m_aAccessibleChildren.end();
180 	UpdateVisibleLineCount();
181 	// adjust the index inside the VCLXAccessibleListItem
182 	for (;aIter != aEnd ; ++aIter)
183 	{
184 		Reference< XAccessible > xHold = *aIter;
185 		VCLXAccessibleListItem* pItem = static_cast<VCLXAccessibleListItem*>(xHold.get());
186 		if ( pItem )
187 		{
188 			sal_uInt16 nTopEntry = 0;
189 			if ( m_pListBoxHelper )
190 				nTopEntry = m_pListBoxHelper->GetTopEntry();
191 			sal_uInt16 nPos = (sal_uInt16)(aIter - m_aAccessibleChildren.begin());
192 			sal_Bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) );
193 			pItem->SetVisible( m_bVisible && bVisible );
194 		}
195 
196 	}
197 }
198 // -----------------------------------------------------------------------------
UpdateSelection_Acc(::rtl::OUString sTextOfSelectedItem,bool b_IsDropDownList)199 void VCLXAccessibleList::UpdateSelection_Acc (::rtl::OUString sTextOfSelectedItem, bool b_IsDropDownList)
200 {
201 	if ( m_aBoxType == COMBOBOX )
202 	{
203 		ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
204 		if ( pBox != NULL )
205 		{
206 		// Find the index of the selected item inside the VCL control...
207 		sal_uInt16 nIndex = pBox->GetEntryPos (XubString(sTextOfSelectedItem));
208 		// ...and then find the associated accessibility object.
209 		if ( nIndex == LISTBOX_ENTRY_NOTFOUND )
210 			nIndex = 0;
211 		UpdateSelection_Impl_Acc(b_IsDropDownList);
212 		}
213 	}
214 }
215 
216 // -----------------------------------------------------------------------------
UpdateSelection_Impl_Acc(bool b_IsDropDownList)217 void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool b_IsDropDownList)
218 {
219 	uno::Any aOldValue, aNewValue;
220 	VCLXAccessibleListItem* pCurItem =NULL;
221 
222 	{
223 		vos::OGuard aSolarGuard( Application::GetSolarMutex() );
224 		::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
225 			Reference< XAccessible > xNewAcc;
226 		if ( m_pListBoxHelper )
227 		{
228 			sal_uInt16 i=0;
229 			m_nCurSelectedPos = LISTBOX_ENTRY_NOTFOUND;
230 			for ( ListItems::iterator aIter = m_aAccessibleChildren.begin();
231 				  aIter != m_aAccessibleChildren.end(); ++aIter,++i)
232 			{
233 				Reference< XAccessible > xHold = *aIter;
234 				if ( xHold.is() )
235 				{
236 					VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >( xHold.get() );
237 					// Retrieve the item's index from the list entry.
238 					sal_Bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i);
239 					if (bNowSelected)
240 						m_nCurSelectedPos = i;
241 
242 					if ( bNowSelected && !pItem->IsSelected() )
243 					{
244 						xNewAcc = *aIter;
245 						aNewValue <<= xNewAcc;
246 
247 						pCurItem = pItem;
248 
249 					}
250 					else if ( pItem->IsSelected() )
251 						m_nLastSelectedPos = i;
252 
253 					pItem->SetSelected( bNowSelected );
254 				}
255 				else
256 				{ // it could happen that a child was not created before
257 					checkEntrySelected(i,aNewValue,xNewAcc);
258 				}
259 			}
260 			sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount();
261 			if ( i < nCount ) // here we have to check the if any other listbox entry is selected
262 			{
263 				for (; i < nCount && !checkEntrySelected(i,aNewValue,xNewAcc) ;++i )
264 					;
265 			}
266 			if ( xNewAcc.is() && GetWindow()->HasFocus() )
267 			{
268 				if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND )
269 					aOldValue <<= getAccessibleChild( (sal_Int32)m_nLastSelectedPos );
270 				aNewValue <<= xNewAcc;
271 			}
272 		}
273 	}
274 	if (m_aBoxType == COMBOBOX && b_IsDropDownList)
275 	{
276 		//VCLXAccessibleDropDownComboBox
277 		//when in list is dropped down, xText = NULL
278 		if (m_pListBoxHelper->IsInDropDown())
279 		{
280 			if ( aNewValue.hasValue() || aOldValue.hasValue() )
281 			{
282 				NotifyAccessibleEvent(
283 					AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
284 					aOldValue,
285 					aNewValue );
286 
287 				NotifyListItem(aNewValue);
288 
289 			}
290 		}
291 	}
292 	else if (m_aBoxType == COMBOBOX && !b_IsDropDownList)
293 	{
294 		//VCLXAccessibleComboBox
295 		NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, uno::Any(), uno::Any() );
296 	}
297 	else if (m_aBoxType == LISTBOX && b_IsDropDownList)
298 	{
299 		//VCLXAccessibleDropdownListBox
300 		//when in list is dropped down, xText = NULL
301 		if (m_pListBoxHelper->IsInDropDown())
302 		{
303 			if ( aNewValue.hasValue() || aOldValue.hasValue() )
304 			{
305 				NotifyAccessibleEvent(
306 					AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
307 					aOldValue,
308 					aNewValue );
309 
310 				NotifyListItem(aNewValue);
311 			}
312 		}
313 	}
314 	else if (m_aBoxType == LISTBOX && !b_IsDropDownList)
315 	{
316 		//VCLXAccessibleListBox, xText = NULL.
317 
318 
319 		if ( aNewValue.hasValue())
320 		{
321 			NotifyListItem(aNewValue);
322 		}
323 	}
324 }
NotifyListItem(::com::sun::star::uno::Any & val)325 void VCLXAccessibleList::NotifyListItem(::com::sun::star::uno::Any& val)
326 {
327 	Reference< XAccessible > xCurItem;
328 	val >>= xCurItem;
329 	if (xCurItem.is())
330 	{
331 		VCLXAccessibleListItem* pCurItem = static_cast< VCLXAccessibleListItem* >(xCurItem.get());
332 		if (pCurItem)
333 		{
334 			pCurItem->NotifyAccessibleEvent(AccessibleEventId::SELECTION_CHANGED,Any(),Any());
335 		}
336 	}
337 }
338 
339 
UpdateFocus_Impl_Acc(sal_uInt16 nPos,bool b_IsDropDownList)340 void VCLXAccessibleList::UpdateFocus_Impl_Acc (sal_uInt16 nPos ,bool b_IsDropDownList)
341 {
342 	if (!(m_aBoxType == LISTBOX && !b_IsDropDownList))
343 	{
344 		return ;
345 	}
346 	Reference<XAccessible> xChild= CreateChild(nPos);
347 	if ( !xChild.is() )
348 	{
349 		return ;
350 	}
351 	m_nCurSelectedPos = nPos;
352 	uno::Any aOldValue, aNewValue;
353 	aNewValue <<= xChild;
354 
355 	NotifyAccessibleEvent(
356 			AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
357 			aOldValue,
358 			aNewValue );
359 }
360 
361 // -----------------------------------------------------------------------------
ProcessWindowEvent(const VclWindowEvent & rVclWindowEvent,bool b_IsDropDownList)362 void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent, bool b_IsDropDownList)
363 {
364 	switch ( rVclWindowEvent.GetId() )
365 	{
366 		case VCLEVENT_DROPDOWN_SELECT:
367 		case VCLEVENT_LISTBOX_SELECT:
368 			if ( !m_bDisableProcessEvent )
369 				UpdateSelection_Impl_Acc(b_IsDropDownList);
370 			break;
371 		case VCLEVENT_LISTBOX_FOCUSITEMCHANGED:
372 			if ( !m_bDisableProcessEvent )
373 				UpdateFocus_Impl_Acc((sal_uInt16)reinterpret_cast<sal_uIntPtr>(rVclWindowEvent.GetData()),b_IsDropDownList);
374 			break;
375 		case VCLEVENT_WINDOW_GETFOCUS:
376 			break;
377 		case VCLEVENT_CONTROL_GETFOCUS:
378 			{
379 				VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
380 				if (m_aBoxType == COMBOBOX && b_IsDropDownList)
381 				{
382 					//VCLXAccessibleDropDownComboBox
383 				}
384 				else if (m_aBoxType == LISTBOX && b_IsDropDownList)
385 				{
386 				}
387 				else if ( m_aBoxType == LISTBOX && !b_IsDropDownList)
388 				{
389 					if ( m_pListBoxHelper )
390 					{
391 						uno::Any	aOldValue,
392 									aNewValue;
393 						sal_uInt16 nPos = m_nCurSelectedPos; //m_pListBoxHelper->GetSelectEntryPos();
394 
395 						if ( nPos == LISTBOX_ENTRY_NOTFOUND )
396 							nPos = m_pListBoxHelper->GetTopEntry();
397 						if ( nPos != LISTBOX_ENTRY_NOTFOUND )
398 							aNewValue <<= CreateChild(nPos);
399 						NotifyAccessibleEvent(	AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
400 												aOldValue,
401 												aNewValue );
402 					}
403 				}
404 			}
405 			break;
406 		default:
407 			break;
408 	}
409 
410 }
411 // -----------------------------------------------------------------------------
ProcessWindowEvent(const VclWindowEvent & rVclWindowEvent)412 void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
413 {
414 	// Create a reference to this object to prevent an early release of the
415 	// listbox (VCLEVENT_OBJECT_DYING).
416 	Reference< XAccessible > xTemp = this;
417 
418 	switch ( rVclWindowEvent.GetId() )
419 	{
420 		case VCLEVENT_DROPDOWN_OPEN:
421 			notifyVisibleStates(sal_True);
422 			break;
423 		case VCLEVENT_DROPDOWN_CLOSE:
424 			notifyVisibleStates(sal_False);
425 			break;
426 		case VCLEVENT_LISTBOX_SCROLLED:
427 		case VCLEVENT_COMBOBOX_SCROLLED:
428 			UpdateEntryRange_Impl();
429 			break;
430 
431 		// The selection events VCLEVENT_COMBOBOX_SELECT and
432 		// VCLEVENT_COMBOBOX_DESELECT are not handled here because here we
433 		// have no access to the edit field. Its text is necessary to
434 		// identify the currently selected item.
435 
436 		case VCLEVENT_OBJECT_DYING:
437 		{
438 			dispose();
439 
440 			VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
441 			break;
442 		}
443 
444 		case VCLEVENT_LISTBOX_ITEMREMOVED:
445 		case VCLEVENT_COMBOBOX_ITEMREMOVED:
446 			HandleChangedItemList (false, reinterpret_cast<sal_IntPtr>(
447 				rVclWindowEvent.GetData()));
448 			break;
449 
450 		case VCLEVENT_LISTBOX_ITEMADDED:
451 		case VCLEVENT_COMBOBOX_ITEMADDED:
452 			HandleChangedItemList (true, reinterpret_cast<sal_IntPtr>(
453 				rVclWindowEvent.GetData()));
454 			break;
455 		case VCLEVENT_CONTROL_GETFOCUS:
456 			{
457 				VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
458 				// Added by IBM Symphony Acc team to handle the list item focus when List control get focus
459 				sal_Bool b_IsDropDownList = sal_True;
460 				if (m_pListBoxHelper)
461 					b_IsDropDownList = ((m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN);
462 				if ( m_aBoxType == LISTBOX && !b_IsDropDownList )
463 				{
464 					if ( m_pListBoxHelper )
465 					{
466 						uno::Any	aOldValue,
467 									aNewValue;
468 						sal_uInt16 nPos = m_nCurSelectedPos;
469 
470 						if ( nPos == LISTBOX_ENTRY_NOTFOUND )
471 							nPos = m_pListBoxHelper->GetTopEntry();
472 						if ( nPos != LISTBOX_ENTRY_NOTFOUND )
473 							aNewValue <<= CreateChild(nPos);
474 						NotifyAccessibleEvent(	AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
475 												aOldValue,
476 												aNewValue );
477 					}
478 				}
479 			}
480 			break;
481 
482 		default:
483 			VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
484 	}
485 }
486 
FillAccessibleRelationSet(utl::AccessibleRelationSetHelper & rRelationSet)487  void VCLXAccessibleList::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
488 {
489 	ListBox* pBox = static_cast<ListBox*>(GetWindow());
490 	if( m_aBoxType == LISTBOX )
491 	{
492 		if (m_pListBoxHelper && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) != WB_DROPDOWN)
493 		{
494 			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
495 			aSequence[0] = pBox->GetAccessible();
496 			rRelationSet.AddRelation( com::sun::star::accessibility::AccessibleRelation( com::sun::star::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
497 		}
498 	}
499 	else
500 	{
501 		VCLXAccessibleComponent::FillAccessibleRelationSet(rRelationSet);
502 	}
503 }
504 // -----------------------------------------------------------------------------
505 
506 /** To find out which item is currently selected and to update the SELECTED
507 	state of the associated accessibility objects accordingly we exploit the
508 	fact that the
509 */
UpdateSelection(::rtl::OUString sTextOfSelectedItem)510 void VCLXAccessibleList::UpdateSelection (::rtl::OUString sTextOfSelectedItem)
511 {
512 	if ( m_aBoxType == COMBOBOX )
513 	{
514 		ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
515 		if ( pBox != NULL )
516 		{
517 			// Find the index of the selected item inside the VCL control...
518 			sal_uInt16 nIndex = pBox->GetEntryPos (XubString(sTextOfSelectedItem));
519 			// ...and then find the associated accessibility object.
520 			if ( nIndex == LISTBOX_ENTRY_NOTFOUND )
521 				nIndex = 0;
522 			UpdateSelection_Impl(nIndex);
523 		}
524 	}
525 }
526 // -----------------------------------------------------------------------------
527 
adjustEntriesIndexInParent(ListItems::iterator & _aBegin,::std::mem_fun_t<bool,VCLXAccessibleListItem> & _rMemFun)528 void VCLXAccessibleList::adjustEntriesIndexInParent(ListItems::iterator& _aBegin,::std::mem_fun_t<bool,VCLXAccessibleListItem>& _rMemFun)
529 {
530 	ListItems::iterator aIter = _aBegin;
531 	ListItems::iterator aEnd = m_aAccessibleChildren.end();
532 	// adjust the index inside the VCLXAccessibleListItem
533 	for (;aIter != aEnd ; ++aIter)
534 	{
535 		Reference< XAccessible > xHold = *aIter;
536 		VCLXAccessibleListItem* pItem = static_cast<VCLXAccessibleListItem*>(xHold.get());
537 		if ( pItem )
538 			_rMemFun(pItem);
539 	}
540 }
541 // -----------------------------------------------------------------------------
542 
CreateChild(sal_Int32 i)543 Reference<XAccessible> VCLXAccessibleList::CreateChild (sal_Int32 i)
544 {
545 	Reference<XAccessible> xChild;
546 
547 	sal_uInt16 nPos = static_cast<sal_uInt16>(i);
548 	if ( nPos >= m_aAccessibleChildren.size() )
549 	{
550 		m_aAccessibleChildren.resize(nPos + 1);
551 
552 		// insert into the container
553 		xChild = new VCLXAccessibleListItem(m_pListBoxHelper, i, this);
554 		m_aAccessibleChildren[nPos] = xChild;
555 	}
556 	else
557 	{
558 		xChild = m_aAccessibleChildren[nPos];
559 		// check if position is empty and can be used else we have to adjust all entries behind this
560 		if ( !xChild.is() )
561 		{
562 			xChild = new VCLXAccessibleListItem(m_pListBoxHelper, i, this);
563 			m_aAccessibleChildren[nPos] = xChild;
564 		}
565 	}
566 
567 	if ( xChild.is() )
568 	{
569 		// Just add the SELECTED state.
570 		sal_Bool bNowSelected = sal_False;
571 		if ( m_pListBoxHelper )
572 			bNowSelected = m_pListBoxHelper->IsEntryPosSelected ((sal_uInt16)i);
573 		if (bNowSelected)
574 			m_nCurSelectedPos = sal_uInt16(i);
575 		VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >(xChild.get());
576 		pItem->SetSelected( bNowSelected );
577 
578 		// Set the child's VISIBLE state.
579 		UpdateVisibleLineCount();
580 		sal_uInt16 nTopEntry = 0;
581 		if ( m_pListBoxHelper )
582 			nTopEntry = m_pListBoxHelper->GetTopEntry();
583 		sal_Bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) );
584 		pItem->SetVisible( m_bVisible && bVisible );
585 	}
586 
587 	return xChild;
588 }
589 // -----------------------------------------------------------------------------
590 
HandleChangedItemList(bool bItemInserted,sal_Int32 nIndex)591 void VCLXAccessibleList::HandleChangedItemList (bool bItemInserted, sal_Int32 nIndex)
592 {
593 	clearItems();
594 	NotifyAccessibleEvent (
595 		AccessibleEventId::INVALIDATE_ALL_CHILDREN,
596 		Any(), Any());
597 }
598 // -----------------------------------------------------------------------------
599 
IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleList,VCLXAccessibleComponent,VCLXAccessibleList_BASE)600 IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleList, VCLXAccessibleComponent, VCLXAccessibleList_BASE)
601 IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleList, VCLXAccessibleComponent, VCLXAccessibleList_BASE)
602 
603 //=====  XAccessible  =========================================================
604 
605 Reference<XAccessibleContext> SAL_CALL
606 	VCLXAccessibleList::getAccessibleContext (void)
607 	throw (RuntimeException)
608 {
609 	return this;
610 }
611 // -----------------------------------------------------------------------------
612 
613 //=====  XAccessibleContext  ==================================================
614 
getAccessibleChildCount(void)615 sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleChildCount (void)
616 	throw (RuntimeException)
617 {
618 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
619 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
620 
621 	sal_Int32 nCount = 0;
622 	if ( m_pListBoxHelper )
623 		nCount = m_pListBoxHelper->GetEntryCount();
624 
625 	return nCount;
626 }
627 // -----------------------------------------------------------------------------
628 
getAccessibleChild(sal_Int32 i)629 Reference<XAccessible> SAL_CALL VCLXAccessibleList::getAccessibleChild (sal_Int32 i)
630 	throw (IndexOutOfBoundsException, RuntimeException)
631 {
632 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
633 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
634 
635 	if ( i < 0 || i >= getAccessibleChildCount() )
636 		throw IndexOutOfBoundsException();
637 
638 	Reference< XAccessible > xChild;
639 	// search for the child
640 	if ( i >= static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
641 		xChild = CreateChild (i);
642 	else
643 	{
644 		xChild = m_aAccessibleChildren[i];
645 		if ( !xChild.is() )
646 			xChild = CreateChild (i);
647 	}
648 	OSL_ENSURE( xChild.is(), "VCLXAccessibleList::getAccessibleChild: returning empty child!" );
649 	return xChild;
650 }
651 // -----------------------------------------------------------------------------
652 
getAccessibleParent()653 Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleParent(  )
654 	throw (RuntimeException)
655 {
656 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
657 
658 	return m_xParent;
659 }
660 // -----------------------------------------------------------------------------
661 
getAccessibleIndexInParent(void)662 sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleIndexInParent (void)
663 	throw (::com::sun::star::uno::RuntimeException)
664 {
665 	if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT)
666 		return m_nIndexInParent;
667 	else
668 		return VCLXAccessibleComponent::getAccessibleIndexInParent();
669 }
670 // -----------------------------------------------------------------------------
671 
getAccessibleRole(void)672 sal_Int16 SAL_CALL VCLXAccessibleList::getAccessibleRole (void)
673 	throw (RuntimeException)
674 {
675 	return AccessibleRole::LIST;
676 }
677 // -----------------------------------------------------------------------------
678 
679 //=====  XAccessibleComponent  ================================================
680 
contains(const awt::Point & rPoint)681 sal_Bool SAL_CALL VCLXAccessibleList::contains( const awt::Point& rPoint ) throw (RuntimeException)
682 {
683 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
684 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
685 
686 	sal_Bool bInside = sal_False;
687 
688 	Window* pListBox = GetWindow();
689 	if ( pListBox )
690 	{
691 		Rectangle aRect( Point(0,0), pListBox->GetSizePixel() );
692 		bInside = aRect.IsInside( VCLPoint( rPoint ) );
693 	}
694 
695 	return bInside;
696 }
697 // -----------------------------------------------------------------------------
698 
getAccessibleAt(const awt::Point & rPoint)699 Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleAt( const awt::Point& rPoint )
700 	throw (RuntimeException)
701 {
702 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
703 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
704 
705 	Reference< XAccessible > xChild;
706 	if ( m_pListBoxHelper )
707 	{
708 		UpdateVisibleLineCount();
709 		if ( contains( rPoint ) && m_nVisibleLineCount > 0 )
710 		{
711 			Point aPos = VCLPoint( rPoint );
712 			sal_uInt16 nEndPos = m_pListBoxHelper->GetTopEntry() + (sal_uInt16)m_nVisibleLineCount;
713 			for ( sal_uInt16 i = m_pListBoxHelper->GetTopEntry(); i < nEndPos; ++i )
714 			{
715 				if ( m_pListBoxHelper->GetBoundingRectangle(i).IsInside( aPos ) )
716 				{
717 					xChild = getAccessibleChild(i);
718 					break;
719 				}
720 			}
721 		}
722 	}
723 
724 	return xChild;
725 }
726 // -----------------------------------------------------------------------------
727 
728 //===== XServiceInfo ==========================================================
729 
getImplementationName(void)730 ::rtl::OUString VCLXAccessibleList::getImplementationName (void)
731 	throw (RuntimeException)
732 {
733 	return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleList"));
734 }
735 // -----------------------------------------------------------------------------
736 
getSupportedServiceNames(void)737 Sequence< ::rtl::OUString > VCLXAccessibleList::getSupportedServiceNames (void)
738 	throw (RuntimeException)
739 {
740 	Sequence< ::rtl::OUString > aNames = VCLXAccessibleComponent::getSupportedServiceNames();
741 	sal_Int32 nLength = aNames.getLength();
742 	aNames.realloc( nLength + 1 );
743 	aNames[nLength] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleList"));
744 	return aNames;
745 }
746 // -----------------------------------------------------------------------------
747 
UpdateVisibleLineCount()748 void VCLXAccessibleList::UpdateVisibleLineCount()
749 {
750 	if ( m_pListBoxHelper )
751 	{
752 		if ( (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN )
753 			m_nVisibleLineCount = m_pListBoxHelper->GetDisplayLineCount();
754 		else
755 		{
756 			sal_uInt16 nCols = 0,
757 				nLines = 0;
758 			m_pListBoxHelper->GetMaxVisColumnsAndLines (nCols, nLines);
759 			m_nVisibleLineCount = nLines;
760 		}
761 	}
762 }
763 
764 // -----------------------------------------------------------------------------
UpdateEntryRange_Impl()765 void VCLXAccessibleList::UpdateEntryRange_Impl()
766 {
767 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
768 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
769 
770 	sal_Int32 nTop = m_nLastTopEntry;
771 
772 	if ( m_pListBoxHelper )
773 		nTop = m_pListBoxHelper->GetTopEntry();
774 	if ( nTop != m_nLastTopEntry )
775 	{
776 		UpdateVisibleLineCount();
777 		sal_Int32 nBegin = Min( m_nLastTopEntry, nTop );
778 		sal_Int32 nEnd = Max( m_nLastTopEntry + m_nVisibleLineCount, nTop + m_nVisibleLineCount );
779 		for (sal_uInt16 i = static_cast<sal_uInt16>(nBegin); (i <= static_cast<sal_uInt16>(nEnd)); ++i)
780 		{
781 			sal_Bool bVisible = ( i >= nTop && i < ( nTop + m_nVisibleLineCount ) );
782 			Reference< XAccessible > xHold;
783 			if ( i < m_aAccessibleChildren.size() )
784 				xHold = m_aAccessibleChildren[i];
785 			else if ( bVisible )
786 				xHold = CreateChild(i);
787 
788 			if ( xHold.is() )
789 				static_cast< VCLXAccessibleListItem* >( xHold.get() )->SetVisible( m_bVisible && bVisible );
790 		}
791 	}
792 
793 	m_nLastTopEntry = nTop;
794 }
795 // -----------------------------------------------------------------------------
checkEntrySelected(sal_uInt16 _nPos,Any & _rNewValue,Reference<XAccessible> & _rxNewAcc)796 sal_Bool VCLXAccessibleList::checkEntrySelected(sal_uInt16 _nPos,Any& _rNewValue,Reference< XAccessible >& _rxNewAcc)
797 {
798 	OSL_ENSURE(m_pListBoxHelper,"Helper is not valid!");
799 	sal_Bool bNowSelected = sal_False;
800 	if ( m_pListBoxHelper )
801 	{
802 		bNowSelected = m_pListBoxHelper->IsEntryPosSelected (_nPos);
803 		if ( bNowSelected )
804 		{
805 			_rxNewAcc = CreateChild(_nPos);
806 			_rNewValue <<= _rxNewAcc;
807 		}
808 	}
809 	return bNowSelected;
810 }
811 // -----------------------------------------------------------------------------
812 
UpdateSelection_Impl(sal_uInt16)813 void VCLXAccessibleList::UpdateSelection_Impl(sal_uInt16)
814 {
815 	uno::Any aOldValue, aNewValue;
816 
817 	{
818 		vos::OGuard aSolarGuard( Application::GetSolarMutex() );
819 		::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
820 		Reference< XAccessible > xNewAcc;
821 
822 		if ( m_pListBoxHelper )
823 		{
824 			sal_uInt16 i=0;
825 			m_nCurSelectedPos = LISTBOX_ENTRY_NOTFOUND;
826 			for ( ListItems::iterator aIter = m_aAccessibleChildren.begin();
827 				  aIter != m_aAccessibleChildren.end(); ++aIter,++i)
828 			{
829 				Reference< XAccessible > xHold = *aIter;
830 				if ( xHold.is() )
831 				{
832 					VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >( xHold.get() );
833 					// Retrieve the item's index from the list entry.
834 					sal_Bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i);
835 					if (bNowSelected)
836 						m_nCurSelectedPos = i;
837 
838 					if ( bNowSelected && !pItem->IsSelected() )
839 					{
840 						xNewAcc = *aIter;
841 						aNewValue <<= xNewAcc;
842 					}
843 					else if ( pItem->IsSelected() )
844 						m_nLastSelectedPos = i;
845 
846 					pItem->SetSelected( bNowSelected );
847 				}
848 				else
849 				{ // it could happen that a child was not created before
850 					checkEntrySelected(i,aNewValue,xNewAcc);
851 				}
852 			}
853 			sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount();
854 			if ( i < nCount ) // here we have to check the if any other listbox entry is selected
855 			{
856 				for (; i < nCount && !checkEntrySelected(i,aNewValue,xNewAcc) ;++i )
857 					;
858 			}
859 			if ( xNewAcc.is() && GetWindow()->HasFocus() )
860 			{
861 				if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND )
862 					aOldValue <<= getAccessibleChild( (sal_Int32)m_nLastSelectedPos );
863 				aNewValue <<= xNewAcc;
864 			}
865 		}
866 	}
867 	if (!m_pListBoxHelper->IsInDropDown())
868 	{
869 	}
870 	else
871 	{
872 		if ( aNewValue.hasValue() || aOldValue.hasValue() )
873 			NotifyAccessibleEvent(
874 				AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
875 				aOldValue,
876 				aNewValue );
877 		//the SELECTION_CHANGED is not necessary
878 		//NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
879 	}
880 }
881 
882 // -----------------------------------------------------------------------------
883 // XAccessibleSelection
884 // -----------------------------------------------------------------------------
selectAccessibleChild(sal_Int32 nChildIndex)885 void SAL_CALL VCLXAccessibleList::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
886 {
887 	sal_Bool bNotify = sal_False;
888 
889 	{
890 		vos::OGuard aSolarGuard( Application::GetSolarMutex() );
891 		::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
892 
893 		if ( m_pListBoxHelper )
894 		{
895 			checkSelection_Impl(nChildIndex,*m_pListBoxHelper,sal_False);
896 
897 			m_pListBoxHelper->SelectEntryPos( (sal_uInt16)nChildIndex, sal_True );
898 			// call the select handler, don't handle events in this time
899 			m_bDisableProcessEvent = true;
900 			m_pListBoxHelper->Select();
901 			m_bDisableProcessEvent = false;
902 			bNotify = sal_True;
903 		}
904 	}
905 
906 	if ( bNotify )
907 		UpdateSelection_Impl();
908 }
909 // -----------------------------------------------------------------------------
isAccessibleChildSelected(sal_Int32 nChildIndex)910 sal_Bool SAL_CALL VCLXAccessibleList::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
911 {
912 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
913 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
914 
915 	sal_Bool bRet = sal_False;
916 	if ( m_pListBoxHelper )
917 	{
918 		checkSelection_Impl(nChildIndex,*m_pListBoxHelper,sal_False);
919 
920 		bRet = m_pListBoxHelper->IsEntryPosSelected( (sal_uInt16)nChildIndex );
921 	}
922 	return bRet;
923 }
924 // -----------------------------------------------------------------------------
clearAccessibleSelection()925 void SAL_CALL VCLXAccessibleList::clearAccessibleSelection(  ) throw (RuntimeException)
926 {
927 	sal_Bool bNotify = sal_False;
928 
929 	{
930 		vos::OGuard aSolarGuard( Application::GetSolarMutex() );
931 		::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
932 
933 		if ( m_pListBoxHelper )
934 		{
935 			m_pListBoxHelper->SetNoSelection();
936 			bNotify = sal_True;
937 		}
938 	}
939 
940 	if ( bNotify )
941 		UpdateSelection_Impl();
942 }
943 // -----------------------------------------------------------------------------
selectAllAccessibleChildren()944 void SAL_CALL VCLXAccessibleList::selectAllAccessibleChildren(  ) throw (RuntimeException)
945 {
946 	sal_Bool bNotify = sal_False;
947 
948 	{
949 		vos::OGuard aSolarGuard( Application::GetSolarMutex() );
950 		::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
951 
952 		if ( m_pListBoxHelper )
953 		{
954 			sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount();
955 			for ( sal_uInt16 i = 0; i < nCount; ++i )
956 				m_pListBoxHelper->SelectEntryPos( i, sal_True );
957 			// call the select handler, don't handle events in this time
958 			m_bDisableProcessEvent = true;
959 			m_pListBoxHelper->Select();
960 			m_bDisableProcessEvent = false;
961 			bNotify = sal_True;
962 		}
963 	}
964 
965 	if ( bNotify )
966 		UpdateSelection_Impl();
967 }
968 // -----------------------------------------------------------------------------
getSelectedAccessibleChildCount()969 sal_Int32 SAL_CALL VCLXAccessibleList::getSelectedAccessibleChildCount(  ) throw (RuntimeException)
970 {
971 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
972 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
973 
974 	sal_Int32 nCount = 0;
975 	if ( m_pListBoxHelper )
976 		nCount = m_pListBoxHelper->GetSelectEntryCount();
977 	return nCount;
978 }
979 // -----------------------------------------------------------------------------
getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex)980 Reference< XAccessible > SAL_CALL VCLXAccessibleList::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
981 {
982 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
983 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
984 
985 	if ( m_pListBoxHelper )
986 	{
987 		checkSelection_Impl(nSelectedChildIndex,*m_pListBoxHelper,sal_True);
988 		return getAccessibleChild( (sal_Int32)m_pListBoxHelper->GetSelectEntryPos( (sal_uInt16)nSelectedChildIndex ) );
989 	}
990 
991 	return NULL;
992 }
993 // -----------------------------------------------------------------------------
deselectAccessibleChild(sal_Int32 nSelectedChildIndex)994 void SAL_CALL VCLXAccessibleList::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
995 {
996 	sal_Bool bNotify = sal_False;
997 
998 	{
999 		vos::OGuard aSolarGuard( Application::GetSolarMutex() );
1000 		::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
1001 
1002 		if ( m_pListBoxHelper )
1003 		{
1004 			checkSelection_Impl(nSelectedChildIndex,*m_pListBoxHelper,sal_False);
1005 
1006 			m_pListBoxHelper->SelectEntryPos( (sal_uInt16)nSelectedChildIndex, sal_False );
1007 			// call the select handler, don't handle events in this time
1008 			m_bDisableProcessEvent = true;
1009 			m_pListBoxHelper->Select();
1010 			m_bDisableProcessEvent = false;
1011 			bNotify = sal_True;
1012 		}
1013 	}
1014 
1015 	if ( bNotify )
1016 		UpdateSelection_Impl();
1017 }
1018 // -----------------------------------------------------------------------------
1019 // accessibility::XAccessibleComponent
implGetBounds()1020 awt::Rectangle VCLXAccessibleList::implGetBounds() throw (uno::RuntimeException)
1021 {
1022 	awt::Rectangle aBounds ( 0, 0, 0, 0 );
1023 	if ( m_pListBoxHelper
1024 		&& (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN )
1025 	{
1026 		if ( m_pListBoxHelper->IsInDropDown() )
1027 			aBounds = AWTRectangle(m_pListBoxHelper->GetDropDownPosSizePixel());
1028 	}
1029 	else
1030 	{
1031 		// a list has the same bounds as his parent but starts at (0,0)
1032 		aBounds = VCLXAccessibleComponent::implGetBounds();
1033 		aBounds.X = 0;
1034 		aBounds.Y = 0;
1035 		if ( m_aBoxType == COMBOBOX )
1036 		{
1037 			ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
1038 			if ( pBox )
1039 			{
1040 				Size aSize = pBox->GetSubEdit()->GetSizePixel();
1041 				aBounds.Y += aSize.Height();
1042 				aBounds.Height -= aSize.Height();
1043 			}
1044 		}
1045 	}
1046 	return aBounds;
1047 }
1048 // -----------------------------------------------------------------------------
1049 
getLocationOnScreen()1050 awt::Point VCLXAccessibleList::getLocationOnScreen(  ) throw (uno::RuntimeException)
1051 {
1052 	vos::OGuard aSolarGuard( Application::GetSolarMutex() );
1053 	::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
1054 
1055 	awt::Point aPos;
1056 	if ( m_pListBoxHelper
1057 		&& (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN )
1058 	{
1059 		if ( m_pListBoxHelper->IsInDropDown() )
1060 			aPos = AWTPoint(m_pListBoxHelper->GetDropDownPosSizePixel().TopLeft());
1061 	}
1062 	else
1063 	{
1064 		aPos = VCLXAccessibleComponent::getLocationOnScreen();
1065 		if ( m_aBoxType == COMBOBOX )
1066 		{
1067 			ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
1068 			if ( pBox )
1069 			{
1070 				aPos.Y += pBox->GetSubEdit()->GetSizePixel().Height();
1071 			}
1072 		}
1073 	}
1074 	return aPos;
1075 }
1076 // -----------------------------------------------------------------------------
IsInDropDown()1077 sal_Bool	VCLXAccessibleList::IsInDropDown()
1078 {
1079 	return m_pListBoxHelper->IsInDropDown();
1080 }
1081 // -----------------------------------------------------------------------------
HandleDropOpen()1082 void VCLXAccessibleList::HandleDropOpen()
1083 {
1084 	if ( !m_bDisableProcessEvent )
1085 		UpdateSelection_Impl();
1086 	if (m_nCurSelectedPos != LISTBOX_ENTRY_NOTFOUND &&
1087 		m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND)
1088 	{
1089 		Reference< XAccessible > xChild = getAccessibleChild(m_nCurSelectedPos);
1090 		if(xChild.is())
1091 		{
1092 			uno::Any aNewValue;
1093 			aNewValue <<= xChild;
1094 			NotifyAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,	uno::Any(), aNewValue );
1095 		}
1096 	}
1097 }
1098