void VCLXAccessibleList::disposeChildren()
{ // Dispose all items in the list. for (rtl::Reference<VCLXAccessibleListItem>& rxChild : m_aAccessibleChildren)
{ if (rxChild.is())
rxChild->dispose();
}
VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); // check if our list should be visible if ( m_pListBoxHelper
&& (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN
&& !m_pListBoxHelper->IsInDropDown() )
{
rStateSet &= ~AccessibleStateType::VISIBLE;
rStateSet &= ~AccessibleStateType::SHOWING;
m_bVisible = false;
}
// Both the combo box and list box are handled identical in the // following but for some reason they don't have a common interface for // the methods used. if ( m_pListBoxHelper )
{ if ( m_pListBoxHelper->IsMultiSelectionEnabled() )
rStateSet |= AccessibleStateType::MULTI_SELECTABLE;
rStateSet |= AccessibleStateType::FOCUSABLE; // All children are transient.
rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
}
}
rxChild->SetSelected(bNowSelected);
} else
{ // it could happen that a child was not created before
checkEntrySelected(i,aNewValue,xNewAcc);
}
++i;
} const sal_Int32 nCount = m_pListBoxHelper->GetEntryCount(); if ( i < nCount ) // here we have to check the if any other listbox entry is selected
{ for (; i < nCount && !checkEntrySelected(i,aNewValue,xNewAcc) ;++i )
;
} if ( xNewAcc.is() && GetWindow()->HasFocus() )
{ if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND )
aOldValue <<= getAccessibleChild( m_nLastSelectedPos );
aNewValue <<= Reference< XAccessible >(xNewAcc);
}
}
}
// since an active descendant is the UI element with keyboard focus, only send // ACTIVE_DESCENDANT_CHANGED if the listbox/combobox has focus
vcl::Window* pWindow = GetWindow();
assert(pWindow); constbool bFocused = pWindow->HasChildPathFocus();
if (m_aBoxType == COMBOBOX)
{ //VCLXAccessibleDropDownComboBox //when in list is dropped down, xText = NULL if (bHasDropDownList && m_pListBoxHelper && m_pListBoxHelper->IsInDropDown())
{ if ( aNewValue.hasValue() || aOldValue.hasValue() )
{ if (bFocused)
{
NotifyAccessibleEvent(
AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
aOldValue,
aNewValue );
}
void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
{ // Create a reference to this object to prevent an early release of the // listbox (VclEventId::ObjectDying).
Reference< XAccessible > xHoldAlive = this;
switch ( rVclWindowEvent.GetId() )
{ case VclEventId::DropdownOpen:
notifyVisibleStates(true); break; case VclEventId::DropdownClose:
notifyVisibleStates(false); break; case VclEventId::ListboxScrolled:
UpdateEntryRange_Impl(); break;
// The selection events VclEventId::ComboboxSelect and // VclEventId::ComboboxDeselect are not handled here because here we // have no access to the edit field. Its text is necessary to // identify the currently selected item.
case VclEventId::ListboxItemRemoved: case VclEventId::ComboboxItemRemoved: case VclEventId::ListboxItemAdded: case VclEventId::ComboboxItemAdded:
HandleChangedItemList(); break; case VclEventId::ControlGetFocus:
{
VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); // Added by IBM Symphony Acc team to handle the list item focus when List control get focus bool b_IsDropDownList = true; if (m_pListBoxHelper)
b_IsDropDownList = ((m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN); if ( m_aBoxType == LISTBOX && !b_IsDropDownList )
{ if ( m_pListBoxHelper )
{
uno::Any aOldValue,
aNewValue;
sal_Int32 nPos = m_nCurSelectedPos;
/** To find out which item is currently selected and to update the SELECTED stateoftheassociatedaccessibilityobjectsaccordinglyweexploitthe factthatthe
*/ void VCLXAccessibleList::UpdateSelection (std::u16string_view sTextOfSelectedItem)
{ if ( m_aBoxType != COMBOBOX ) return;
VclPtr< ComboBox > pBox = GetAs< ComboBox >(); if ( pBox )
{ // Find the index of the selected item inside the VCL control...
sal_Int32 nIndex = pBox->GetEntryPos(sTextOfSelectedItem); // ...and then find the associated accessibility object. if ( nIndex == LISTBOX_ENTRY_NOTFOUND )
nIndex = 0;
UpdateSelection_Impl(nIndex);
}
}
if ( o3tl::make_unsigned(nPos) >= m_aAccessibleChildren.size() )
{
m_aAccessibleChildren.resize(nPos + 1);
// insert into the container
xChild = new VCLXAccessibleListItem(nPos, this);
m_aAccessibleChildren[nPos] = xChild;
} else
{
xChild = m_aAccessibleChildren[nPos]; // check if position is empty and can be used else we have to adjust all entries behind this if (!xChild.is())
{
xChild = new VCLXAccessibleListItem(nPos, this);
m_aAccessibleChildren[nPos] = xChild;
}
}
if ( xChild.is() )
{ // Just add the SELECTED state. bool bNowSelected = false; if ( m_pListBoxHelper )
bNowSelected = m_pListBoxHelper->IsEntryPosSelected(nPos); if (bNowSelected)
m_nCurSelectedPos = nPos;
xChild->SetSelected(bNowSelected);
if ( m_pListBoxHelper )
{
sal_Int32 i=0;
m_nCurSelectedPos = LISTBOX_ENTRY_NOTFOUND; for (const rtl::Reference<VCLXAccessibleListItem>& rxChild : m_aAccessibleChildren)
{ if (rxChild.is())
{ // Retrieve the item's index from the list entry. bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i); if (bNowSelected)
m_nCurSelectedPos = i;
rxChild->SetSelected(bNowSelected);
} else
{ // it could happen that a child was not created before
checkEntrySelected(i,aNewValue,xNewAcc);
}
++i;
} const sal_Int32 nCount = m_pListBoxHelper->GetEntryCount(); if ( i < nCount ) // here we have to check the if any other listbox entry is selected
{ for (; i < nCount && !checkEntrySelected(i,aNewValue,xNewAcc) ;++i )
;
} if ( xNewAcc.is() && GetWindow()->HasFocus() )
{ if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND )
aOldValue <<= getAccessibleChild( m_nLastSelectedPos );
aNewValue <<= Reference< XAccessible >(xNewAcc);
} if (m_pListBoxHelper->IsInDropDown())
{ if ( aNewValue.hasValue() || aOldValue.hasValue() )
NotifyAccessibleEvent(
AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
aOldValue,
aNewValue ); //the SELECTION_CHANGED is not necessary //NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
}
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.