10841af79SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 30841af79SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 40841af79SAndrew Rist * or more contributor license agreements. See the NOTICE file 50841af79SAndrew Rist * distributed with this work for additional information 60841af79SAndrew Rist * regarding copyright ownership. The ASF licenses this file 70841af79SAndrew Rist * to you under the Apache License, Version 2.0 (the 80841af79SAndrew Rist * "License"); you may not use this file except in compliance 90841af79SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 110841af79SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 130841af79SAndrew Rist * Unless required by applicable law or agreed to in writing, 140841af79SAndrew Rist * software distributed under the License is distributed on an 150841af79SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 160841af79SAndrew Rist * KIND, either express or implied. See the License for the 170841af79SAndrew Rist * specific language governing permissions and limitations 180841af79SAndrew Rist * under the License. 19cdf0e10cSrcweir * 200841af79SAndrew Rist *************************************************************/ 210841af79SAndrew Rist 220841af79SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_accessibility.hxx" 26cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblelist.hxx> 27cdf0e10cSrcweir #include <accessibility/standard/vclxaccessiblelistitem.hxx> 28cdf0e10cSrcweir #include <accessibility/helper/listboxhelper.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx> 31cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp> 32cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp> 33cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp> 34cdf0e10cSrcweir #include <vcl/svapp.hxx> 35cdf0e10cSrcweir #include <vcl/combobox.hxx> 36cdf0e10cSrcweir #include <vcl/lstbox.hxx> 37cdf0e10cSrcweir #include <toolkit/helper/convert.hxx> 38cdf0e10cSrcweir 3921075d77SSteve Yin #ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_ 4021075d77SSteve Yin #include <unotools/accessiblerelationsethelper.hxx> 4121075d77SSteve Yin #endif 4221075d77SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_ 4321075d77SSteve Yin #include <com/sun/star/accessibility/AccessibleRelationType.hpp> 4421075d77SSteve Yin #endif 45cdf0e10cSrcweir using namespace ::com::sun::star; 46cdf0e10cSrcweir using namespace ::com::sun::star::uno; 47cdf0e10cSrcweir using namespace ::com::sun::star::lang; 48cdf0e10cSrcweir using namespace ::com::sun::star::beans; 49cdf0e10cSrcweir using namespace ::com::sun::star::accessibility; 50cdf0e10cSrcweir using namespace ::accessibility; 51cdf0e10cSrcweir 52cdf0e10cSrcweir namespace 53cdf0e10cSrcweir { 54cdf0e10cSrcweir void checkSelection_Impl( sal_Int32 _nIndex, const IComboListBoxHelper& _rListBox, sal_Bool bSelected ) 55cdf0e10cSrcweir throw (::com::sun::star::lang::IndexOutOfBoundsException) 56cdf0e10cSrcweir { 57cdf0e10cSrcweir sal_Int32 nCount = bSelected ? (sal_Int32)_rListBox.GetSelectEntryCount() 58cdf0e10cSrcweir : (sal_Int32)_rListBox.GetEntryCount(); 59cdf0e10cSrcweir if ( _nIndex < 0 || _nIndex >= nCount ) 60cdf0e10cSrcweir throw ::com::sun::star::lang::IndexOutOfBoundsException(); 61cdf0e10cSrcweir } 62cdf0e10cSrcweir } 63cdf0e10cSrcweir 64cdf0e10cSrcweir VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType, 65cdf0e10cSrcweir const Reference< XAccessible >& _xParent) 66cdf0e10cSrcweir : VCLXAccessibleComponent (pVCLWindow), 67cdf0e10cSrcweir m_aBoxType (aBoxType), 68cdf0e10cSrcweir m_nVisibleLineCount (0), 69cdf0e10cSrcweir m_nIndexInParent (DEFAULT_INDEX_IN_PARENT), 70cdf0e10cSrcweir m_nLastTopEntry ( 0 ), 71cdf0e10cSrcweir m_nLastSelectedPos ( LISTBOX_ENTRY_NOTFOUND ), 72cdf0e10cSrcweir m_bDisableProcessEvent ( false ), 73cdf0e10cSrcweir m_bVisible ( true ), 7421075d77SSteve Yin m_nCurSelectedPos ( LISTBOX_ENTRY_NOTFOUND ), 75cdf0e10cSrcweir m_xParent ( _xParent ) 76cdf0e10cSrcweir { 77cdf0e10cSrcweir // Because combo boxes and list boxes have the no common interface for 78cdf0e10cSrcweir // methods with identical signature we have to write down twice the 79cdf0e10cSrcweir // same code. 80cdf0e10cSrcweir switch (m_aBoxType) 81cdf0e10cSrcweir { 82cdf0e10cSrcweir case COMBOBOX: 83cdf0e10cSrcweir { 84cdf0e10cSrcweir ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); 85cdf0e10cSrcweir if ( pBox != NULL ) 86cdf0e10cSrcweir m_pListBoxHelper = new VCLListBoxHelper<ComboBox> (*pBox); 87cdf0e10cSrcweir break; 88cdf0e10cSrcweir } 89cdf0e10cSrcweir 90cdf0e10cSrcweir case LISTBOX: 91cdf0e10cSrcweir { 92cdf0e10cSrcweir ListBox* pBox = static_cast<ListBox*>(GetWindow()); 93cdf0e10cSrcweir if ( pBox != NULL ) 94cdf0e10cSrcweir m_pListBoxHelper = new VCLListBoxHelper<ListBox> (*pBox); 95cdf0e10cSrcweir break; 96cdf0e10cSrcweir } 97cdf0e10cSrcweir } 98cdf0e10cSrcweir UpdateVisibleLineCount(); 9921075d77SSteve Yin m_nCurSelectedPos=m_pListBoxHelper->GetSelectEntryPos(); 100cdf0e10cSrcweir 101cdf0e10cSrcweir sal_uInt16 nCount = static_cast<sal_uInt16>(getAccessibleChildCount()); 102cdf0e10cSrcweir m_aAccessibleChildren.reserve(nCount); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir // ----------------------------------------------------------------------------- 105cdf0e10cSrcweir 106cdf0e10cSrcweir VCLXAccessibleList::~VCLXAccessibleList (void) 107cdf0e10cSrcweir { 108cdf0e10cSrcweir delete m_pListBoxHelper; 109cdf0e10cSrcweir } 110cdf0e10cSrcweir // ----------------------------------------------------------------------------- 111cdf0e10cSrcweir 112cdf0e10cSrcweir void VCLXAccessibleList::SetIndexInParent (sal_Int32 nIndex) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir m_nIndexInParent = nIndex; 115cdf0e10cSrcweir } 116cdf0e10cSrcweir // ----------------------------------------------------------------------------- 117cdf0e10cSrcweir 118cdf0e10cSrcweir void SAL_CALL VCLXAccessibleList::disposing (void) 119cdf0e10cSrcweir { 120cdf0e10cSrcweir VCLXAccessibleComponent::disposing(); 121cdf0e10cSrcweir 122cdf0e10cSrcweir // Dispose all items in the list. 123cdf0e10cSrcweir clearItems(); 124cdf0e10cSrcweir 125cdf0e10cSrcweir delete m_pListBoxHelper; 126cdf0e10cSrcweir m_pListBoxHelper = NULL; 127cdf0e10cSrcweir } 128cdf0e10cSrcweir // ----------------------------------------------------------------------------- 129cdf0e10cSrcweir 130cdf0e10cSrcweir void VCLXAccessibleList::clearItems() 131cdf0e10cSrcweir { 132cdf0e10cSrcweir // ListItems::iterator aEnd = m_aAccessibleChildren.end(); 133cdf0e10cSrcweir // for (ListItems::iterator aIter = m_aAccessibleChildren.begin(); aIter != aEnd; ++aIter) 134cdf0e10cSrcweir // ::comphelper::disposeComponent(*aIter); 135cdf0e10cSrcweir 136cdf0e10cSrcweir // Clear the list itself and delete all the rest. 137cdf0e10cSrcweir ListItems().swap(m_aAccessibleChildren); // clear and minimize 138cdf0e10cSrcweir } 139cdf0e10cSrcweir // ----------------------------------------------------------------------------- 140cdf0e10cSrcweir 141cdf0e10cSrcweir void VCLXAccessibleList::FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet) 142cdf0e10cSrcweir { 143cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 144cdf0e10cSrcweir 145cdf0e10cSrcweir VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); 146cdf0e10cSrcweir // check if our list should be visible 147cdf0e10cSrcweir if ( m_pListBoxHelper 148cdf0e10cSrcweir && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN 149cdf0e10cSrcweir && !m_pListBoxHelper->IsInDropDown() ) 150cdf0e10cSrcweir { 151cdf0e10cSrcweir rStateSet.RemoveState (AccessibleStateType::VISIBLE); 152cdf0e10cSrcweir rStateSet.RemoveState (AccessibleStateType::SHOWING); 153cdf0e10cSrcweir m_bVisible = false; 154cdf0e10cSrcweir } 155cdf0e10cSrcweir 156cdf0e10cSrcweir // Both the combo box and list box are handled identical in the 157cdf0e10cSrcweir // following but for some reason they don't have a common interface for 158cdf0e10cSrcweir // the methods used. 159cdf0e10cSrcweir if ( m_pListBoxHelper ) 160cdf0e10cSrcweir { 161cdf0e10cSrcweir if ( m_pListBoxHelper->IsMultiSelectionEnabled() ) 162cdf0e10cSrcweir rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE); 163cdf0e10cSrcweir rStateSet.AddState (AccessibleStateType::FOCUSABLE); 164cdf0e10cSrcweir // All children are transient. 165cdf0e10cSrcweir rStateSet.AddState (AccessibleStateType::MANAGES_DESCENDANTS); 166cdf0e10cSrcweir } 167cdf0e10cSrcweir } 168cdf0e10cSrcweir // ----------------------------------------------------------------------------- 169cdf0e10cSrcweir void VCLXAccessibleList::notifyVisibleStates(sal_Bool _bSetNew ) 170cdf0e10cSrcweir { 171cdf0e10cSrcweir m_bVisible = _bSetNew ? true : false; 172cdf0e10cSrcweir Any aOldValue, aNewValue; 173cdf0e10cSrcweir (_bSetNew ? aNewValue : aOldValue ) <<= AccessibleStateType::VISIBLE; 174cdf0e10cSrcweir NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); 175cdf0e10cSrcweir (_bSetNew ? aNewValue : aOldValue ) <<= AccessibleStateType::SHOWING; 176cdf0e10cSrcweir NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); 177cdf0e10cSrcweir 178cdf0e10cSrcweir ListItems::iterator aIter = m_aAccessibleChildren.begin(); 179cdf0e10cSrcweir ListItems::iterator aEnd = m_aAccessibleChildren.end(); 180cdf0e10cSrcweir UpdateVisibleLineCount(); 181cdf0e10cSrcweir // adjust the index inside the VCLXAccessibleListItem 182cdf0e10cSrcweir for (;aIter != aEnd ; ++aIter) 183cdf0e10cSrcweir { 184cdf0e10cSrcweir Reference< XAccessible > xHold = *aIter; 185cdf0e10cSrcweir VCLXAccessibleListItem* pItem = static_cast<VCLXAccessibleListItem*>(xHold.get()); 186cdf0e10cSrcweir if ( pItem ) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir sal_uInt16 nTopEntry = 0; 189cdf0e10cSrcweir if ( m_pListBoxHelper ) 190cdf0e10cSrcweir nTopEntry = m_pListBoxHelper->GetTopEntry(); 191cdf0e10cSrcweir sal_uInt16 nPos = (sal_uInt16)(aIter - m_aAccessibleChildren.begin()); 192cdf0e10cSrcweir sal_Bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) ); 193cdf0e10cSrcweir pItem->SetVisible( m_bVisible && bVisible ); 194cdf0e10cSrcweir } 195cdf0e10cSrcweir 196cdf0e10cSrcweir } 197cdf0e10cSrcweir } 198cdf0e10cSrcweir // ----------------------------------------------------------------------------- 19921075d77SSteve Yin void VCLXAccessibleList::UpdateSelection_Acc (::rtl::OUString sTextOfSelectedItem, bool b_IsDropDownList) 20021075d77SSteve Yin { 20121075d77SSteve Yin if ( m_aBoxType == COMBOBOX ) 20221075d77SSteve Yin { 20321075d77SSteve Yin ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); 20421075d77SSteve Yin if ( pBox != NULL ) 20521075d77SSteve Yin { 20621075d77SSteve Yin // Find the index of the selected item inside the VCL control... 20721075d77SSteve Yin sal_uInt16 nIndex = pBox->GetEntryPos (XubString(sTextOfSelectedItem)); 20821075d77SSteve Yin // ...and then find the associated accessibility object. 20921075d77SSteve Yin if ( nIndex == LISTBOX_ENTRY_NOTFOUND ) 21021075d77SSteve Yin nIndex = 0; 21121075d77SSteve Yin UpdateSelection_Impl_Acc(b_IsDropDownList); 21221075d77SSteve Yin } 21321075d77SSteve Yin } 21421075d77SSteve Yin } 21521075d77SSteve Yin 21621075d77SSteve Yin // ----------------------------------------------------------------------------- 21721075d77SSteve Yin void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool b_IsDropDownList) 21821075d77SSteve Yin { 21921075d77SSteve Yin uno::Any aOldValue, aNewValue; 22021075d77SSteve Yin VCLXAccessibleListItem* pCurItem =NULL; 22121075d77SSteve Yin 22221075d77SSteve Yin { 22321075d77SSteve Yin vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 22421075d77SSteve Yin ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 22521075d77SSteve Yin Reference< XAccessible > xNewAcc; 22621075d77SSteve Yin if ( m_pListBoxHelper ) 22721075d77SSteve Yin { 22821075d77SSteve Yin sal_uInt16 i=0; 22921075d77SSteve Yin m_nCurSelectedPos = LISTBOX_ENTRY_NOTFOUND; 23021075d77SSteve Yin for ( ListItems::iterator aIter = m_aAccessibleChildren.begin(); 23121075d77SSteve Yin aIter != m_aAccessibleChildren.end(); ++aIter,++i) 23221075d77SSteve Yin { 23321075d77SSteve Yin Reference< XAccessible > xHold = *aIter; 23421075d77SSteve Yin if ( xHold.is() ) 23521075d77SSteve Yin { 23621075d77SSteve Yin VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >( xHold.get() ); 23721075d77SSteve Yin // Retrieve the item's index from the list entry. 23821075d77SSteve Yin sal_Bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i); 23921075d77SSteve Yin if (bNowSelected) 24021075d77SSteve Yin m_nCurSelectedPos = i; 24121075d77SSteve Yin 24221075d77SSteve Yin if ( bNowSelected && !pItem->IsSelected() ) 24321075d77SSteve Yin { 24421075d77SSteve Yin xNewAcc = *aIter; 24521075d77SSteve Yin aNewValue <<= xNewAcc; 24621075d77SSteve Yin 24721075d77SSteve Yin pCurItem = pItem; 24821075d77SSteve Yin 24921075d77SSteve Yin } 25021075d77SSteve Yin else if ( pItem->IsSelected() ) 25121075d77SSteve Yin m_nLastSelectedPos = i; 25221075d77SSteve Yin 25321075d77SSteve Yin pItem->SetSelected( bNowSelected ); 25421075d77SSteve Yin } 25521075d77SSteve Yin else 25621075d77SSteve Yin { // it could happen that a child was not created before 25721075d77SSteve Yin checkEntrySelected(i,aNewValue,xNewAcc); 25821075d77SSteve Yin } 25921075d77SSteve Yin } 26021075d77SSteve Yin sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount(); 26121075d77SSteve Yin if ( i < nCount ) // here we have to check the if any other listbox entry is selected 26221075d77SSteve Yin { 26321075d77SSteve Yin for (; i < nCount && !checkEntrySelected(i,aNewValue,xNewAcc) ;++i ) 26421075d77SSteve Yin ; 26521075d77SSteve Yin } 26621075d77SSteve Yin if ( xNewAcc.is() && GetWindow()->HasFocus() ) 26721075d77SSteve Yin { 26821075d77SSteve Yin if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND ) 26921075d77SSteve Yin aOldValue <<= getAccessibleChild( (sal_Int32)m_nLastSelectedPos ); 27021075d77SSteve Yin aNewValue <<= xNewAcc; 27121075d77SSteve Yin } 27221075d77SSteve Yin } 27321075d77SSteve Yin } 27421075d77SSteve Yin if (m_aBoxType == COMBOBOX && b_IsDropDownList) 27521075d77SSteve Yin { 27621075d77SSteve Yin //VCLXAccessibleDropDownComboBox 27721075d77SSteve Yin //when in list is dropped down, xText = NULL 27821075d77SSteve Yin if (m_pListBoxHelper->IsInDropDown()) 27921075d77SSteve Yin { 28021075d77SSteve Yin if ( aNewValue.hasValue() || aOldValue.hasValue() ) 28121075d77SSteve Yin { 28221075d77SSteve Yin NotifyAccessibleEvent( 28321075d77SSteve Yin AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, 28421075d77SSteve Yin aOldValue, 28521075d77SSteve Yin aNewValue ); 28621075d77SSteve Yin 28721075d77SSteve Yin NotifyListItem(aNewValue); 28821075d77SSteve Yin 28921075d77SSteve Yin } 29021075d77SSteve Yin } 29121075d77SSteve Yin } 29221075d77SSteve Yin else if (m_aBoxType == COMBOBOX && !b_IsDropDownList) 29321075d77SSteve Yin { 29421075d77SSteve Yin //VCLXAccessibleComboBox 29521075d77SSteve Yin NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, uno::Any(), uno::Any() ); 29621075d77SSteve Yin } 29721075d77SSteve Yin else if (m_aBoxType == LISTBOX && b_IsDropDownList) 29821075d77SSteve Yin { 29921075d77SSteve Yin //VCLXAccessibleDropdownListBox 30021075d77SSteve Yin //when in list is dropped down, xText = NULL 30121075d77SSteve Yin if (m_pListBoxHelper->IsInDropDown()) 30221075d77SSteve Yin { 30321075d77SSteve Yin if ( aNewValue.hasValue() || aOldValue.hasValue() ) 30421075d77SSteve Yin { 30521075d77SSteve Yin NotifyAccessibleEvent( 30621075d77SSteve Yin AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, 30721075d77SSteve Yin aOldValue, 30821075d77SSteve Yin aNewValue ); 30921075d77SSteve Yin 31021075d77SSteve Yin NotifyListItem(aNewValue); 31121075d77SSteve Yin } 31221075d77SSteve Yin } 31321075d77SSteve Yin } 31421075d77SSteve Yin else if (m_aBoxType == LISTBOX && !b_IsDropDownList) 31521075d77SSteve Yin { 31621075d77SSteve Yin //VCLXAccessibleListBox, xText = NULL. 31721075d77SSteve Yin 31821075d77SSteve Yin 31921075d77SSteve Yin if ( aNewValue.hasValue()) 32021075d77SSteve Yin { 32121075d77SSteve Yin NotifyListItem(aNewValue); 32221075d77SSteve Yin } 32321075d77SSteve Yin } 32421075d77SSteve Yin } 32521075d77SSteve Yin void VCLXAccessibleList::NotifyListItem(::com::sun::star::uno::Any& val) 32621075d77SSteve Yin { 32721075d77SSteve Yin Reference< XAccessible > xCurItem; 32821075d77SSteve Yin val >>= xCurItem; 32921075d77SSteve Yin if (xCurItem.is()) 33021075d77SSteve Yin { 33121075d77SSteve Yin VCLXAccessibleListItem* pCurItem = static_cast< VCLXAccessibleListItem* >(xCurItem.get()); 33221075d77SSteve Yin if (pCurItem) 33321075d77SSteve Yin { 33421075d77SSteve Yin pCurItem->NotifyAccessibleEvent(AccessibleEventId::SELECTION_CHANGED,Any(),Any()); 33521075d77SSteve Yin } 33621075d77SSteve Yin } 33721075d77SSteve Yin } 33821075d77SSteve Yin 33921075d77SSteve Yin 34021075d77SSteve Yin void VCLXAccessibleList::UpdateFocus_Impl_Acc (sal_uInt16 nPos ,bool b_IsDropDownList) 34121075d77SSteve Yin { 34221075d77SSteve Yin if (!(m_aBoxType == LISTBOX && !b_IsDropDownList)) 34321075d77SSteve Yin { 34421075d77SSteve Yin return ; 34521075d77SSteve Yin } 34621075d77SSteve Yin Reference<XAccessible> xChild= CreateChild(nPos); 34721075d77SSteve Yin if ( !xChild.is() ) 34821075d77SSteve Yin { 34921075d77SSteve Yin return ; 35021075d77SSteve Yin } 35121075d77SSteve Yin m_nCurSelectedPos = nPos; 35221075d77SSteve Yin uno::Any aOldValue, aNewValue; 35321075d77SSteve Yin aNewValue <<= xChild; 35421075d77SSteve Yin 35521075d77SSteve Yin NotifyAccessibleEvent( 35621075d77SSteve Yin AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, 35721075d77SSteve Yin aOldValue, 35821075d77SSteve Yin aNewValue ); 35921075d77SSteve Yin } 36021075d77SSteve Yin 36121075d77SSteve Yin // ----------------------------------------------------------------------------- 36221075d77SSteve Yin void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent, bool b_IsDropDownList) 36321075d77SSteve Yin { 36421075d77SSteve Yin switch ( rVclWindowEvent.GetId() ) 36521075d77SSteve Yin { 36621075d77SSteve Yin case VCLEVENT_LISTBOX_SELECT: 36721075d77SSteve Yin if ( !m_bDisableProcessEvent ) 36821075d77SSteve Yin UpdateSelection_Impl_Acc(b_IsDropDownList); 36921075d77SSteve Yin break; 37021075d77SSteve Yin case VCLEVENT_LISTBOX_FOCUSITEMCHANGED: 37121075d77SSteve Yin if ( !m_bDisableProcessEvent ) 37289874c60SHerbert Dürr UpdateFocus_Impl_Acc((sal_uInt16)reinterpret_cast<sal_uIntPtr>(rVclWindowEvent.GetData()),b_IsDropDownList); 37321075d77SSteve Yin break; 37421075d77SSteve Yin case VCLEVENT_WINDOW_GETFOCUS: 37521075d77SSteve Yin break; 37621075d77SSteve Yin case VCLEVENT_CONTROL_GETFOCUS: 37721075d77SSteve Yin { 37821075d77SSteve Yin VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); 37921075d77SSteve Yin if (m_aBoxType == COMBOBOX && b_IsDropDownList) 38021075d77SSteve Yin { 38121075d77SSteve Yin //VCLXAccessibleDropDownComboBox 38221075d77SSteve Yin } 38321075d77SSteve Yin else if (m_aBoxType == LISTBOX && b_IsDropDownList) 38421075d77SSteve Yin { 38521075d77SSteve Yin } 38621075d77SSteve Yin else if ( m_aBoxType == LISTBOX && !b_IsDropDownList) 38721075d77SSteve Yin { 38821075d77SSteve Yin if ( m_pListBoxHelper ) 38921075d77SSteve Yin { 39021075d77SSteve Yin uno::Any aOldValue, 39121075d77SSteve Yin aNewValue; 39221075d77SSteve Yin sal_uInt16 nPos = m_nCurSelectedPos; //m_pListBoxHelper->GetSelectEntryPos(); 39321075d77SSteve Yin 39421075d77SSteve Yin if ( nPos == LISTBOX_ENTRY_NOTFOUND ) 39521075d77SSteve Yin nPos = m_pListBoxHelper->GetTopEntry(); 39621075d77SSteve Yin if ( nPos != LISTBOX_ENTRY_NOTFOUND ) 39721075d77SSteve Yin aNewValue <<= CreateChild(nPos); 39821075d77SSteve Yin NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, 39921075d77SSteve Yin aOldValue, 40021075d77SSteve Yin aNewValue ); 40121075d77SSteve Yin } 40221075d77SSteve Yin } 40321075d77SSteve Yin } 40421075d77SSteve Yin break; 40521075d77SSteve Yin default: 40621075d77SSteve Yin break; 40721075d77SSteve Yin } 40821075d77SSteve Yin 40921075d77SSteve Yin } 41021075d77SSteve Yin // ----------------------------------------------------------------------------- 411cdf0e10cSrcweir void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) 412cdf0e10cSrcweir { 413cdf0e10cSrcweir // Create a reference to this object to prevent an early release of the 414cdf0e10cSrcweir // listbox (VCLEVENT_OBJECT_DYING). 415cdf0e10cSrcweir Reference< XAccessible > xTemp = this; 416cdf0e10cSrcweir 417cdf0e10cSrcweir switch ( rVclWindowEvent.GetId() ) 418cdf0e10cSrcweir { 419cdf0e10cSrcweir case VCLEVENT_DROPDOWN_OPEN: 420cdf0e10cSrcweir notifyVisibleStates(sal_True); 421cdf0e10cSrcweir break; 422cdf0e10cSrcweir case VCLEVENT_DROPDOWN_CLOSE: 423cdf0e10cSrcweir notifyVisibleStates(sal_False); 424cdf0e10cSrcweir break; 425cdf0e10cSrcweir case VCLEVENT_LISTBOX_SCROLLED: 426cdf0e10cSrcweir case VCLEVENT_COMBOBOX_SCROLLED: 427cdf0e10cSrcweir UpdateEntryRange_Impl(); 428cdf0e10cSrcweir break; 429*3ea0c3d5SHerbert Dürr 430cdf0e10cSrcweir // The selection events VCLEVENT_COMBOBOX_SELECT and 431cdf0e10cSrcweir // VCLEVENT_COMBOBOX_DESELECT are not handled here because here we 432cdf0e10cSrcweir // have no access to the edit field. Its text is necessary to 433cdf0e10cSrcweir // identify the currently selected item. 434cdf0e10cSrcweir 435cdf0e10cSrcweir case VCLEVENT_OBJECT_DYING: 436cdf0e10cSrcweir { 437cdf0e10cSrcweir dispose(); 438cdf0e10cSrcweir 439cdf0e10cSrcweir VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); 440cdf0e10cSrcweir break; 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443cdf0e10cSrcweir case VCLEVENT_LISTBOX_ITEMREMOVED: 444cdf0e10cSrcweir case VCLEVENT_COMBOBOX_ITEMREMOVED: 445cdf0e10cSrcweir HandleChangedItemList (false, reinterpret_cast<sal_IntPtr>( 446cdf0e10cSrcweir rVclWindowEvent.GetData())); 447cdf0e10cSrcweir break; 448cdf0e10cSrcweir 449cdf0e10cSrcweir case VCLEVENT_LISTBOX_ITEMADDED: 450cdf0e10cSrcweir case VCLEVENT_COMBOBOX_ITEMADDED: 451cdf0e10cSrcweir HandleChangedItemList (true, reinterpret_cast<sal_IntPtr>( 452cdf0e10cSrcweir rVclWindowEvent.GetData())); 453cdf0e10cSrcweir break; 454cdf0e10cSrcweir case VCLEVENT_CONTROL_GETFOCUS: 45521075d77SSteve Yin { 456cdf0e10cSrcweir VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); 45721075d77SSteve Yin // Added by IBM Symphony Acc team to handle the list item focus when List control get focus 45821075d77SSteve Yin sal_Bool b_IsDropDownList = sal_True; 45921075d77SSteve Yin if (m_pListBoxHelper) 46021075d77SSteve Yin b_IsDropDownList = ((m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN); 46121075d77SSteve Yin if ( m_aBoxType == LISTBOX && !b_IsDropDownList ) 46221075d77SSteve Yin { 463cdf0e10cSrcweir if ( m_pListBoxHelper ) 464cdf0e10cSrcweir { 465cdf0e10cSrcweir uno::Any aOldValue, 466cdf0e10cSrcweir aNewValue; 46721075d77SSteve Yin sal_uInt16 nPos = m_nCurSelectedPos; 46821075d77SSteve Yin 469cdf0e10cSrcweir if ( nPos == LISTBOX_ENTRY_NOTFOUND ) 470cdf0e10cSrcweir nPos = m_pListBoxHelper->GetTopEntry(); 471cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND ) 472cdf0e10cSrcweir aNewValue <<= CreateChild(nPos); 473cdf0e10cSrcweir NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, 474cdf0e10cSrcweir aOldValue, 475cdf0e10cSrcweir aNewValue ); 476cdf0e10cSrcweir } 47721075d77SSteve Yin } 47821075d77SSteve Yin } 479cdf0e10cSrcweir break; 480cdf0e10cSrcweir 481cdf0e10cSrcweir default: 482cdf0e10cSrcweir VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); 483cdf0e10cSrcweir } 484cdf0e10cSrcweir } 48521075d77SSteve Yin 48621075d77SSteve Yin void VCLXAccessibleList::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ) 48721075d77SSteve Yin { 48821075d77SSteve Yin ListBox* pBox = static_cast<ListBox*>(GetWindow()); 48921075d77SSteve Yin if( m_aBoxType == LISTBOX ) 49021075d77SSteve Yin { 49121075d77SSteve Yin if (m_pListBoxHelper && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) != WB_DROPDOWN) 49221075d77SSteve Yin { 49321075d77SSteve Yin uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); 49421075d77SSteve Yin aSequence[0] = pBox->GetAccessible(); 49521075d77SSteve Yin rRelationSet.AddRelation( com::sun::star::accessibility::AccessibleRelation( com::sun::star::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) ); 49621075d77SSteve Yin } 49721075d77SSteve Yin } 49821075d77SSteve Yin else 49921075d77SSteve Yin { 50021075d77SSteve Yin VCLXAccessibleComponent::FillAccessibleRelationSet(rRelationSet); 50121075d77SSteve Yin } 50221075d77SSteve Yin } 503cdf0e10cSrcweir // ----------------------------------------------------------------------------- 504cdf0e10cSrcweir 505cdf0e10cSrcweir /** To find out which item is currently selected and to update the SELECTED 506cdf0e10cSrcweir state of the associated accessibility objects accordingly we exploit the 507cdf0e10cSrcweir fact that the 508cdf0e10cSrcweir */ 509cdf0e10cSrcweir void VCLXAccessibleList::UpdateSelection (::rtl::OUString sTextOfSelectedItem) 510cdf0e10cSrcweir { 511cdf0e10cSrcweir if ( m_aBoxType == COMBOBOX ) 512cdf0e10cSrcweir { 513cdf0e10cSrcweir ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); 514cdf0e10cSrcweir if ( pBox != NULL ) 515cdf0e10cSrcweir { 516cdf0e10cSrcweir // Find the index of the selected item inside the VCL control... 517cdf0e10cSrcweir sal_uInt16 nIndex = pBox->GetEntryPos (XubString(sTextOfSelectedItem)); 518cdf0e10cSrcweir // ...and then find the associated accessibility object. 519cdf0e10cSrcweir if ( nIndex == LISTBOX_ENTRY_NOTFOUND ) 520cdf0e10cSrcweir nIndex = 0; 521cdf0e10cSrcweir UpdateSelection_Impl(nIndex); 522cdf0e10cSrcweir } 523cdf0e10cSrcweir } 524cdf0e10cSrcweir } 525cdf0e10cSrcweir // ----------------------------------------------------------------------------- 526cdf0e10cSrcweir 527cdf0e10cSrcweir void VCLXAccessibleList::adjustEntriesIndexInParent(ListItems::iterator& _aBegin,::std::mem_fun_t<bool,VCLXAccessibleListItem>& _rMemFun) 528cdf0e10cSrcweir { 529cdf0e10cSrcweir ListItems::iterator aIter = _aBegin; 530cdf0e10cSrcweir ListItems::iterator aEnd = m_aAccessibleChildren.end(); 531cdf0e10cSrcweir // adjust the index inside the VCLXAccessibleListItem 532cdf0e10cSrcweir for (;aIter != aEnd ; ++aIter) 533cdf0e10cSrcweir { 534cdf0e10cSrcweir Reference< XAccessible > xHold = *aIter; 535cdf0e10cSrcweir VCLXAccessibleListItem* pItem = static_cast<VCLXAccessibleListItem*>(xHold.get()); 536cdf0e10cSrcweir if ( pItem ) 537cdf0e10cSrcweir _rMemFun(pItem); 538cdf0e10cSrcweir } 539cdf0e10cSrcweir } 540cdf0e10cSrcweir // ----------------------------------------------------------------------------- 541cdf0e10cSrcweir 542cdf0e10cSrcweir Reference<XAccessible> VCLXAccessibleList::CreateChild (sal_Int32 i) 543cdf0e10cSrcweir { 544cdf0e10cSrcweir Reference<XAccessible> xChild; 545cdf0e10cSrcweir 546cdf0e10cSrcweir sal_uInt16 nPos = static_cast<sal_uInt16>(i); 547cdf0e10cSrcweir if ( nPos >= m_aAccessibleChildren.size() ) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir m_aAccessibleChildren.resize(nPos + 1); 550cdf0e10cSrcweir 551cdf0e10cSrcweir // insert into the container 552cdf0e10cSrcweir xChild = new VCLXAccessibleListItem(m_pListBoxHelper, i, this); 553cdf0e10cSrcweir m_aAccessibleChildren[nPos] = xChild; 554cdf0e10cSrcweir } 555cdf0e10cSrcweir else 556cdf0e10cSrcweir { 557cdf0e10cSrcweir xChild = m_aAccessibleChildren[nPos]; 558cdf0e10cSrcweir // check if position is empty and can be used else we have to adjust all entries behind this 559*3ea0c3d5SHerbert Dürr if ( !xChild.is() ) 560cdf0e10cSrcweir { 561cdf0e10cSrcweir xChild = new VCLXAccessibleListItem(m_pListBoxHelper, i, this); 562cdf0e10cSrcweir m_aAccessibleChildren[nPos] = xChild; 563cdf0e10cSrcweir } 564cdf0e10cSrcweir } 565cdf0e10cSrcweir 566cdf0e10cSrcweir if ( xChild.is() ) 567cdf0e10cSrcweir { 568cdf0e10cSrcweir // Just add the SELECTED state. 569cdf0e10cSrcweir sal_Bool bNowSelected = sal_False; 570cdf0e10cSrcweir if ( m_pListBoxHelper ) 571cdf0e10cSrcweir bNowSelected = m_pListBoxHelper->IsEntryPosSelected ((sal_uInt16)i); 57221075d77SSteve Yin if (bNowSelected) 57321075d77SSteve Yin m_nCurSelectedPos = sal_uInt16(i); 574cdf0e10cSrcweir VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >(xChild.get()); 575cdf0e10cSrcweir pItem->SetSelected( bNowSelected ); 576cdf0e10cSrcweir 577cdf0e10cSrcweir // Set the child's VISIBLE state. 578cdf0e10cSrcweir UpdateVisibleLineCount(); 579cdf0e10cSrcweir sal_uInt16 nTopEntry = 0; 580cdf0e10cSrcweir if ( m_pListBoxHelper ) 581cdf0e10cSrcweir nTopEntry = m_pListBoxHelper->GetTopEntry(); 582cdf0e10cSrcweir sal_Bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) ); 583cdf0e10cSrcweir pItem->SetVisible( m_bVisible && bVisible ); 584cdf0e10cSrcweir } 585cdf0e10cSrcweir 586cdf0e10cSrcweir return xChild; 587cdf0e10cSrcweir } 588cdf0e10cSrcweir // ----------------------------------------------------------------------------- 589cdf0e10cSrcweir 590cdf0e10cSrcweir void VCLXAccessibleList::HandleChangedItemList (bool bItemInserted, sal_Int32 nIndex) 591cdf0e10cSrcweir { 59221075d77SSteve Yin clearItems(); 593cdf0e10cSrcweir NotifyAccessibleEvent ( 594cdf0e10cSrcweir AccessibleEventId::INVALIDATE_ALL_CHILDREN, 595cdf0e10cSrcweir Any(), Any()); 596cdf0e10cSrcweir } 597cdf0e10cSrcweir // ----------------------------------------------------------------------------- 598cdf0e10cSrcweir 599cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleList, VCLXAccessibleComponent, VCLXAccessibleList_BASE) 600cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleList, VCLXAccessibleComponent, VCLXAccessibleList_BASE) 601cdf0e10cSrcweir 602cdf0e10cSrcweir //===== XAccessible ========================================================= 603cdf0e10cSrcweir 604cdf0e10cSrcweir Reference<XAccessibleContext> SAL_CALL 605cdf0e10cSrcweir VCLXAccessibleList::getAccessibleContext (void) 606cdf0e10cSrcweir throw (RuntimeException) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir return this; 609cdf0e10cSrcweir } 610cdf0e10cSrcweir // ----------------------------------------------------------------------------- 611cdf0e10cSrcweir 612cdf0e10cSrcweir //===== XAccessibleContext ================================================== 613cdf0e10cSrcweir 614cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleChildCount (void) 615cdf0e10cSrcweir throw (RuntimeException) 616cdf0e10cSrcweir { 617cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 618cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 619cdf0e10cSrcweir 620cdf0e10cSrcweir sal_Int32 nCount = 0; 621cdf0e10cSrcweir if ( m_pListBoxHelper ) 622cdf0e10cSrcweir nCount = m_pListBoxHelper->GetEntryCount(); 623cdf0e10cSrcweir 624cdf0e10cSrcweir return nCount; 625cdf0e10cSrcweir } 626cdf0e10cSrcweir // ----------------------------------------------------------------------------- 627cdf0e10cSrcweir 628cdf0e10cSrcweir Reference<XAccessible> SAL_CALL VCLXAccessibleList::getAccessibleChild (sal_Int32 i) 629cdf0e10cSrcweir throw (IndexOutOfBoundsException, RuntimeException) 630cdf0e10cSrcweir { 631cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 632cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 633cdf0e10cSrcweir 634cdf0e10cSrcweir if ( i < 0 || i >= getAccessibleChildCount() ) 635cdf0e10cSrcweir throw IndexOutOfBoundsException(); 636cdf0e10cSrcweir 637cdf0e10cSrcweir Reference< XAccessible > xChild; 638cdf0e10cSrcweir // search for the child 639b98ff797SHerbert Dürr if ( i >= static_cast<sal_Int32>(m_aAccessibleChildren.size()) ) 640cdf0e10cSrcweir xChild = CreateChild (i); 641cdf0e10cSrcweir else 642cdf0e10cSrcweir { 643cdf0e10cSrcweir xChild = m_aAccessibleChildren[i]; 644cdf0e10cSrcweir if ( !xChild.is() ) 645cdf0e10cSrcweir xChild = CreateChild (i); 646cdf0e10cSrcweir } 647cdf0e10cSrcweir OSL_ENSURE( xChild.is(), "VCLXAccessibleList::getAccessibleChild: returning empty child!" ); 648cdf0e10cSrcweir return xChild; 649cdf0e10cSrcweir } 650cdf0e10cSrcweir // ----------------------------------------------------------------------------- 651cdf0e10cSrcweir 652cdf0e10cSrcweir Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleParent( ) 653cdf0e10cSrcweir throw (RuntimeException) 654cdf0e10cSrcweir { 655cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 656cdf0e10cSrcweir 657cdf0e10cSrcweir return m_xParent; 658cdf0e10cSrcweir } 659cdf0e10cSrcweir // ----------------------------------------------------------------------------- 660cdf0e10cSrcweir 661cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleIndexInParent (void) 662cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 663cdf0e10cSrcweir { 664cdf0e10cSrcweir if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT) 665cdf0e10cSrcweir return m_nIndexInParent; 666cdf0e10cSrcweir else 667cdf0e10cSrcweir return VCLXAccessibleComponent::getAccessibleIndexInParent(); 668cdf0e10cSrcweir } 669cdf0e10cSrcweir // ----------------------------------------------------------------------------- 670cdf0e10cSrcweir 671cdf0e10cSrcweir sal_Int16 SAL_CALL VCLXAccessibleList::getAccessibleRole (void) 672cdf0e10cSrcweir throw (RuntimeException) 673cdf0e10cSrcweir { 674cdf0e10cSrcweir return AccessibleRole::LIST; 675cdf0e10cSrcweir } 676cdf0e10cSrcweir // ----------------------------------------------------------------------------- 677cdf0e10cSrcweir 678cdf0e10cSrcweir //===== XAccessibleComponent ================================================ 679cdf0e10cSrcweir 680cdf0e10cSrcweir sal_Bool SAL_CALL VCLXAccessibleList::contains( const awt::Point& rPoint ) throw (RuntimeException) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 683cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 684cdf0e10cSrcweir 685cdf0e10cSrcweir sal_Bool bInside = sal_False; 686cdf0e10cSrcweir 687cdf0e10cSrcweir Window* pListBox = GetWindow(); 688cdf0e10cSrcweir if ( pListBox ) 689cdf0e10cSrcweir { 690cdf0e10cSrcweir Rectangle aRect( Point(0,0), pListBox->GetSizePixel() ); 691cdf0e10cSrcweir bInside = aRect.IsInside( VCLPoint( rPoint ) ); 692cdf0e10cSrcweir } 693cdf0e10cSrcweir 694cdf0e10cSrcweir return bInside; 695cdf0e10cSrcweir } 696cdf0e10cSrcweir // ----------------------------------------------------------------------------- 697cdf0e10cSrcweir 698cdf0e10cSrcweir Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleAt( const awt::Point& rPoint ) 699cdf0e10cSrcweir throw (RuntimeException) 700cdf0e10cSrcweir { 701cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 702cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 703cdf0e10cSrcweir 704cdf0e10cSrcweir Reference< XAccessible > xChild; 705cdf0e10cSrcweir if ( m_pListBoxHelper ) 706cdf0e10cSrcweir { 707cdf0e10cSrcweir UpdateVisibleLineCount(); 708cdf0e10cSrcweir if ( contains( rPoint ) && m_nVisibleLineCount > 0 ) 709cdf0e10cSrcweir { 710cdf0e10cSrcweir Point aPos = VCLPoint( rPoint ); 711cdf0e10cSrcweir sal_uInt16 nEndPos = m_pListBoxHelper->GetTopEntry() + (sal_uInt16)m_nVisibleLineCount; 712cdf0e10cSrcweir for ( sal_uInt16 i = m_pListBoxHelper->GetTopEntry(); i < nEndPos; ++i ) 713cdf0e10cSrcweir { 714cdf0e10cSrcweir if ( m_pListBoxHelper->GetBoundingRectangle(i).IsInside( aPos ) ) 715cdf0e10cSrcweir { 716cdf0e10cSrcweir xChild = getAccessibleChild(i); 717cdf0e10cSrcweir break; 718cdf0e10cSrcweir } 719cdf0e10cSrcweir } 720cdf0e10cSrcweir } 721cdf0e10cSrcweir } 722cdf0e10cSrcweir 723cdf0e10cSrcweir return xChild; 724cdf0e10cSrcweir } 725cdf0e10cSrcweir // ----------------------------------------------------------------------------- 726cdf0e10cSrcweir 727cdf0e10cSrcweir //===== XServiceInfo ========================================================== 728cdf0e10cSrcweir 729cdf0e10cSrcweir ::rtl::OUString VCLXAccessibleList::getImplementationName (void) 730cdf0e10cSrcweir throw (RuntimeException) 731cdf0e10cSrcweir { 732cdf0e10cSrcweir return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleList")); 733cdf0e10cSrcweir } 734cdf0e10cSrcweir // ----------------------------------------------------------------------------- 735cdf0e10cSrcweir 736cdf0e10cSrcweir Sequence< ::rtl::OUString > VCLXAccessibleList::getSupportedServiceNames (void) 737cdf0e10cSrcweir throw (RuntimeException) 738cdf0e10cSrcweir { 739cdf0e10cSrcweir Sequence< ::rtl::OUString > aNames = VCLXAccessibleComponent::getSupportedServiceNames(); 740cdf0e10cSrcweir sal_Int32 nLength = aNames.getLength(); 741cdf0e10cSrcweir aNames.realloc( nLength + 1 ); 742cdf0e10cSrcweir aNames[nLength] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleList")); 743cdf0e10cSrcweir return aNames; 744cdf0e10cSrcweir } 745cdf0e10cSrcweir // ----------------------------------------------------------------------------- 746cdf0e10cSrcweir 747cdf0e10cSrcweir void VCLXAccessibleList::UpdateVisibleLineCount() 748cdf0e10cSrcweir { 749cdf0e10cSrcweir if ( m_pListBoxHelper ) 750cdf0e10cSrcweir { 751cdf0e10cSrcweir if ( (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ) 752cdf0e10cSrcweir m_nVisibleLineCount = m_pListBoxHelper->GetDisplayLineCount(); 753cdf0e10cSrcweir else 754cdf0e10cSrcweir { 755cdf0e10cSrcweir sal_uInt16 nCols = 0, 756cdf0e10cSrcweir nLines = 0; 757cdf0e10cSrcweir m_pListBoxHelper->GetMaxVisColumnsAndLines (nCols, nLines); 758cdf0e10cSrcweir m_nVisibleLineCount = nLines; 759cdf0e10cSrcweir } 760cdf0e10cSrcweir } 761cdf0e10cSrcweir } 762cdf0e10cSrcweir 763cdf0e10cSrcweir // ----------------------------------------------------------------------------- 764cdf0e10cSrcweir void VCLXAccessibleList::UpdateEntryRange_Impl() 765cdf0e10cSrcweir { 766cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 767cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 768cdf0e10cSrcweir 769cdf0e10cSrcweir sal_Int32 nTop = m_nLastTopEntry; 770cdf0e10cSrcweir 771cdf0e10cSrcweir if ( m_pListBoxHelper ) 772cdf0e10cSrcweir nTop = m_pListBoxHelper->GetTopEntry(); 773cdf0e10cSrcweir if ( nTop != m_nLastTopEntry ) 774cdf0e10cSrcweir { 775cdf0e10cSrcweir UpdateVisibleLineCount(); 776cdf0e10cSrcweir sal_Int32 nBegin = Min( m_nLastTopEntry, nTop ); 777cdf0e10cSrcweir sal_Int32 nEnd = Max( m_nLastTopEntry + m_nVisibleLineCount, nTop + m_nVisibleLineCount ); 778cdf0e10cSrcweir for (sal_uInt16 i = static_cast<sal_uInt16>(nBegin); (i <= static_cast<sal_uInt16>(nEnd)); ++i) 779cdf0e10cSrcweir { 780cdf0e10cSrcweir sal_Bool bVisible = ( i >= nTop && i < ( nTop + m_nVisibleLineCount ) ); 781cdf0e10cSrcweir Reference< XAccessible > xHold; 782cdf0e10cSrcweir if ( i < m_aAccessibleChildren.size() ) 783cdf0e10cSrcweir xHold = m_aAccessibleChildren[i]; 784cdf0e10cSrcweir else if ( bVisible ) 785cdf0e10cSrcweir xHold = CreateChild(i); 786cdf0e10cSrcweir 787cdf0e10cSrcweir if ( xHold.is() ) 788cdf0e10cSrcweir static_cast< VCLXAccessibleListItem* >( xHold.get() )->SetVisible( m_bVisible && bVisible ); 789cdf0e10cSrcweir } 790cdf0e10cSrcweir } 791cdf0e10cSrcweir 792cdf0e10cSrcweir m_nLastTopEntry = nTop; 793cdf0e10cSrcweir } 794cdf0e10cSrcweir // ----------------------------------------------------------------------------- 795cdf0e10cSrcweir sal_Bool VCLXAccessibleList::checkEntrySelected(sal_uInt16 _nPos,Any& _rNewValue,Reference< XAccessible >& _rxNewAcc) 796cdf0e10cSrcweir { 797cdf0e10cSrcweir OSL_ENSURE(m_pListBoxHelper,"Helper is not valid!"); 798cdf0e10cSrcweir sal_Bool bNowSelected = sal_False; 799cdf0e10cSrcweir if ( m_pListBoxHelper ) 800cdf0e10cSrcweir { 801cdf0e10cSrcweir bNowSelected = m_pListBoxHelper->IsEntryPosSelected (_nPos); 802cdf0e10cSrcweir if ( bNowSelected ) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir _rxNewAcc = CreateChild(_nPos); 805cdf0e10cSrcweir _rNewValue <<= _rxNewAcc; 806cdf0e10cSrcweir } 807cdf0e10cSrcweir } 808cdf0e10cSrcweir return bNowSelected; 809cdf0e10cSrcweir } 810cdf0e10cSrcweir // ----------------------------------------------------------------------------- 811cdf0e10cSrcweir 812cdf0e10cSrcweir void VCLXAccessibleList::UpdateSelection_Impl(sal_uInt16) 813cdf0e10cSrcweir { 814cdf0e10cSrcweir uno::Any aOldValue, aNewValue; 815cdf0e10cSrcweir 816cdf0e10cSrcweir { 817cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 818cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 819cdf0e10cSrcweir Reference< XAccessible > xNewAcc; 820cdf0e10cSrcweir 821cdf0e10cSrcweir if ( m_pListBoxHelper ) 822cdf0e10cSrcweir { 823cdf0e10cSrcweir sal_uInt16 i=0; 82421075d77SSteve Yin m_nCurSelectedPos = LISTBOX_ENTRY_NOTFOUND; 825cdf0e10cSrcweir for ( ListItems::iterator aIter = m_aAccessibleChildren.begin(); 826cdf0e10cSrcweir aIter != m_aAccessibleChildren.end(); ++aIter,++i) 827cdf0e10cSrcweir { 828cdf0e10cSrcweir Reference< XAccessible > xHold = *aIter; 829cdf0e10cSrcweir if ( xHold.is() ) 830cdf0e10cSrcweir { 831cdf0e10cSrcweir VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >( xHold.get() ); 832cdf0e10cSrcweir // Retrieve the item's index from the list entry. 833cdf0e10cSrcweir sal_Bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i); 83421075d77SSteve Yin if (bNowSelected) 83521075d77SSteve Yin m_nCurSelectedPos = i; 836cdf0e10cSrcweir 837cdf0e10cSrcweir if ( bNowSelected && !pItem->IsSelected() ) 838cdf0e10cSrcweir { 839cdf0e10cSrcweir xNewAcc = *aIter; 840cdf0e10cSrcweir aNewValue <<= xNewAcc; 841cdf0e10cSrcweir } 842cdf0e10cSrcweir else if ( pItem->IsSelected() ) 843cdf0e10cSrcweir m_nLastSelectedPos = i; 844cdf0e10cSrcweir 845cdf0e10cSrcweir pItem->SetSelected( bNowSelected ); 846cdf0e10cSrcweir } 847cdf0e10cSrcweir else 848cdf0e10cSrcweir { // it could happen that a child was not created before 849cdf0e10cSrcweir checkEntrySelected(i,aNewValue,xNewAcc); 850cdf0e10cSrcweir } 851cdf0e10cSrcweir } 852cdf0e10cSrcweir sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount(); 853cdf0e10cSrcweir if ( i < nCount ) // here we have to check the if any other listbox entry is selected 854cdf0e10cSrcweir { 855cdf0e10cSrcweir for (; i < nCount && !checkEntrySelected(i,aNewValue,xNewAcc) ;++i ) 856cdf0e10cSrcweir ; 857cdf0e10cSrcweir } 858cdf0e10cSrcweir if ( xNewAcc.is() && GetWindow()->HasFocus() ) 859cdf0e10cSrcweir { 860cdf0e10cSrcweir if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND ) 861cdf0e10cSrcweir aOldValue <<= getAccessibleChild( (sal_Int32)m_nLastSelectedPos ); 862cdf0e10cSrcweir aNewValue <<= xNewAcc; 863cdf0e10cSrcweir } 864cdf0e10cSrcweir } 865cdf0e10cSrcweir } 86621075d77SSteve Yin if (!m_pListBoxHelper->IsInDropDown()) 86721075d77SSteve Yin { 86821075d77SSteve Yin } 86921075d77SSteve Yin else 87021075d77SSteve Yin { 871cdf0e10cSrcweir if ( aNewValue.hasValue() || aOldValue.hasValue() ) 872cdf0e10cSrcweir NotifyAccessibleEvent( 873cdf0e10cSrcweir AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, 874cdf0e10cSrcweir aOldValue, 875cdf0e10cSrcweir aNewValue ); 87621075d77SSteve Yin //the SELECTION_CHANGED is not necessary 87721075d77SSteve Yin //NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); 87821075d77SSteve Yin } 879cdf0e10cSrcweir } 880cdf0e10cSrcweir 881cdf0e10cSrcweir // ----------------------------------------------------------------------------- 882cdf0e10cSrcweir // XAccessibleSelection 883cdf0e10cSrcweir // ----------------------------------------------------------------------------- 884cdf0e10cSrcweir void SAL_CALL VCLXAccessibleList::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) 885cdf0e10cSrcweir { 886cdf0e10cSrcweir sal_Bool bNotify = sal_False; 887cdf0e10cSrcweir 888cdf0e10cSrcweir { 889cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 890cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 891cdf0e10cSrcweir 892cdf0e10cSrcweir if ( m_pListBoxHelper ) 893cdf0e10cSrcweir { 894cdf0e10cSrcweir checkSelection_Impl(nChildIndex,*m_pListBoxHelper,sal_False); 895cdf0e10cSrcweir 896cdf0e10cSrcweir m_pListBoxHelper->SelectEntryPos( (sal_uInt16)nChildIndex, sal_True ); 897cdf0e10cSrcweir // call the select handler, don't handle events in this time 898cdf0e10cSrcweir m_bDisableProcessEvent = true; 899cdf0e10cSrcweir m_pListBoxHelper->Select(); 900cdf0e10cSrcweir m_bDisableProcessEvent = false; 901cdf0e10cSrcweir bNotify = sal_True; 902cdf0e10cSrcweir } 903cdf0e10cSrcweir } 904cdf0e10cSrcweir 905cdf0e10cSrcweir if ( bNotify ) 906cdf0e10cSrcweir UpdateSelection_Impl(); 907cdf0e10cSrcweir } 908cdf0e10cSrcweir // ----------------------------------------------------------------------------- 909cdf0e10cSrcweir sal_Bool SAL_CALL VCLXAccessibleList::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) 910cdf0e10cSrcweir { 911cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 912cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 913cdf0e10cSrcweir 914cdf0e10cSrcweir sal_Bool bRet = sal_False; 915cdf0e10cSrcweir if ( m_pListBoxHelper ) 916cdf0e10cSrcweir { 917cdf0e10cSrcweir checkSelection_Impl(nChildIndex,*m_pListBoxHelper,sal_False); 918cdf0e10cSrcweir 919cdf0e10cSrcweir bRet = m_pListBoxHelper->IsEntryPosSelected( (sal_uInt16)nChildIndex ); 920cdf0e10cSrcweir } 921cdf0e10cSrcweir return bRet; 922cdf0e10cSrcweir } 923cdf0e10cSrcweir // ----------------------------------------------------------------------------- 924cdf0e10cSrcweir void SAL_CALL VCLXAccessibleList::clearAccessibleSelection( ) throw (RuntimeException) 925cdf0e10cSrcweir { 926cdf0e10cSrcweir sal_Bool bNotify = sal_False; 927cdf0e10cSrcweir 928cdf0e10cSrcweir { 929cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 930cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 931cdf0e10cSrcweir 932cdf0e10cSrcweir if ( m_pListBoxHelper ) 933cdf0e10cSrcweir { 934cdf0e10cSrcweir m_pListBoxHelper->SetNoSelection(); 935cdf0e10cSrcweir bNotify = sal_True; 936cdf0e10cSrcweir } 937cdf0e10cSrcweir } 938cdf0e10cSrcweir 939cdf0e10cSrcweir if ( bNotify ) 940cdf0e10cSrcweir UpdateSelection_Impl(); 941cdf0e10cSrcweir } 942cdf0e10cSrcweir // ----------------------------------------------------------------------------- 943cdf0e10cSrcweir void SAL_CALL VCLXAccessibleList::selectAllAccessibleChildren( ) throw (RuntimeException) 944cdf0e10cSrcweir { 945cdf0e10cSrcweir sal_Bool bNotify = sal_False; 946cdf0e10cSrcweir 947cdf0e10cSrcweir { 948cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 949cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 950cdf0e10cSrcweir 951cdf0e10cSrcweir if ( m_pListBoxHelper ) 952cdf0e10cSrcweir { 953cdf0e10cSrcweir sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount(); 954cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCount; ++i ) 955cdf0e10cSrcweir m_pListBoxHelper->SelectEntryPos( i, sal_True ); 956cdf0e10cSrcweir // call the select handler, don't handle events in this time 957cdf0e10cSrcweir m_bDisableProcessEvent = true; 958cdf0e10cSrcweir m_pListBoxHelper->Select(); 959cdf0e10cSrcweir m_bDisableProcessEvent = false; 960cdf0e10cSrcweir bNotify = sal_True; 961cdf0e10cSrcweir } 962cdf0e10cSrcweir } 963cdf0e10cSrcweir 964cdf0e10cSrcweir if ( bNotify ) 965cdf0e10cSrcweir UpdateSelection_Impl(); 966cdf0e10cSrcweir } 967cdf0e10cSrcweir // ----------------------------------------------------------------------------- 968cdf0e10cSrcweir sal_Int32 SAL_CALL VCLXAccessibleList::getSelectedAccessibleChildCount( ) throw (RuntimeException) 969cdf0e10cSrcweir { 970cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 971cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 972cdf0e10cSrcweir 973cdf0e10cSrcweir sal_Int32 nCount = 0; 974cdf0e10cSrcweir if ( m_pListBoxHelper ) 975cdf0e10cSrcweir nCount = m_pListBoxHelper->GetSelectEntryCount(); 976cdf0e10cSrcweir return nCount; 977cdf0e10cSrcweir } 978cdf0e10cSrcweir // ----------------------------------------------------------------------------- 979cdf0e10cSrcweir Reference< XAccessible > SAL_CALL VCLXAccessibleList::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) 980cdf0e10cSrcweir { 981cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 982cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 983cdf0e10cSrcweir 984cdf0e10cSrcweir if ( m_pListBoxHelper ) 985cdf0e10cSrcweir { 986cdf0e10cSrcweir checkSelection_Impl(nSelectedChildIndex,*m_pListBoxHelper,sal_True); 987cdf0e10cSrcweir return getAccessibleChild( (sal_Int32)m_pListBoxHelper->GetSelectEntryPos( (sal_uInt16)nSelectedChildIndex ) ); 988cdf0e10cSrcweir } 989cdf0e10cSrcweir 990cdf0e10cSrcweir return NULL; 991cdf0e10cSrcweir } 992cdf0e10cSrcweir // ----------------------------------------------------------------------------- 993cdf0e10cSrcweir void SAL_CALL VCLXAccessibleList::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) 994cdf0e10cSrcweir { 995cdf0e10cSrcweir sal_Bool bNotify = sal_False; 996cdf0e10cSrcweir 997cdf0e10cSrcweir { 998cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 999cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir if ( m_pListBoxHelper ) 1002cdf0e10cSrcweir { 1003cdf0e10cSrcweir checkSelection_Impl(nSelectedChildIndex,*m_pListBoxHelper,sal_False); 1004cdf0e10cSrcweir 1005cdf0e10cSrcweir m_pListBoxHelper->SelectEntryPos( (sal_uInt16)nSelectedChildIndex, sal_False ); 1006cdf0e10cSrcweir // call the select handler, don't handle events in this time 1007cdf0e10cSrcweir m_bDisableProcessEvent = true; 1008cdf0e10cSrcweir m_pListBoxHelper->Select(); 1009cdf0e10cSrcweir m_bDisableProcessEvent = false; 1010cdf0e10cSrcweir bNotify = sal_True; 1011cdf0e10cSrcweir } 1012cdf0e10cSrcweir } 1013cdf0e10cSrcweir 1014cdf0e10cSrcweir if ( bNotify ) 1015cdf0e10cSrcweir UpdateSelection_Impl(); 1016cdf0e10cSrcweir } 1017cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1018cdf0e10cSrcweir // accessibility::XAccessibleComponent 1019cdf0e10cSrcweir awt::Rectangle VCLXAccessibleList::implGetBounds() throw (uno::RuntimeException) 1020cdf0e10cSrcweir { 1021cdf0e10cSrcweir awt::Rectangle aBounds ( 0, 0, 0, 0 ); 1022cdf0e10cSrcweir if ( m_pListBoxHelper 1023cdf0e10cSrcweir && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ) 1024cdf0e10cSrcweir { 1025cdf0e10cSrcweir if ( m_pListBoxHelper->IsInDropDown() ) 1026cdf0e10cSrcweir aBounds = AWTRectangle(m_pListBoxHelper->GetDropDownPosSizePixel()); 1027cdf0e10cSrcweir } 1028cdf0e10cSrcweir else 1029cdf0e10cSrcweir { 1030cdf0e10cSrcweir // a list has the same bounds as his parent but starts at (0,0) 1031cdf0e10cSrcweir aBounds = VCLXAccessibleComponent::implGetBounds(); 1032cdf0e10cSrcweir aBounds.X = 0; 1033cdf0e10cSrcweir aBounds.Y = 0; 1034cdf0e10cSrcweir if ( m_aBoxType == COMBOBOX ) 1035cdf0e10cSrcweir { 1036cdf0e10cSrcweir ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); 1037cdf0e10cSrcweir if ( pBox ) 1038cdf0e10cSrcweir { 1039cdf0e10cSrcweir Size aSize = pBox->GetSubEdit()->GetSizePixel(); 104021075d77SSteve Yin aBounds.Y += aSize.Height(); 1041cdf0e10cSrcweir aBounds.Height -= aSize.Height(); 1042cdf0e10cSrcweir } 1043cdf0e10cSrcweir } 1044cdf0e10cSrcweir } 1045cdf0e10cSrcweir return aBounds; 1046cdf0e10cSrcweir } 1047cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1048cdf0e10cSrcweir 1049cdf0e10cSrcweir awt::Point VCLXAccessibleList::getLocationOnScreen( ) throw (uno::RuntimeException) 1050cdf0e10cSrcweir { 1051cdf0e10cSrcweir vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 1052cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 1053cdf0e10cSrcweir 1054cdf0e10cSrcweir awt::Point aPos; 1055cdf0e10cSrcweir if ( m_pListBoxHelper 1056cdf0e10cSrcweir && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ) 1057cdf0e10cSrcweir { 1058cdf0e10cSrcweir if ( m_pListBoxHelper->IsInDropDown() ) 1059cdf0e10cSrcweir aPos = AWTPoint(m_pListBoxHelper->GetDropDownPosSizePixel().TopLeft()); 1060cdf0e10cSrcweir } 1061cdf0e10cSrcweir else 1062cdf0e10cSrcweir { 1063cdf0e10cSrcweir aPos = VCLXAccessibleComponent::getLocationOnScreen(); 1064cdf0e10cSrcweir if ( m_aBoxType == COMBOBOX ) 1065cdf0e10cSrcweir { 1066cdf0e10cSrcweir ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); 1067cdf0e10cSrcweir if ( pBox ) 1068cdf0e10cSrcweir { 106921075d77SSteve Yin aPos.Y += pBox->GetSubEdit()->GetSizePixel().Height(); 1070cdf0e10cSrcweir } 1071cdf0e10cSrcweir } 1072cdf0e10cSrcweir } 1073cdf0e10cSrcweir return aPos; 1074cdf0e10cSrcweir } 1075cdf0e10cSrcweir // ----------------------------------------------------------------------------- 107621075d77SSteve Yin sal_Bool VCLXAccessibleList::IsInDropDown() 107721075d77SSteve Yin { 107821075d77SSteve Yin return m_pListBoxHelper->IsInDropDown(); 107921075d77SSteve Yin } 108021075d77SSteve Yin // ----------------------------------------------------------------------------- 108121075d77SSteve Yin void VCLXAccessibleList::HandleDropOpen() 108221075d77SSteve Yin { 108321075d77SSteve Yin if ( !m_bDisableProcessEvent ) 108421075d77SSteve Yin UpdateSelection_Impl(); 108521075d77SSteve Yin if (m_nCurSelectedPos != LISTBOX_ENTRY_NOTFOUND && 108621075d77SSteve Yin m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND) 108721075d77SSteve Yin { 108821075d77SSteve Yin Reference< XAccessible > xChild = getAccessibleChild(m_nCurSelectedPos); 108921075d77SSteve Yin if(xChild.is()) 109021075d77SSteve Yin { 109121075d77SSteve Yin uno::Any aNewValue; 109221075d77SSteve Yin aNewValue <<= xChild; 109321075d77SSteve Yin NotifyAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, uno::Any(), aNewValue ); 109421075d77SSteve Yin } 109521075d77SSteve Yin } 109621075d77SSteve Yin } 1097