25#include <com/sun/star/awt/Rectangle.hpp>
26#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
27#include <com/sun/star/accessibility/AccessibleRole.hpp>
28#include <com/sun/star/accessibility/AccessibleStateType.hpp>
29#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
40#define ACCESSIBLE_ACTION_COUNT 1
45 void checkActionIndex_Impl( sal_Int32 _nIndex )
49 throw css::lang::IndexOutOfBoundsException();
72 , m_pTreeListBox( &_rListBox )
73 , m_pSvLBoxEntry(&rEntry)
75 , m_wListBox(&rListBox)
76 , m_rListBox(rListBox)
94 OSL_ENSURE( rEvent.GetWindow() ,
"AccessibleListBoxEntry::WindowEventListener: no event window!" );
95 OSL_ENSURE( rEvent.GetWindow() == m_pTreeListBox,
"AccessibleListBoxEntry::WindowEventListener: where did this come from?" );
97 if ( m_pTreeListBox ==
nullptr )
100 switch ( rEvent.GetId() )
102 case VclEventId::ObjectDying :
104 if ( m_pTreeListBox )
106 m_pTreeListBox =
nullptr;
115 const css::uno::Any& _aOldValue,
116 const css::uno::Any& _aNewValue )
119 AccessibleEventObject aEventObj( xSource, _nEventId, _aNewValue, _aOldValue, -1 );
163 return !rBHelper.bDisposed && !rBHelper.bInDispose && (
m_pTreeListBox !=
nullptr);
170 bool bShowing =
false;
173 if( xParentContext.is() )
176 if( xParentComp.is() )
186 ::osl::MutexGuard aGuard(
m_aMutex );
195 ::osl::MutexGuard aGuard(
m_aMutex );
204 throw lang::DisposedException();
231 return css::uno::Sequence<sal_Int8>();
240 ::osl::MutexGuard aGuard(
m_aMutex );
264 return "com.sun.star.comp.svtools.AccessibleTreeListBoxEntry";
269 return {
"com.sun.star.accessibility.AccessibleContext",
270 "com.sun.star.accessibility.AccessibleComponent",
271 "com.sun.star.awt.AccessibleTreeListBoxEntry"};
292 ::osl::MutexGuard aGuard(
m_aMutex );
306 ::osl::MutexGuard aGuard(
m_aMutex );
311 throw IndexOutOfBoundsException();
314 assert(xListBox.is());
334 aParentPath.pop_back();
338 assert(pParentEntry &&
"AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!");
342 assert(xListBox.is());
356 ::osl::MutexGuard aGuard(
m_aMutex );
364 ::osl::MutexGuard aGuard(
m_aMutex );
402 ::osl::MutexGuard aGuard(
m_aMutex );
406 return AccessibleRole::UNKNOWN;
409 if(treeFlag & SvTreeFlags::CHKBTN )
415 case SvButtonState::Checked:
416 case SvButtonState::Unchecked:
417 return AccessibleRole::CHECK_BOX;
418 case SvButtonState::Tristate:
420 return AccessibleRole::LABEL;
424 return AccessibleRole::LIST_ITEM;
427 return AccessibleRole::TREE_ITEM;
433 ::osl::MutexGuard aGuard(
m_aMutex );
445 ::osl::MutexGuard aGuard(
m_aMutex );
462 pRelationSetHelper->AddRelation(
463 AccessibleRelation( AccessibleRelationType::NODE_CHILD_OF, aSequence ) );
464 xRelSet = pRelationSetHelper;
471 ::osl::MutexGuard aGuard(
m_aMutex );
473 sal_Int64 nStateSet = 0;
479 case AccessibleRole::LABEL:
480 nStateSet |= AccessibleStateType::TRANSIENT;
481 nStateSet |= AccessibleStateType::SELECTABLE;
482 nStateSet |= AccessibleStateType::ENABLED;
484 nStateSet |= AccessibleStateType::EDITABLE;
486 nStateSet |= AccessibleStateType::SHOWING;
488 case AccessibleRole::CHECK_BOX:
489 nStateSet |= AccessibleStateType::TRANSIENT;
490 nStateSet |= AccessibleStateType::SELECTABLE;
491 nStateSet |= AccessibleStateType::ENABLED;
493 nStateSet |= AccessibleStateType::SHOWING;
501 nStateSet |= AccessibleStateType::DEFUNC;
509 ::osl::MutexGuard aGuard(
m_aMutex );
524 ::osl::MutexGuard aGuard(
m_aMutex );
529 throw RuntimeException(
"AccessibleListBoxEntry::getAccessibleAtPoint - pEntry cannot be empty!");
533 assert(xListBox.is());
537 xAcc = pAccEntry.get();
569 ::osl::MutexGuard aGuard(
m_aMutex );
571 sal_Int32 nColor = 0;
576 if ( xParentComp.is() )
577 nColor = xParentComp->getForeground();
586 ::osl::MutexGuard aGuard(
m_aMutex );
588 sal_Int32 nColor = 0;
593 if ( xParentComp.is() )
594 nColor = xParentComp->getBackground();
606 ::osl::MutexGuard aGuard(
m_aMutex );
611 throw IndexOutOfBoundsException();
613 awt::Rectangle aBounds( 0, 0, 0, 0 );
621 aCharRect.
Move( -aItemRect.
Left(), -aItemRect.
Top() );
631 ::osl::MutexGuard aGuard(
m_aMutex );
633 if(aPoint.X==0 && aPoint.Y==0)
return 0;
653 ::osl::MutexGuard aGuard(
m_aMutex );
657 if ( ( 0 > nStartIndex ) || ( sText.getLength() <= nStartIndex )
658 || ( 0 > nEndIndex ) || ( sText.getLength() <= nEndIndex ) )
659 throw IndexOutOfBoundsException();
661 sal_Int32 nLen = nEndIndex - nStartIndex + 1;
678 ::osl::MutexGuard aGuard(
m_aMutex );
690 ::osl::MutexGuard aGuard(
m_aMutex );
693 if ( !nListenerCount )
710 ::osl::MutexGuard aGuard(
m_aMutex );
715 if( (treeFlag & SvTreeFlags::CHKBTN) && !bHasButtons)
718 if ( role == AccessibleRole::CHECK_BOX )
720 else if ( role == AccessibleRole::LABEL )
731 ::osl::MutexGuard aGuard(
m_aMutex );
734 checkActionIndex_Impl(
nIndex );
738 if(
nIndex == 0 && (treeFlag & SvTreeFlags::CHKBTN) )
744 if ( state == SvButtonState::Checked )
745 m_pTreeListBox->SetCheckButtonState(pEntry, SvButtonState::Unchecked);
746 else if (state == SvButtonState::Unchecked)
747 m_pTreeListBox->SetCheckButtonState(pEntry, SvButtonState::Checked);
750 else if( (
nIndex == 1 && (treeFlag & SvTreeFlags::CHKBTN) ) || (
nIndex == 0) )
769 ::osl::MutexGuard aGuard(
m_aMutex );
771 checkActionIndex_Impl(
nIndex );
777 if(
nIndex == 0 && (treeFlag & SvTreeFlags::CHKBTN))
781 if ( state == SvButtonState::Checked )
783 else if (state == SvButtonState::Unchecked)
791 }
else if( (
nIndex == 1 && (treeFlag & SvTreeFlags::CHKBTN)) ||
nIndex == 0 )
795 AccResId(STR_SVT_ACC_ACTION_COLLAPSE) :
796 AccResId(STR_SVT_ACC_ACTION_EXPAND);
800 throw IndexOutOfBoundsException();
806 checkActionIndex_Impl(
nIndex );
816 ::osl::MutexGuard aGuard(
m_aMutex );
821 throw IndexOutOfBoundsException();
825 throw IndexOutOfBoundsException();
833 ::osl::MutexGuard aGuard(
m_aMutex );
838 throw IndexOutOfBoundsException();
843 throw IndexOutOfBoundsException();
851 ::osl::MutexGuard aGuard(
m_aMutex );
857 throw RuntimeException(
"AccessibleListBoxEntry::clearAccessibleSelection - pParent cannot be empty!");
870 ::osl::MutexGuard aGuard(
m_aMutex );
876 throw RuntimeException(
"AccessibleListBoxEntry::selectAllAccessibleChildren - pParent cannot be empty!");
889 ::osl::MutexGuard aGuard(
m_aMutex );
893 sal_Int64 nSelCount = 0;
897 throw RuntimeException(
"AccessibleListBoxEntry::getSelectedAccessibleChildCount - pParent cannot be empty!");
912 ::osl::MutexGuard aGuard(
m_aMutex );
917 throw IndexOutOfBoundsException();
920 sal_Int64 nSelCount = 0;
924 throw RuntimeException(
"AccessibleListBoxEntry::getSelectedAccessibleChild - pParent cannot be empty!");
932 if ( nSelCount == ( nSelectedChildIndex + 1 ) )
935 assert(xListBox.is());
947 ::osl::MutexGuard aGuard(
m_aMutex );
952 throw IndexOutOfBoundsException();
957 throw IndexOutOfBoundsException();
968 ::osl::MutexGuard aGuard(
m_aMutex );
972 throw IndexOutOfBoundsException();
979 ::osl::MutexGuard aGuard(
m_aMutex );
986 ::osl::MutexGuard aGuard(
m_aMutex );
992 throw IndexOutOfBoundsException();
994 return css::uno::Sequence< css::beans::PropertyValue >();
999 ::osl::MutexGuard aGuard(
m_aMutex );
1007 ::osl::MutexGuard aGuard(
m_aMutex );
1014 ::osl::MutexGuard aGuard(
m_aMutex );
1021 ::osl::MutexGuard aGuard(
m_aMutex );
1028 ::osl::MutexGuard aGuard(
m_aMutex );
1032 throw IndexOutOfBoundsException();
1039 ::osl::MutexGuard aGuard(
m_aMutex );
1046 ::osl::MutexGuard aGuard(
m_aMutex );
1053 ::osl::MutexGuard aGuard(
m_aMutex );
1060 ::osl::MutexGuard aGuard(
m_aMutex );
1067 ::osl::MutexGuard aGuard(
m_aMutex );
1078 ::osl::MutexGuard aGuard(
m_aMutex );
1080 sal_Int32 level =
static_cast<sal_Int32
>(
m_aEntryPath.size()) - 1;
1081 level = level < 0 ? 0: level;
1089 ::osl::MutexGuard aGuard(
m_aMutex );
1092 bool bReturn =
false;
1099 sal_Int32
nValue(0), nValueMin(0), nValueMax(0);
1104 if (
nValue < nValueMin )
1106 else if (
nValue > nValueMax )
1120 ::osl::MutexGuard aGuard(
m_aMutex );
1126 case AccessibleRole::CHECK_BOX:
1127 aValue <<= sal_Int32(1);
1129 case AccessibleRole::LABEL:
1140 ::osl::MutexGuard aGuard(
m_aMutex );
1146 case AccessibleRole::CHECK_BOX:
1147 aValue <<= sal_Int32(0);
1149 case AccessibleRole::LABEL:
1159 ::osl::MutexGuard aGuard(
m_aMutex );
1164 case AccessibleRole::CHECK_BOX:
1165 aValue <<= sal_Int32(1);
1167 case AccessibleRole::LABEL:
#define ACCESSIBLE_ACTION_COUNT
OUString AccResId(TranslateId aId)
const LanguageTag & GetUILanguageTag() const
static const AllSettings & GetSettings()
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
SvTreeListEntry * GetEntryFromPath(const ::std::deque< sal_Int32 > &_rPath) const
SvTreeFlags GetTreeFlags() const
void SetCheckButtonState(SvTreeListEntry *, SvButtonState)
void FillEntryPath(SvTreeListEntry *pEntry, ::std::deque< sal_Int32 > &_rPath) const
SvButtonState GetCheckButtonState(SvTreeListEntry *) const
static OUString SearchEntryTextWithHeadTitle(SvTreeListEntry *pEntry)
bool HasChildrenOnDemand() const
the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry
css::uno::WeakReference< css::accessibility::XAccessible > m_wListBox
virtual css::awt::Rectangle SAL_CALL getBounds() override
void SAL_CALL selectAllAccessibleChildren() override
css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int64 nSelectedChildIndex) override
virtual void SAL_CALL disposing() override
this function is called upon disposing the component
bool IsShowing_Impl() const
SvTreeListEntry * m_pSvLBoxEntry
virtual sal_Bool SAL_CALL setSelection(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual css::lang::Locale SAL_CALL getLocale() override
virtual css::awt::Point SAL_CALL getLocation() override
virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding(sal_Int32 nIndex) override
css::uno::Reference< css::accessibility::XAccessible > implGetParentAccessible() const
virtual sal_Bool SAL_CALL setCurrentValue(const css::uno::Any &aNumber) override
virtual sal_Int32 SAL_CALL getCaretPosition() override
virtual sal_Int32 SAL_CALL getSelectionEnd() override
void NotifyAccessibleEvent(sal_Int16 _nEventId, const css::uno::Any &_aOldValue, const css::uno::Any &_aNewValue)
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &aPoint) override
virtual sal_Int32 SAL_CALL getForeground() override
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
tools::Rectangle GetBoundingBox_Impl() const
void SAL_CALL clearAccessibleSelection() override
tools::Rectangle GetBoundingBox()
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
sal_Int64 SAL_CALL getSelectedAccessibleChildCount() override
virtual ~AccessibleListBoxEntry() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual OUString SAL_CALL getAccessibleName() override
sal_uInt32 m_nClientId
client id in the AccessibleEventNotifier queue
void EnsureIsAlive() const
SvTreeListEntry * GetRealChild(sal_Int32 nIndex)
virtual OUString SAL_CALL getText() override
tools::Rectangle GetBoundingBoxOnScreen_Impl() const
virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
std::deque< sal_Int32 > m_aEntryPath
The treelistbox control.
AccessibleListBoxEntry(SvTreeListBox &_rListBox, SvTreeListEntry &rEntry, AccessibleListBox &rListBox)
Ctor()
virtual css::awt::Size SAL_CALL getSize() override
virtual sal_Int32 SAL_CALL getAccessibleActionCount() override
virtual OUString implGetText() override
virtual css::awt::Rectangle SAL_CALL getCharacterBounds(sal_Int32 nIndex) override
virtual css::uno::Any SAL_CALL getMinimumIncrement() override
virtual sal_Int32 SAL_CALL getSelectionStart() override
sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int64 nChildIndex) override
sal_Int32 GetRoleType() const
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void implGetSelection(sal_Int32 &nStartIndex, sal_Int32 &nEndIndex) override
virtual css::uno::Any SAL_CALL getMaximumValue() override
VclPtr< SvTreeListBox > m_pTreeListBox
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 i) override
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
virtual sal_Unicode SAL_CALL getCharacter(sal_Int32 nIndex) override
virtual sal_Int32 SAL_CALL getBackground() override
void SAL_CALL selectAccessibleChild(sal_Int64 nChildIndex) override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
virtual sal_Bool SAL_CALL setCaretPosition(sal_Int32 nIndex) override
virtual OUString SAL_CALL getAccessibleActionDescription(sal_Int32 nIndex) override
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
AccessibleListBox & m_rListBox
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
void SAL_CALL deselectAccessibleChild(sal_Int64 nSelectedChildIndex) override
virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes(sal_Int32 nIndex, const css::uno::Sequence< OUString > &aRequestedAttributes) override
tools::Rectangle GetBoundingBoxOnScreen()
bool IsAlive_Impl() const
virtual sal_Int32 SAL_CALL getCharacterCount() override
virtual sal_Bool SAL_CALL scrollSubstringTo(sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override
virtual css::uno::Any SAL_CALL getCurrentValue() override
virtual void SAL_CALL grabFocus() override
virtual OUString SAL_CALL getAccessibleDescription() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
virtual css::uno::Any SAL_CALL getMinimumValue() override
virtual css::lang::Locale implGetLocale() override
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
virtual sal_Bool SAL_CALL doAccessibleAction(sal_Int32 nIndex) override
virtual OUString SAL_CALL getSelectedText() override
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Int32 SAL_CALL getIndexAtPoint(const css::awt::Point &aPoint) override
virtual sal_Bool SAL_CALL copyText(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox ent...
rtl::Reference< AccessibleListBoxEntry > implGetAccessible(SvTreeListEntry &rEntry)
static sal_Int32 addEventListener(const TClientId _nClient, const css::uno::Reference< css::accessibility::XAccessibleEventListener > &_rxListener)
static void addEvent(const TClientId _nClient, const css::accessibility::AccessibleEventObject &_rEvent)
static sal_Int32 removeEventListener(const TClientId _nClient, const css::uno::Reference< css::accessibility::XAccessibleEventListener > &_rxListener)
static TClientId registerClient()
static void revokeClient(const TClientId _nClient)
static void revokeClientNotifyDisposing(const TClientId _nClient, const css::uno::Reference< css::uno::XInterface > &_rxEventSource)
css::accessibility::TextSegment getTextBeforeIndex(sal_Int32 nIndex, sal_Int16 aTextType)
css::accessibility::TextSegment getTextAtIndex(sal_Int32 nIndex, sal_Int16 aTextType)
static bool implIsValidIndex(sal_Int32 nIndex, sal_Int32 nLength)
static bool implIsValidRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int32 nLength)
static sal_Unicode implGetCharacter(std::u16string_view rText, sal_Int32 nIndex)
css::accessibility::TextSegment getTextBehindIndex(sal_Int32 nIndex, sal_Int16 aTextType)
static OUString implGetTextRange(std::u16string_view rText, sal_Int32 nStartIndex, sal_Int32 nEndIndex)
mutable::osl::Mutex m_aMutex
static SVT_DLLPUBLIC void CopyString(const OUString &_rContent, vcl::Window *_pWindow)
css::awt::Size AWTSize(const Size &rVCLSize)
css::awt::Point AWTPoint(const ::Point &rVCLPoint)
css::awt::Rectangle AWTRectangle(const ::tools::Rectangle &rVCLRect)
inline ::tools::Rectangle VCLRectangle(const css::awt::Rectangle &rAWTRect)
inline ::Point VCLPoint(const css::awt::Point &rAWTPoint)
#define LINK(Instance, Class, Member)
IMPL_LINK(AccessibleDocumentViewBase, WindowChildEventListener, VclWindowEvent &, rEvent, void)
double getLength(const B2DPolygon &rCandidate)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
tools::Long GetIndexForPoint(const Point &rPoint) const
tools::Rectangle GetCharacterBounds(tools::Long nIndex) const
WinBits const WB_HASBUTTONS