25#include <com/sun/star/awt/KeyModifier.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>
53 :ImplInheritanceHelper( pParent, nItemPos, pMenu )
72 bool bChecked =
false;
76 sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
77 if ( m_pParent->IsItemChecked( nItemId ) )
87 bool bHighlighted =
false;
89 if ( m_pParent && m_pParent->IsHighlighted( m_nItemPos ) )
100 rStateSet |= AccessibleStateType::FOCUSABLE;
103 rStateSet |= AccessibleStateType::FOCUSED;
105 rStateSet |= AccessibleStateType::SELECTABLE;
108 rStateSet |= AccessibleStateType::SELECTED;
111 rStateSet |= AccessibleStateType::CHECKED;
142 return "com.sun.star.comp.toolkit.AccessibleMenuItem";
148 return {
"com.sun.star.awt.AccessibleMenuItem" };
157 OExternalLockGuard aGuard(
this );
160 sal_Int16 nRole = AccessibleRole::MENU_ITEM;
163 sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
164 MenuItemBits nItemBits = m_pParent->GetItemBits(nItemId);
165 if( nItemBits & MenuItemBits::RADIOCHECK)
166 nRole = AccessibleRole::RADIO_MENU_ITEM;
167 else if( nItemBits & MenuItemBits::CHECKABLE)
168 nRole = AccessibleRole::CHECK_MENU_ITEM;
186 OExternalLockGuard aGuard(
this );
189 throw IndexOutOfBoundsException();
197 OExternalLockGuard aGuard(
this );
205 OExternalLockGuard aGuard(
this );
208 throw IndexOutOfBoundsException();
211 sal_Int32 nBackColor = getBackground();
212 sal_Int32 nColor = getForeground();
220 OExternalLockGuard aGuard(
this );
223 throw IndexOutOfBoundsException();
225 awt::Rectangle aBounds( 0, 0, 0, 0 );
228 sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
231 aCharRect.
Move( -aItemRect.
Left(), -aItemRect.
Top() );
241 OExternalLockGuard aGuard(
this );
243 return m_sItemText.getLength();
249 OExternalLockGuard aGuard(
this );
254 sal_uInt16 nItemId = 0;
258 sal_Int32 nI = m_pParent->GetIndexForPoint( aPnt, nItemId );
259 if ( nI != -1 && m_pParent->GetItemId( m_nItemPos ) == nItemId )
269 OExternalLockGuard aGuard(
this );
277 OExternalLockGuard aGuard(
this );
285 OExternalLockGuard aGuard(
this );
293 OExternalLockGuard aGuard(
this );
296 throw IndexOutOfBoundsException();
304 OExternalLockGuard aGuard(
this );
312 OExternalLockGuard aGuard(
this );
314 return OCommonAccessibleText::implGetTextRange(
implGetText(), nStartIndex, nEndIndex );
320 OExternalLockGuard aGuard(
this );
322 return OCommonAccessibleText::getTextAtIndex(
nIndex, aTextType );
328 OExternalLockGuard aGuard(
this );
330 return OCommonAccessibleText::getTextBeforeIndex(
nIndex, aTextType );
336 OExternalLockGuard aGuard(
this );
338 return OCommonAccessibleText::getTextBehindIndex(
nIndex, aTextType );
344 OExternalLockGuard aGuard(
this );
346 bool bReturn =
false;
353 Reference< datatransfer::clipboard::XClipboard > xClipboard = pWindow->
GetClipboard();
354 if ( xClipboard.is() )
356 OUString sText(
getTextRange( nStartIndex, nEndIndex ) );
361 xClipboard->setContents( pDataObj,
nullptr );
362 Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
363 if( xFlushableClipboard.is() )
364 xFlushableClipboard->flushClipboard();
391 OExternalLockGuard aGuard(
this );
394 throw IndexOutOfBoundsException();
404 OExternalLockGuard aGuard(
this );
407 throw IndexOutOfBoundsException();
415 OExternalLockGuard aGuard(
this );
418 throw IndexOutOfBoundsException();
425 if (!(m_pParent->GetMenuFlags() & MenuFlags::NoAutoMnemonics))
426 m_pParent->CreateAutoMnemonics();
429 KeyEvent aKeyEvent = m_pParent->GetActivationKey( m_pParent->GetItemId( m_nItemPos ) );
431 Sequence< awt::KeyStroke > aSeq1
435 static_cast< sal_Int16
>(aKeyCode.
GetCode()),
443 Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
444 if ( xParentContext.is() && xParentContext->getAccessibleRole() == AccessibleRole::MENU_BAR )
445 aSeq1.getArray()[0].Modifiers |= awt::KeyModifier::MOD2;
447 pKeyBindingHelper->AddKeyBinding( aSeq1 );
450 Sequence< awt::KeyStroke >
aSeq;
453 Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
454 if ( xParentContext.is() && xParentContext->getAccessibleRole() == AccessibleRole::MENU )
456 Reference< XAccessibleAction > xAction( xParentContext, UNO_QUERY );
457 if ( xAction.is() && xAction->getAccessibleActionCount() > 0 )
459 Reference< XAccessibleKeyBinding > xKeyB( xAction->getAccessibleActionKeyBinding( 0 ) );
460 if ( xKeyB.is() && xKeyB->getAccessibleKeyBindingCount() > 1 )
461 aSeq = xKeyB->getAccessibleKeyBinding( 1 );
465 Sequence< awt::KeyStroke > aSeq2 = ::comphelper::concatSequences(
aSeq, aSeq1 );
466 pKeyBindingHelper->AddKeyBinding( aSeq2 );
469 vcl::KeyCode aAccelKeyCode = m_pParent->GetAccelKey( m_pParent->GetItemId( m_nItemPos ) );
470 if ( aAccelKeyCode.
GetCode() != 0 )
472 Sequence< awt::KeyStroke > aSeq3
476 static_cast< sal_Int16
>(aAccelKeyCode.
GetCode()),
478 static_cast< sal_Int16
>(aAccelKeyCode.
GetFunction())
483 auto pSeq3 = aSeq3.getArray();
485 pSeq3[0].Modifiers |= awt::KeyModifier::SHIFT;
486 if ( aAccelKeyCode.
IsMod1() )
487 pSeq3[0].Modifiers |= awt::KeyModifier::MOD1;
488 if ( aAccelKeyCode.
IsMod2() )
489 pSeq3[0].Modifiers |= awt::KeyModifier::MOD2;
490 if ( aAccelKeyCode.
IsMod3() )
491 pSeq3[0].Modifiers |= awt::KeyModifier::MOD3;
493 pKeyBindingHelper->AddKeyBinding( aSeq3 );
497 return pKeyBindingHelper;
506 OExternalLockGuard aGuard(
this );
510 aValue <<= sal_Int32(1);
512 aValue <<= sal_Int32(0);
520 OExternalLockGuard aGuard(
this );
522 bool bReturn =
false;
524 OSL_VERIFY( aNumber >>=
nValue );
544 aValue <<= sal_Int32(1);
553 aValue <<= sal_Int32(0);
561 aValue <<= sal_Int32(1);
const LanguageTag & GetLanguageTag() const
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
std::vector< css::beans::PropertyValue > GetCharacterAttributes()
sal_Unicode GetCharCode() const
const vcl::KeyCode & GetKeyCode() const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
const vcl::Font & GetMenuFont() const
static bool implIsValidIndex(sal_Int32 nIndex, sal_Int32 nLength)
static bool implIsValidRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int32 nLength)
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
KeyFuncType GetFunction() const
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard()
css::awt::Rectangle AWTRectangle(const ::tools::Rectangle &rVCLRect)
inline ::Point VCLPoint(const css::awt::Point &rAWTPoint)
Sequence< sal_Int8 > aSeq
constexpr OUStringLiteral RID_STR_ACC_ACTION_SELECT