25#include <com/sun/star/accessibility/AccessibleStateType.hpp>
26#include <com/sun/star/accessibility/AccessibleEventId.hpp>
27#include <com/sun/star/accessibility/AccessibleRole.hpp>
28#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
41 : ImplInheritanceHelper (pVCLWindow),
43 m_bIsDropDownBox (bIsDropDownBox)
59 switch ( rVclWindowEvent.
GetId() )
61 case VclEventId::WindowShow:
62 case VclEventId::WindowHide:
71 if ( ( pComboBox !=
nullptr ) && ( pChildWindow !=
nullptr ) )
72 if (pChildWindow == pComboBox->GetSubEdit())
74 if (rVclWindowEvent.
GetId() == VclEventId::WindowShow)
87 NotifyAccessibleEvent (
88 AccessibleEventId::CHILD,
89 aOldValue, aNewValue);
97 VCLXAccessibleComponent::ProcessWindowChildEvent (rVclWindowEvent);
103 switch ( rVclWindowEvent.
GetId() )
105 case VclEventId::DropdownSelect:
106 case VclEventId::ListboxSelect:
110 if ( pList ==
nullptr )
115 if ( pList !=
nullptr )
121 NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED,
Any(),
Any());
127 case VclEventId::DropdownOpen:
130 if ( pList ==
nullptr )
135 if ( pList !=
nullptr )
142 case VclEventId::DropdownClose:
145 if ( pList ==
nullptr )
150 if ( pList !=
nullptr )
155 if( pWindow && (pWindow->HasFocus() || pWindow->HasChildPathFocus()) )
157 Any aOldValue, aNewValue;
158 aNewValue <<= AccessibleStateType::FOCUSED;
159 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
163 case VclEventId::ComboboxSelect:
166 if (pList !=
nullptr &&
m_xText.is())
168 Reference<XAccessibleText> xText (
m_xText->getAccessibleContext(), UNO_QUERY);
171 OUString sText = xText->getSelectedText();
172 if ( sText.isEmpty() )
173 sText = xText->getText();
177 NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED,
Any(),
Any());
185 case VclEventId::ListboxDoubleClick:
186 case VclEventId::ListboxScrolled:
188 case VclEventId::ListboxItemAdded:
189 case VclEventId::ListboxItemRemoved:
190 case VclEventId::ComboboxItemAdded:
191 case VclEventId::ComboboxItemRemoved:
195 if ( pList ==
nullptr )
200 if ( pList !=
nullptr )
206 case VclEventId::ComboboxDeselect:
213 if (pList !=
nullptr &&
m_xText.is())
215 Reference<XAccessibleText> xText (
m_xText->getAccessibleContext(), UNO_QUERY);
218 OUString sText = xText->getSelectedText();
219 if ( sText.isEmpty() )
220 sText = xText->getText();
227 case VclEventId::EditModify:
228 case VclEventId::EditSelectionChanged:
229 case VclEventId::EditCaretChanged:
237 Reference<XAccessibleContext> xContext =
m_xText->getAccessibleContext();
239 if (pEdit !=
nullptr)
245 VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
253 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
263 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
291 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
294 throw IndexOutOfBoundsException();
307 pList->SetIndexInParent (
i);
320 if (pComboBox!=
nullptr && pComboBox->GetSubEdit()!=
nullptr)
323 pComboBox->GetSubEdit()->SetAccessibleName(getAccessibleName());
324 m_xText = pComboBox->GetSubEdit()->GetAccessible();
339 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
346 return AccessibleRole::COMBO_BOX;
348 return AccessibleRole::PANEL;
355 ::osl::Guard< ::osl::Mutex> aGuard (GetMutex());
364 bool bNotify =
false;
368 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
371 throw css::lang::IndexOutOfBoundsException(
372 (
"VCLXAccessibleBox::doAccessibleAction: index "
373 + OUString::number(
nIndex) +
" not among 0.."
380 if (pComboBox !=
nullptr)
382 pComboBox->ToggleDropDown();
389 if (pListBox !=
nullptr)
391 pListBox->ToggleDropDown();
398 NotifyAccessibleEvent (AccessibleEventId::ACTION_CHANGED,
Any(),
Any());
405 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
407 throw css::lang::IndexOutOfBoundsException();
414 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
416 Reference< XAccessibleKeyBinding > xRet;
419 throw css::lang::IndexOutOfBoundsException();
429 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
435 Reference<XAccessibleText> xText (
m_xText->getAccessibleContext(), UNO_QUERY);
438 OUString sText = xText->getText();
453 aAny <<= xName->getAccessibleName();
465 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
468 bool bValid = (aNumber >>= fValue);
493 VCLXAccessibleComponent::FillAccessibleStateSet(rStateSet);
497 sal_Int32 nEntryCount = 0;
499 if (pComboBox !=
nullptr)
501 Edit* pSubEdit = pComboBox->GetSubEdit();
504 nEntryCount = pComboBox->GetEntryCount();
506 if ( sText.isEmpty() && nEntryCount > 0 )
507 rStateSet |= AccessibleStateType::INDETERMINATE;
512 if (pListBox !=
nullptr && pListBox->GetEntryCount() > 0)
514 sal_Int32 nSelectedEntryCount = pListBox->GetSelectedEntryCount();
515 if ( nSelectedEntryCount == 0)
516 rStateSet |= AccessibleStateType::INDETERMINATE;
virtual OUString GetText() const override
bool m_bHasListChild
This flag specifies whether an object has a list as child regardless of whether that child being curr...
virtual void ProcessWindowChildEvent(const VclWindowEvent &rVclWindowEvent) override
virtual css::uno::Any SAL_CALL getMinimumValue() override
virtual bool IsValid() const =0
Returns true when the object is valid.
css::uno::Reference< css::accessibility::XAccessible > m_xText
The child that represents the text field if there is one.
virtual css::uno::Any SAL_CALL getCurrentValue() override
virtual void ProcessWindowEvent(const VclWindowEvent &rVclWindowEvent) override
virtual OUString SAL_CALL getAccessibleActionDescription(sal_Int32 nIndex) override
The returned string is associated with resource RID_STR_ACC_ACTION_TOGGLEPOPUP.
virtual sal_Bool SAL_CALL doAccessibleAction(sal_Int32 nIndex) override
The action for drop down boxes lets the user toggle the visibility of the popup menu.
css::uno::Reference< css::accessibility::XAccessible > m_xList
The child that contains the items of this box.
virtual css::uno::Any SAL_CALL getMinimumIncrement() override
BoxType m_aBoxType
Specifies whether the box is a combo box or a list box.
bool m_bHasTextChild
This flag specifies whether an object has a text field as child regardless of whether that child bein...
sal_Int64 SAL_CALL getAccessibleChildCount() final override
Each object has one or two children: an optional text field and the actual list.
virtual sal_Bool SAL_CALL setCurrentValue(const css::uno::Any &aNumber) override
sal_Int16 SAL_CALL getAccessibleRole() override
The role is always AccessibleRole::COMBO_BOX.
sal_Int64 implGetAccessibleChildCount()
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
virtual void FillAccessibleStateSet(sal_Int64 &rStateSet) override
virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding(sal_Int32 nIndex) override
No keybinding returned so far.
css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 i) override
For drop down list boxes the text field is a not editable VCLXAccessibleTextField,...
virtual css::uno::Any SAL_CALL getMaximumValue() override
virtual sal_Int32 SAL_CALL getAccessibleActionCount() final override
There is one action for drop down boxes and none for others.
VCLXAccessibleBox(VCLXWindow *pVCLXindow, BoxType aType, bool bIsDropDownBox)
The constructor is initialized with the box type which may be either COMBOBOX or LISTBOX and a flag i...
bool m_bIsDropDownBox
Specifies whether the box is a drop down box and thus has an action.
virtual void ProcessWindowEvent(const VclWindowEvent &rVclWindowEvent) override
Base class for the list contained in list- and combo boxes.
bool IsInDropDown() const
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int64 nSelectedChildIndex) override
void UpdateSelection(std::u16string_view sTextOfSelectedItem)
Called on reception of selection events this method checks all known list items for a possible change...
virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount() override
void UpdateSelection_Acc(std::u16string_view sTextOfSelectedItem, bool b_IsDropDownList)
virtual void ProcessWindowEvent(const VclWindowEvent &rVclWindowEvent) override
Process some of the events and delegate the rest to the base classes.
This class represents non editable text fields.
constexpr OUStringLiteral RID_STR_ACC_ACTION_TOGGLEPOPUP