24#include <com/sun/star/awt/Rectangle.hpp>
26#include <com/sun/star/accessibility/AccessibleEventId.hpp>
27#include <com/sun/star/accessibility/AccessibleRole.hpp>
28#include <com/sun/star/accessibility/AccessibleStateType.hpp>
29#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
30#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
31#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
44#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
61 m_pToolBox ( _pToolBox ),
62 m_nIndexInParent(
_nPos ),
63 m_nRole ( AccessibleRole::PUSH_BUTTON ),
65 m_bHasFocus ( false ),
66 m_bIsChecked ( false ),
67 m_bIndeterminate( false )
78 case ToolBoxItemType::BUTTON :
82 (( nBits & ToolBoxItemBits::DROPDOWN ) == ToolBoxItemBits::DROPDOWN) ||
83 (( nBits & ToolBoxItemBits::DROPDOWNONLY ) == ToolBoxItemBits::DROPDOWNONLY)
85 m_nRole = AccessibleRole::BUTTON_DROPDOWN;
87 ( ( nBits & ToolBoxItemBits::CHECKABLE ) == ToolBoxItemBits::CHECKABLE ) ||
88 ( ( nBits & ToolBoxItemBits::RADIOCHECK ) == ToolBoxItemBits::RADIOCHECK ) ||
89 ( ( nBits & ToolBoxItemBits::AUTOCHECK ) == ToolBoxItemBits::AUTOCHECK )
91 m_nRole = AccessibleRole::TOGGLE_BUTTON;
93 m_nRole = AccessibleRole::PANEL;
97 case ToolBoxItemType::SPACE :
98 m_nRole = AccessibleRole::FILLER;
101 case ToolBoxItemType::SEPARATOR :
102 case ToolBoxItemType::BREAK :
103 m_nRole = AccessibleRole::SEPARATOR;
108 SAL_WARN(
"accessibility",
"unsupported toolbox itemtype" );
133 OUString sWinText = pItemWindow->
GetAccessible()->getAccessibleContext()->getAccessibleName();
134 if (!sWinText.isEmpty())
151 aOldValue <<= AccessibleStateType::FOCUSED;
153 aNewValue <<= AccessibleStateType::FOCUSED;
155 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
161 if(
m_nRole == AccessibleRole::PANEL)
168 aOldValue <<= AccessibleStateType::CHECKED;
170 aNewValue <<= AccessibleStateType::CHECKED;
172 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
180 Any aOldValue, aNewValue;
182 aOldValue <<= AccessibleStateType::INDETERMINATE;
184 aNewValue <<= AccessibleStateType::INDETERMINATE;
186 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
195 Any aOldValue, aNewValue;
200 NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
211 Any aOld = _bShow ?
Any() :
Any( _xChild );
212 Any aNew = _bShow ?
Any( _xChild ) :
Any();
213 NotifyAccessibleEvent( AccessibleEventId::CHILD, aOld, aNew );
218 std::array<Any, 2> aOldValue, aNewValue;
221 aNewValue[0] <<= AccessibleStateType::SENSITIVE;
222 aNewValue[1] <<= AccessibleStateType::ENABLED;
226 aOldValue[0] <<= AccessibleStateType::ENABLED;
227 aOldValue[1] <<= AccessibleStateType::SENSITIVE;
230 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[0], aNewValue[0] );
231 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[1], aNewValue[1] );
236 awt::Rectangle aRect;
268 return ImplInheritanceHelper::queryInterface( _rType );
275 AccessibleTextHelper_BASE::disposing();
283 return "com.sun.star.comp.toolkit.AccessibleToolBoxItem";
293 return {
"com.sun.star.accessibility.AccessibleContext",
294 "com.sun.star.accessibility.AccessibleComponent",
295 "com.sun.star.accessibility.AccessibleExtendedComponent",
296 "com.sun.star.accessibility.AccessibleToolBoxItem"};
310 OContextEntryGuard aGuard(
this );
317 OContextEntryGuard aGuard(
this );
321 throw IndexOutOfBoundsException();
328 OContextEntryGuard aGuard(
this );
335 OContextEntryGuard aGuard(
this );
342 OContextEntryGuard aGuard(
this );
349 OExternalLockGuard aGuard(
this );
353 return AccResId( RID_STR_ACC_PANEL_DESCRIPTION );
357 OUString sDescription;
366 OExternalLockGuard aGuard(
this );
374 OContextEntryGuard aGuard(
this );
381 OExternalLockGuard aGuard(
this );
383 sal_Int64 nStateSet = 0;
385 if (
m_pToolBox && !rBHelper.bDisposed && !rBHelper.bInDispose )
387 nStateSet |= AccessibleStateType::FOCUSABLE;
389 nStateSet |= AccessibleStateType::CHECKED;
391 nStateSet |= AccessibleStateType::INDETERMINATE;
394 nStateSet |= AccessibleStateType::ENABLED;
395 nStateSet |= AccessibleStateType::SENSITIVE;
398 nStateSet |= AccessibleStateType::VISIBLE;
400 nStateSet |= AccessibleStateType::SHOWING;
402 nStateSet |= AccessibleStateType::FOCUSED;
405 nStateSet |= AccessibleStateType::DEFUNC;
414 OExternalLockGuard aGuard(
this );
426 OExternalLockGuard aGuard(
this );
428 return OCommonAccessibleText::implGetCharacter(
GetText(),
nIndex );
433 OExternalLockGuard aGuard(
this );
435 return OCommonAccessibleText::implGetTextRange(
GetText(), nStartIndex, nEndIndex );
445 OExternalLockGuard aGuard(
this );
448 throw IndexOutOfBoundsException();
455 OExternalLockGuard aGuard(
this );
459 if ( !implIsValidIndex(
nIndex, sText.getLength() ) )
460 throw IndexOutOfBoundsException();
462 return Sequence< PropertyValue >();
467 OExternalLockGuard aGuard(
this );
471 if ( !implIsValidIndex(
nIndex, sText.getLength() ) )
472 throw IndexOutOfBoundsException();
474 awt::Rectangle aBounds( 0, 0, 0, 0 );
479 aCharRect.
Move( -aItemRect.
Left(), -aItemRect.
Top() );
488 OExternalLockGuard aGuard(
this );
497 sal_Int32 nIdx =
m_pToolBox->GetIndexForPoint( aPnt, nItemId );
498 if ( nIdx != -1 && nItemId ==
m_nItemId )
507 OExternalLockGuard aGuard(
this );
510 throw IndexOutOfBoundsException();
517 OExternalLockGuard aGuard(
this );
520 throw IndexOutOfBoundsException();
522 bool bReturn =
false;
526 Reference< datatransfer::clipboard::XClipboard > xClipboard =
m_pToolBox->GetClipboard();
527 if ( xClipboard.is() )
529 OUString sText( OCommonAccessibleText::implGetTextRange(
implGetText(), nStartIndex, nEndIndex ) );
534 xClipboard->setContents( pDataObj,
nullptr );
536 Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
537 if( xFlushableClipboard.is() )
538 xFlushableClipboard->flushClipboard();
565 Reference< XAccessibleSelection > rxAccessibleSelection(xParent->getAccessibleContext(), UNO_QUERY);
567 if ( rxAccessibleSelection.is() )
576 OExternalLockGuard aGuard(
this );
582 return sal_Int32(nColor);
587 OExternalLockGuard aGuard(
this );
593 return sal_Int32(nColor);
604 OExternalLockGuard aGuard(
this );
615 OExternalLockGuard aGuard(
this );
624 if ( sRet.isEmpty() )
641 OExternalLockGuard aGuard(
this );
644 throw IndexOutOfBoundsException();
654 OExternalLockGuard aGuard(
this );
657 throw IndexOutOfBoundsException();
664 OContextEntryGuard aGuard(
this );
667 throw IndexOutOfBoundsException();
669 return Reference< XAccessibleKeyBinding >();
676 OExternalLockGuard aGuard(
this );
682 if(
m_nRole == AccessibleRole::PANEL )
683 aValue <<= sal_Int32(0);
689 OExternalLockGuard aGuard(
this );
691 bool bReturn =
false;
696 OSL_VERIFY( aNumber >>=
nValue );
712 return Any(sal_Int32(1));
717 return Any(sal_Int32(0));
722 return Any(sal_Int32(1));
OUString AccResId(TranslateId aId)
const LanguageTag & GetUILanguageTag() const
static const AllSettings & GetSettings()
static bool IsExtHelpEnabled()
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
css::awt::Rectangle AWTRectangle(const ::tools::Rectangle &rVCLRect)
inline ::Point VCLPoint(const css::awt::Point &rAWTPoint)
#define SAL_WARN(area, stream)
double getLength(const B2DPolygon &rCandidate)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr OUStringLiteral RID_STR_ACC_ACTION_CLICK