LCOV - code coverage report
Current view: top level - libreoffice/accessibility/source/standard - vclxaccessiblemenuitem.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 244 0.0 %
Date: 2012-12-17 Functions: 0 44 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <accessibility/standard/vclxaccessiblemenuitem.hxx>
      21             : #include <accessibility/helper/accresmgr.hxx>
      22             : #include <accessibility/helper/accessiblestrings.hrc>
      23             : #include <toolkit/helper/convert.hxx>
      24             : #include <accessibility/helper/characterattributeshelper.hxx>
      25             : #include <comphelper/accessiblekeybindinghelper.hxx>
      26             : #include <com/sun/star/awt/KeyModifier.hpp>
      27             : 
      28             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      29             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      30             : #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
      31             : #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
      32             : #include <unotools/accessiblestatesethelper.hxx>
      33             : #include <comphelper/sequence.hxx>
      34             : #include <vcl/svapp.hxx>
      35             : #include <vcl/window.hxx>
      36             : #include <vcl/menu.hxx>
      37             : #include <vcl/unohelp2.hxx>
      38             : 
      39             : #include <memory>
      40             : 
      41             : 
      42             : using namespace ::com::sun::star::accessibility;
      43             : using namespace ::com::sun::star::uno;
      44             : using namespace ::com::sun::star::beans;
      45             : using namespace ::com::sun::star::lang;
      46             : using namespace ::com::sun::star;
      47             : using namespace ::comphelper;
      48             : 
      49             : 
      50             : // -----------------------------------------------------------------------------
      51             : // class VCLXAccessibleMenuItem
      52             : // -----------------------------------------------------------------------------
      53             : 
      54           0 : VCLXAccessibleMenuItem::VCLXAccessibleMenuItem( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu )
      55           0 :     :OAccessibleMenuItemComponent( pParent, nItemPos, pMenu )
      56             : {
      57           0 : }
      58             : 
      59             : // -----------------------------------------------------------------------------
      60             : 
      61           0 : VCLXAccessibleMenuItem::~VCLXAccessibleMenuItem()
      62             : {
      63           0 : }
      64             : 
      65             : // -----------------------------------------------------------------------------
      66             : 
      67           0 : sal_Bool VCLXAccessibleMenuItem::IsFocused()
      68             : {
      69           0 :     return IsHighlighted();
      70             : }
      71             : 
      72             : // -----------------------------------------------------------------------------
      73             : 
      74           0 : sal_Bool VCLXAccessibleMenuItem::IsSelected()
      75             : {
      76           0 :     return IsHighlighted();
      77             : }
      78             : 
      79             : // -----------------------------------------------------------------------------
      80             : 
      81           0 : sal_Bool VCLXAccessibleMenuItem::IsChecked()
      82             : {
      83           0 :     sal_Bool bChecked = sal_False;
      84             : 
      85           0 :     if ( m_pParent )
      86             :     {
      87           0 :         sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
      88           0 :         if ( m_pParent->IsItemChecked( nItemId ) )
      89           0 :             bChecked = sal_True;
      90             :     }
      91             : 
      92           0 :     return bChecked;
      93             : }
      94             : 
      95             : // -----------------------------------------------------------------------------
      96             : 
      97           0 : sal_Bool VCLXAccessibleMenuItem::IsHighlighted()
      98             : {
      99           0 :     sal_Bool bHighlighted = sal_False;
     100             : 
     101           0 :     if ( m_pParent && m_pParent->IsHighlighted( m_nItemPos ) )
     102           0 :         bHighlighted = sal_True;
     103             : 
     104           0 :     return bHighlighted;
     105             : }
     106             : 
     107             : // -----------------------------------------------------------------------------
     108             : 
     109           0 : void VCLXAccessibleMenuItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
     110             : {
     111           0 :     OAccessibleMenuItemComponent::FillAccessibleStateSet( rStateSet );
     112             : 
     113           0 :     rStateSet.AddState( AccessibleStateType::FOCUSABLE );
     114             : 
     115           0 :     if ( IsFocused() )
     116           0 :         rStateSet.AddState( AccessibleStateType::FOCUSED );
     117             : 
     118           0 :     rStateSet.AddState( AccessibleStateType::SELECTABLE );
     119             : 
     120           0 :     if ( IsSelected() )
     121           0 :         rStateSet.AddState( AccessibleStateType::SELECTED );
     122             : 
     123           0 :     if ( IsChecked() )
     124           0 :         rStateSet.AddState( AccessibleStateType::CHECKED );
     125           0 : }
     126             : 
     127             : // -----------------------------------------------------------------------------
     128             : // OCommonAccessibleText
     129             : // -----------------------------------------------------------------------------
     130             : 
     131           0 : OUString VCLXAccessibleMenuItem::implGetText()
     132             : {
     133           0 :     return m_sItemText;
     134             : }
     135             : 
     136             : // -----------------------------------------------------------------------------
     137             : 
     138           0 : Locale VCLXAccessibleMenuItem::implGetLocale()
     139             : {
     140           0 :     return Application::GetSettings().GetLanguageTag().getLocale();
     141             : }
     142             : 
     143             : // -----------------------------------------------------------------------------
     144             : 
     145           0 : void VCLXAccessibleMenuItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
     146             : {
     147           0 :     nStartIndex = 0;
     148           0 :     nEndIndex = 0;
     149           0 : }
     150             : 
     151             : // -----------------------------------------------------------------------------
     152             : // XInterface
     153             : // -----------------------------------------------------------------------------
     154             : 
     155           0 : IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleMenuItem, OAccessibleMenuItemComponent, VCLXAccessibleMenuItem_BASE )
     156             : 
     157             : // -----------------------------------------------------------------------------
     158             : // XTypeProvider
     159             : // -----------------------------------------------------------------------------
     160             : 
     161           0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleMenuItem, OAccessibleMenuItemComponent, VCLXAccessibleMenuItem_BASE )
     162             : 
     163             : // -----------------------------------------------------------------------------
     164             : // XServiceInfo
     165             : // -----------------------------------------------------------------------------
     166             : 
     167           0 : OUString VCLXAccessibleMenuItem::getImplementationName() throw (RuntimeException)
     168             : {
     169           0 :     return OUString( "com.sun.star.comp.toolkit.AccessibleMenuItem" );
     170             : }
     171             : 
     172             : // -----------------------------------------------------------------------------
     173             : 
     174           0 : Sequence< OUString > VCLXAccessibleMenuItem::getSupportedServiceNames() throw (RuntimeException)
     175             : {
     176           0 :     Sequence< OUString > aNames(1);
     177           0 :     aNames[0] = "com.sun.star.awt.AccessibleMenuItem";
     178           0 :     return aNames;
     179             : }
     180             : 
     181             : // -----------------------------------------------------------------------------
     182             : // XAccessibleContext
     183             : // -----------------------------------------------------------------------------
     184             : 
     185           0 : sal_Int16 VCLXAccessibleMenuItem::getAccessibleRole(  ) throw (RuntimeException)
     186             : {
     187           0 :     OExternalLockGuard aGuard( this );
     188             : 
     189           0 :     return AccessibleRole::MENU_ITEM;
     190             : }
     191             : 
     192             : // -----------------------------------------------------------------------------
     193             : // XAccessibleText
     194             : // -----------------------------------------------------------------------------
     195             : 
     196           0 : sal_Int32 VCLXAccessibleMenuItem::getCaretPosition() throw (RuntimeException)
     197             : {
     198           0 :     OExternalLockGuard aGuard( this );
     199             : 
     200           0 :     return -1;
     201             : }
     202             : 
     203             : // -----------------------------------------------------------------------------
     204             : 
     205           0 : sal_Bool VCLXAccessibleMenuItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     206             : {
     207             : 
     208           0 :     OExternalLockGuard aGuard( this );
     209             : 
     210           0 :     if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
     211           0 :         throw IndexOutOfBoundsException();
     212             : 
     213           0 :     return sal_False;
     214             : }
     215             : 
     216             : // -----------------------------------------------------------------------------
     217             : 
     218           0 : sal_Unicode VCLXAccessibleMenuItem::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     219             : {
     220           0 :     OExternalLockGuard aGuard( this );
     221             : 
     222           0 :     return OCommonAccessibleText::getCharacter( nIndex );
     223             : }
     224             : 
     225             : // -----------------------------------------------------------------------------
     226             : 
     227           0 : Sequence< PropertyValue > VCLXAccessibleMenuItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException)
     228             : {
     229           0 :     OExternalLockGuard aGuard( this );
     230             : 
     231           0 :     Sequence< PropertyValue > aValues;
     232           0 :     OUString sText( implGetText() );
     233             : 
     234           0 :     if ( !implIsValidIndex( nIndex, sText.getLength() ) )
     235           0 :         throw IndexOutOfBoundsException();
     236             : 
     237           0 :     Font aFont = Application::GetSettings().GetStyleSettings().GetMenuFont();
     238           0 :     sal_Int32 nBackColor = getBackground();
     239           0 :     sal_Int32 nColor = getForeground();
     240           0 :     ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
     241           0 :     aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
     242             : 
     243           0 :     return aValues;
     244             : }
     245             : 
     246             : // -----------------------------------------------------------------------------
     247             : 
     248           0 : awt::Rectangle VCLXAccessibleMenuItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     249             : {
     250           0 :     OExternalLockGuard aGuard( this );
     251             : 
     252           0 :     if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
     253           0 :         throw IndexOutOfBoundsException();
     254             : 
     255           0 :     awt::Rectangle aBounds( 0, 0, 0, 0 );
     256           0 :     if ( m_pParent )
     257             :     {
     258           0 :         sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
     259           0 :         Rectangle aItemRect = m_pParent->GetBoundingRectangle( m_nItemPos );
     260           0 :         Rectangle aCharRect = m_pParent->GetCharacterBounds( nItemId, nIndex );
     261           0 :         aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
     262           0 :         aBounds = AWTRectangle( aCharRect );
     263             :     }
     264             : 
     265           0 :     return aBounds;
     266             : }
     267             : 
     268             : // -----------------------------------------------------------------------------
     269             : 
     270           0 : sal_Int32 VCLXAccessibleMenuItem::getCharacterCount() throw (RuntimeException)
     271             : {
     272           0 :     OExternalLockGuard aGuard( this );
     273             : 
     274           0 :     return OCommonAccessibleText::getCharacterCount();
     275             : }
     276             : 
     277             : // -----------------------------------------------------------------------------
     278             : 
     279           0 : sal_Int32 VCLXAccessibleMenuItem::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
     280             : {
     281           0 :     OExternalLockGuard aGuard( this );
     282             : 
     283           0 :     sal_Int32 nIndex = -1;
     284           0 :     if ( m_pParent )
     285             :     {
     286           0 :         sal_uInt16 nItemId = 0;
     287           0 :         Rectangle aItemRect = m_pParent->GetBoundingRectangle( m_nItemPos );
     288           0 :         Point aPnt( VCLPoint( aPoint ) );
     289           0 :         aPnt += aItemRect.TopLeft();
     290           0 :         sal_Int32 nI = m_pParent->GetIndexForPoint( aPnt, nItemId );
     291           0 :         if ( nI != -1 && m_pParent->GetItemId( m_nItemPos ) == nItemId )
     292           0 :             nIndex = nI;
     293             :     }
     294             : 
     295           0 :     return nIndex;
     296             : }
     297             : 
     298             : // -----------------------------------------------------------------------------
     299             : 
     300           0 : OUString VCLXAccessibleMenuItem::getSelectedText() throw (RuntimeException)
     301             : {
     302           0 :     OExternalLockGuard aGuard( this );
     303             : 
     304           0 :     return OCommonAccessibleText::getSelectedText();
     305             : }
     306             : 
     307             : // -----------------------------------------------------------------------------
     308             : 
     309           0 : sal_Int32 VCLXAccessibleMenuItem::getSelectionStart() throw (RuntimeException)
     310             : {
     311           0 :     OExternalLockGuard aGuard( this );
     312             : 
     313           0 :     return OCommonAccessibleText::getSelectionStart();
     314             : }
     315             : 
     316             : // -----------------------------------------------------------------------------
     317             : 
     318           0 : sal_Int32 VCLXAccessibleMenuItem::getSelectionEnd() throw (RuntimeException)
     319             : {
     320           0 :     OExternalLockGuard aGuard( this );
     321             : 
     322           0 :     return OCommonAccessibleText::getSelectionEnd();
     323             : }
     324             : 
     325             : // -----------------------------------------------------------------------------
     326             : 
     327           0 : sal_Bool VCLXAccessibleMenuItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     328             : {
     329           0 :     OExternalLockGuard aGuard( this );
     330             : 
     331           0 :     if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
     332           0 :         throw IndexOutOfBoundsException();
     333             : 
     334           0 :     return sal_False;
     335             : }
     336             : 
     337             : // -----------------------------------------------------------------------------
     338             : 
     339           0 : OUString VCLXAccessibleMenuItem::getText() throw (RuntimeException)
     340             : {
     341           0 :     OExternalLockGuard aGuard( this );
     342             : 
     343           0 :     return OCommonAccessibleText::getText();
     344             : }
     345             : 
     346             : // -----------------------------------------------------------------------------
     347             : 
     348           0 : OUString VCLXAccessibleMenuItem::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     349             : {
     350           0 :     OExternalLockGuard aGuard( this );
     351             : 
     352           0 :     return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
     353             : }
     354             : 
     355             : // -----------------------------------------------------------------------------
     356             : 
     357           0 : ::com::sun::star::accessibility::TextSegment VCLXAccessibleMenuItem::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     358             : {
     359           0 :     OExternalLockGuard aGuard( this );
     360             : 
     361           0 :     return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
     362             : }
     363             : 
     364             : // -----------------------------------------------------------------------------
     365             : 
     366           0 : ::com::sun::star::accessibility::TextSegment VCLXAccessibleMenuItem::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     367             : {
     368           0 :     OExternalLockGuard aGuard( this );
     369             : 
     370           0 :     return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
     371             : }
     372             : 
     373             : // -----------------------------------------------------------------------------
     374             : 
     375           0 : ::com::sun::star::accessibility::TextSegment VCLXAccessibleMenuItem::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     376             : {
     377           0 :     OExternalLockGuard aGuard( this );
     378             : 
     379           0 :     return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
     380             : }
     381             : 
     382             : // -----------------------------------------------------------------------------
     383             : 
     384           0 : sal_Bool VCLXAccessibleMenuItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     385             : {
     386           0 :     OExternalLockGuard aGuard( this );
     387             : 
     388           0 :     sal_Bool bReturn = sal_False;
     389             : 
     390           0 :     if ( m_pParent )
     391             :     {
     392           0 :         Window* pWindow = m_pParent->GetWindow();
     393           0 :         if ( pWindow )
     394             :         {
     395           0 :             Reference< datatransfer::clipboard::XClipboard > xClipboard = pWindow->GetClipboard();
     396           0 :             if ( xClipboard.is() )
     397             :             {
     398           0 :                 OUString sText( getTextRange( nStartIndex, nEndIndex ) );
     399             : 
     400           0 :                 ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
     401           0 :                 const sal_uInt32 nRef = Application::ReleaseSolarMutex();
     402           0 :                 xClipboard->setContents( pDataObj, NULL );
     403             : 
     404           0 :                 Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
     405           0 :                 if( xFlushableClipboard.is() )
     406           0 :                     xFlushableClipboard->flushClipboard();
     407             : 
     408           0 :                 Application::AcquireSolarMutex( nRef );
     409             : 
     410           0 :                 bReturn = sal_True;
     411           0 :             }
     412             :         }
     413             :     }
     414             : 
     415           0 :     return bReturn;
     416             : }
     417             : 
     418             : // -----------------------------------------------------------------------------
     419             : // XAccessibleAction
     420             : // -----------------------------------------------------------------------------
     421             : 
     422           0 : sal_Int32 VCLXAccessibleMenuItem::getAccessibleActionCount( ) throw (RuntimeException)
     423             : {
     424           0 :     OExternalLockGuard aGuard( this );
     425             : 
     426           0 :     return 1;
     427             : }
     428             : 
     429             : // -----------------------------------------------------------------------------
     430             : 
     431           0 : sal_Bool VCLXAccessibleMenuItem::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     432             : {
     433           0 :     OExternalLockGuard aGuard( this );
     434             : 
     435           0 :     if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
     436           0 :         throw IndexOutOfBoundsException();
     437             : 
     438           0 :     Click();
     439             : 
     440           0 :     return sal_True;
     441             : }
     442             : 
     443             : // -----------------------------------------------------------------------------
     444             : 
     445           0 : OUString VCLXAccessibleMenuItem::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     446             : {
     447           0 :     OExternalLockGuard aGuard( this );
     448             : 
     449           0 :     if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
     450           0 :         throw IndexOutOfBoundsException();
     451             : 
     452           0 :     return OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
     453             : }
     454             : 
     455             : // -----------------------------------------------------------------------------
     456             : 
     457           0 : Reference< XAccessibleKeyBinding > VCLXAccessibleMenuItem::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     458             : {
     459           0 :     OExternalLockGuard aGuard( this );
     460             : 
     461           0 :     if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
     462           0 :         throw IndexOutOfBoundsException();
     463             : 
     464           0 :     OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
     465           0 :     Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
     466             : 
     467           0 :     if ( m_pParent )
     468             :     {
     469             :         // create auto mnemonics
     470           0 :         if ( Application::GetSettings().GetStyleSettings().GetAutoMnemonic() && !( m_pParent->GetMenuFlags() & MENU_FLAG_NOAUTOMNEMONICS ) )
     471           0 :             m_pParent->CreateAutoMnemonics();
     472             : 
     473             :         // activation key
     474           0 :         KeyEvent aKeyEvent = m_pParent->GetActivationKey( m_pParent->GetItemId( m_nItemPos ) );
     475           0 :         KeyCode aKeyCode = aKeyEvent.GetKeyCode();
     476           0 :         Sequence< awt::KeyStroke > aSeq1(1);
     477           0 :         aSeq1[0].Modifiers = 0;
     478           0 :         Reference< XAccessible > xParent( getAccessibleParent() );
     479           0 :         if ( xParent.is() )
     480             :         {
     481           0 :             Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
     482           0 :             if ( xParentContext.is() && xParentContext->getAccessibleRole() == AccessibleRole::MENU_BAR )
     483           0 :                 aSeq1[0].Modifiers |= awt::KeyModifier::MOD2;
     484             :         }
     485           0 :         aSeq1[0].KeyCode = aKeyCode.GetCode();
     486           0 :         aSeq1[0].KeyChar = aKeyEvent.GetCharCode();
     487           0 :         aSeq1[0].KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() );
     488           0 :         pKeyBindingHelper->AddKeyBinding( aSeq1 );
     489             : 
     490             :         // complete menu activation key sequence
     491           0 :         Sequence< awt::KeyStroke > aSeq;
     492           0 :         if ( xParent.is() )
     493             :         {
     494           0 :             Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
     495           0 :             if ( xParentContext.is() && xParentContext->getAccessibleRole() == AccessibleRole::MENU )
     496             :             {
     497           0 :                 Reference< XAccessibleAction > xAction( xParentContext, UNO_QUERY );
     498           0 :                 if ( xAction.is() && xAction->getAccessibleActionCount() > 0 )
     499             :                 {
     500           0 :                     Reference< XAccessibleKeyBinding > xKeyB( xAction->getAccessibleActionKeyBinding( 0 ) );
     501           0 :                     if ( xKeyB.is() && xKeyB->getAccessibleKeyBindingCount() > 1 )
     502           0 :                         aSeq = xKeyB->getAccessibleKeyBinding( 1 );
     503           0 :                 }
     504           0 :             }
     505             :         }
     506           0 :         Sequence< awt::KeyStroke > aSeq2 = ::comphelper::concatSequences( aSeq, aSeq1 );
     507           0 :         pKeyBindingHelper->AddKeyBinding( aSeq2 );
     508             : 
     509             :         // accelerator key
     510           0 :         KeyCode aAccelKeyCode = m_pParent->GetAccelKey( m_pParent->GetItemId( m_nItemPos ) );
     511           0 :         if ( aAccelKeyCode.GetCode() != 0 )
     512             :         {
     513           0 :             Sequence< awt::KeyStroke > aSeq3(1);
     514           0 :             aSeq3[0].Modifiers = 0;
     515           0 :             if ( aAccelKeyCode.IsShift() )
     516           0 :                 aSeq3[0].Modifiers |= awt::KeyModifier::SHIFT;
     517           0 :             if ( aAccelKeyCode.IsMod1() )
     518           0 :                 aSeq3[0].Modifiers |= awt::KeyModifier::MOD1;
     519           0 :             if ( aAccelKeyCode.IsMod2() )
     520           0 :                 aSeq3[0].Modifiers |= awt::KeyModifier::MOD2;
     521           0 :             if ( aAccelKeyCode.IsMod3() )
     522           0 :                 aSeq3[0].Modifiers |= awt::KeyModifier::MOD3;
     523           0 :             aSeq3[0].KeyCode = aAccelKeyCode.GetCode();
     524           0 :             aSeq3[0].KeyFunc = static_cast< sal_Int16 >( aAccelKeyCode.GetFunction() );
     525           0 :             pKeyBindingHelper->AddKeyBinding( aSeq3 );
     526           0 :         }
     527             :     }
     528             : 
     529           0 :     return xKeyBinding;
     530             : }
     531             : 
     532             : // -----------------------------------------------------------------------------
     533             : // XAccessibleValue
     534             : // -----------------------------------------------------------------------------
     535             : 
     536           0 : Any VCLXAccessibleMenuItem::getCurrentValue(  ) throw (RuntimeException)
     537             : {
     538           0 :     OExternalLockGuard aGuard( this );
     539             : 
     540           0 :     Any aValue;
     541           0 :     if ( IsSelected() )
     542           0 :         aValue <<= (sal_Int32) 1;
     543             :     else
     544           0 :         aValue <<= (sal_Int32) 0;
     545             : 
     546           0 :     return aValue;
     547             : }
     548             : 
     549             : // -----------------------------------------------------------------------------
     550             : 
     551           0 : sal_Bool VCLXAccessibleMenuItem::setCurrentValue( const Any& aNumber ) throw (RuntimeException)
     552             : {
     553           0 :     OExternalLockGuard aGuard( this );
     554             : 
     555           0 :     sal_Bool bReturn = sal_False;
     556           0 :     sal_Int32 nValue = 0;
     557           0 :     OSL_VERIFY( aNumber >>= nValue );
     558             : 
     559           0 :     if ( nValue <= 0 )
     560             :     {
     561           0 :         DeSelect();
     562           0 :         bReturn = sal_True;
     563             :     }
     564           0 :     else if ( nValue >= 1 )
     565             :     {
     566           0 :         Select();
     567           0 :         bReturn = sal_True;
     568             :     }
     569             : 
     570           0 :     return bReturn;
     571             : }
     572             : 
     573             : // -----------------------------------------------------------------------------
     574             : 
     575           0 : Any VCLXAccessibleMenuItem::getMaximumValue(  ) throw (RuntimeException)
     576             : {
     577           0 :     OExternalLockGuard aGuard( this );
     578             : 
     579           0 :     Any aValue;
     580           0 :     aValue <<= (sal_Int32) 1;
     581             : 
     582           0 :     return aValue;
     583             : }
     584             : 
     585             : // -----------------------------------------------------------------------------
     586             : 
     587           0 : Any VCLXAccessibleMenuItem::getMinimumValue(  ) throw (RuntimeException)
     588             : {
     589           0 :     OExternalLockGuard aGuard( this );
     590             : 
     591           0 :     Any aValue;
     592           0 :     aValue <<= (sal_Int32) 0;
     593             : 
     594           0 :     return aValue;
     595             : }
     596             : 
     597             : // -----------------------------------------------------------------------------
     598             : 
     599             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10