LCOV - code coverage report
Current view: top level - accessibility/source/standard - accessiblemenuitemcomponent.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 157 197 79.7 %
Date: 2012-08-25 Functions: 24 32 75.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 134 338 39.6 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <accessibility/standard/accessiblemenuitemcomponent.hxx>
      30                 :            : 
      31                 :            : 
      32                 :            : #include <accessibility/helper/accresmgr.hxx>
      33                 :            : #include <accessibility/helper/accessiblestrings.hrc>
      34                 :            : #include <toolkit/awt/vclxwindows.hxx>
      35                 :            : #include <toolkit/helper/externallock.hxx>
      36                 :            : #include <toolkit/helper/convert.hxx>
      37                 :            : 
      38                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      39                 :            : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      40                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      41                 :            : #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
      42                 :            : #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
      43                 :            : 
      44                 :            : #include <unotools/accessiblestatesethelper.hxx>
      45                 :            : #include <unotools/accessiblerelationsethelper.hxx>
      46                 :            : #include <cppuhelper/typeprovider.hxx>
      47                 :            : #include <comphelper/sequence.hxx>
      48                 :            : #include <comphelper/accessibletexthelper.hxx>
      49                 :            : #include <vcl/svapp.hxx>
      50                 :            : #include <vcl/window.hxx>
      51                 :            : #include <vcl/menu.hxx>
      52                 :            : #include <vcl/unohelp2.hxx>
      53                 :            : 
      54                 :            : 
      55                 :            : using namespace ::com::sun::star::accessibility;
      56                 :            : using namespace ::com::sun::star::uno;
      57                 :            : using namespace ::com::sun::star::beans;
      58                 :            : using namespace ::com::sun::star::lang;
      59                 :            : using namespace ::com::sun::star;
      60                 :            : using namespace ::comphelper;
      61                 :            : 
      62                 :            : 
      63                 :            : // -----------------------------------------------------------------------------
      64                 :            : // class OAccessibleMenuItemComponent
      65                 :            : // -----------------------------------------------------------------------------
      66                 :            : 
      67                 :       3794 : OAccessibleMenuItemComponent::OAccessibleMenuItemComponent( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu )
      68                 :            :     :OAccessibleMenuBaseComponent( pMenu )
      69                 :            :     ,m_pParent( pParent )
      70                 :       3794 :     ,m_nItemPos( nItemPos )
      71                 :            : {
      72         [ +  - ]:       3794 :     m_sAccessibleName = GetAccessibleName();
      73         [ +  - ]:       3794 :     m_sItemText = GetItemText();
      74                 :       3794 : }
      75                 :            : 
      76                 :            : // -----------------------------------------------------------------------------
      77                 :            : 
      78                 :       3794 : OAccessibleMenuItemComponent::~OAccessibleMenuItemComponent()
      79                 :            : {
      80         [ -  + ]:       3794 : }
      81                 :            : 
      82                 :            : // -----------------------------------------------------------------------------
      83                 :            : 
      84                 :       8104 : sal_Bool OAccessibleMenuItemComponent::IsEnabled()
      85                 :            : {
      86         [ +  - ]:       8104 :     OExternalLockGuard aGuard( this );
      87                 :            : 
      88                 :       8104 :     sal_Bool bEnabled = sal_False;
      89         [ +  - ]:       8104 :     if ( m_pParent )
      90 [ +  - ][ +  - ]:       8104 :         bEnabled = m_pParent->IsItemEnabled( m_pParent->GetItemId( m_nItemPos ) );
      91                 :            : 
      92         [ +  - ]:       8104 :     return bEnabled;
      93                 :            : }
      94                 :            : 
      95                 :            : // -----------------------------------------------------------------------------
      96                 :            : 
      97                 :       8440 : sal_Bool OAccessibleMenuItemComponent::IsVisible()
      98                 :            : {
      99                 :       8440 :     sal_Bool bVisible = sal_False;
     100                 :            : 
     101         [ +  - ]:       8440 :     if ( m_pParent )
     102                 :       8440 :         bVisible = m_pParent->IsItemPosVisible( m_nItemPos );
     103                 :            : 
     104                 :       8440 :     return bVisible;
     105                 :            : }
     106                 :            : 
     107                 :            : // -----------------------------------------------------------------------------
     108                 :            : 
     109                 :          0 : void OAccessibleMenuItemComponent::Select()
     110                 :            : {
     111                 :            :     // open the parent menu
     112         [ #  # ]:          0 :     Reference< XAccessible > xParent( getAccessibleParent() );
     113         [ #  # ]:          0 :     if ( xParent.is() )
     114                 :            :     {
     115 [ #  # ][ #  # ]:          0 :         OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xParent.get() );
     116 [ #  # ][ #  # ]:          0 :         if ( pComp && pComp->getAccessibleRole() == AccessibleRole::MENU && !pComp->IsPopupMenuOpen() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     117         [ #  # ]:          0 :             pComp->Click();
     118                 :            :     }
     119                 :            : 
     120                 :            :     // highlight the menu item
     121         [ #  # ]:          0 :     if ( m_pParent )
     122         [ #  # ]:          0 :         m_pParent->HighlightItem( m_nItemPos );
     123                 :          0 : }
     124                 :            : 
     125                 :            : // -----------------------------------------------------------------------------
     126                 :            : 
     127                 :          0 : void OAccessibleMenuItemComponent::DeSelect()
     128                 :            : {
     129 [ #  # ][ #  # ]:          0 :     if ( m_pParent && IsSelected() )
                 [ #  # ]
     130                 :          0 :         m_pParent->DeHighlight();
     131                 :          0 : }
     132                 :            : 
     133                 :            : // -----------------------------------------------------------------------------
     134                 :            : 
     135                 :         16 : void OAccessibleMenuItemComponent::Click()
     136                 :            : {
     137                 :            :     // open the parent menu
     138         [ +  - ]:         16 :     Reference< XAccessible > xParent( getAccessibleParent() );
     139         [ +  - ]:         16 :     if ( xParent.is() )
     140                 :            :     {
     141 [ +  - ][ +  - ]:         16 :         OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xParent.get() );
     142 [ +  - ][ +  - ]:         16 :         if ( pComp && pComp->getAccessibleRole() == AccessibleRole::MENU && !pComp->IsPopupMenuOpen() )
         [ -  + ][ #  # ]
         [ #  # ][ -  + ]
     143         [ #  # ]:          0 :             pComp->Click();
     144                 :            :     }
     145                 :            : 
     146                 :            :     // click the menu item
     147         [ +  - ]:         16 :     if ( m_pParent )
     148                 :            :     {
     149                 :         16 :         Window* pWindow = m_pParent->GetWindow();
     150         [ +  - ]:         16 :         if ( pWindow )
     151                 :            :         {
     152                 :            :             // #102438# Menu items are not selectable
     153                 :            :             // Popup menus are executed asynchronously, triggered by a timer.
     154                 :            :             // As Menu::SelectItem only works, if the corresponding menu window is
     155                 :            :             // already created, we have to set the menu delay to 0, so
     156                 :            :             // that the popup menus are executed synchronously.
     157         [ +  - ]:         16 :             AllSettings aSettings = pWindow->GetSettings();
     158         [ +  - ]:         16 :             MouseSettings aMouseSettings = aSettings.GetMouseSettings();
     159                 :         16 :             sal_uLong nDelay = aMouseSettings.GetMenuDelay();
     160         [ +  - ]:         16 :             aMouseSettings.SetMenuDelay( 0 );
     161         [ +  - ]:         16 :             aSettings.SetMouseSettings( aMouseSettings );
     162         [ +  - ]:         16 :             pWindow->SetSettings( aSettings );
     163                 :            : 
     164 [ +  - ][ +  - ]:         16 :             m_pParent->SelectItem( m_pParent->GetItemId( m_nItemPos ) );
     165                 :            : 
     166                 :            :             // meanwhile the window pointer may be invalid
     167                 :         16 :             pWindow = m_pParent->GetWindow();
     168         [ +  - ]:         16 :             if ( pWindow )
     169                 :            :             {
     170                 :            :                 // set the menu delay back to the old value
     171         [ +  - ]:         16 :                 aSettings = pWindow->GetSettings();
     172         [ +  - ]:         16 :                 aMouseSettings = aSettings.GetMouseSettings();
     173         [ +  - ]:         16 :                 aMouseSettings.SetMenuDelay( nDelay );
     174         [ +  - ]:         16 :                 aSettings.SetMouseSettings( aMouseSettings );
     175         [ +  - ]:         16 :                 pWindow->SetSettings( aSettings );
     176 [ +  - ][ +  - ]:         16 :             }
     177                 :            :         }
     178                 :         16 :     }
     179                 :         16 : }
     180                 :            : 
     181                 :            : // -----------------------------------------------------------------------------
     182                 :            : 
     183                 :       2880 : void OAccessibleMenuItemComponent::SetItemPos( sal_uInt16 nItemPos )
     184                 :            : {
     185                 :       2880 :     m_nItemPos = nItemPos;
     186                 :       2880 : }
     187                 :            : 
     188                 :            : // -----------------------------------------------------------------------------
     189                 :            : 
     190                 :          0 : void OAccessibleMenuItemComponent::SetAccessibleName( const ::rtl::OUString& sAccessibleName )
     191                 :            : {
     192         [ #  # ]:          0 :     if ( !m_sAccessibleName.equals( sAccessibleName ) )
     193                 :            :     {
     194                 :          0 :         Any aOldValue, aNewValue;
     195         [ #  # ]:          0 :         aOldValue <<= m_sAccessibleName;
     196         [ #  # ]:          0 :         aNewValue <<= sAccessibleName;
     197                 :          0 :         m_sAccessibleName = sAccessibleName;
     198         [ #  # ]:          0 :         NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
     199                 :            :     }
     200                 :          0 : }
     201                 :            : 
     202                 :            : // -----------------------------------------------------------------------------
     203                 :            : 
     204                 :       3794 : ::rtl::OUString OAccessibleMenuItemComponent::GetAccessibleName()
     205                 :            : {
     206                 :       3794 :     ::rtl::OUString sName;
     207         [ +  - ]:       3794 :     if ( m_pParent )
     208                 :            :     {
     209         [ +  - ]:       3794 :         sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
     210 [ +  - ][ +  - ]:       3794 :         sName = m_pParent->GetAccessibleName( nItemId );
                 [ +  - ]
     211         [ +  - ]:       3794 :         if ( sName.isEmpty() )
     212 [ +  - ][ +  - ]:       3794 :             sName = m_pParent->GetItemText( nItemId );
                 [ +  - ]
     213 [ +  - ][ +  - ]:       3794 :         sName = OutputDevice::GetNonMnemonicString( sName );
         [ +  - ][ +  - ]
                 [ +  - ]
     214                 :            :     }
     215                 :            : 
     216                 :       3794 :     return sName;
     217                 :            : }
     218                 :            : 
     219                 :            : // -----------------------------------------------------------------------------
     220                 :            : 
     221                 :          0 : void OAccessibleMenuItemComponent::SetItemText( const ::rtl::OUString& sItemText )
     222                 :            : {
     223                 :          0 :     Any aOldValue, aNewValue;
     224 [ #  # ][ #  # ]:          0 :     if ( OCommonAccessibleText::implInitTextChangedEvent( m_sItemText, sItemText, aOldValue, aNewValue ) )
     225                 :            :     {
     226                 :          0 :         m_sItemText = sItemText;
     227         [ #  # ]:          0 :         NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue );
     228                 :          0 :     }
     229                 :          0 : }
     230                 :            : 
     231                 :            : // -----------------------------------------------------------------------------
     232                 :            : 
     233                 :       3794 : ::rtl::OUString OAccessibleMenuItemComponent::GetItemText()
     234                 :            : {
     235                 :       3794 :     ::rtl::OUString sText;
     236         [ +  - ]:       3794 :     if ( m_pParent )
     237 [ +  - ][ +  - ]:       3794 :         sText = OutputDevice::GetNonMnemonicString( m_pParent->GetItemText( m_pParent->GetItemId( m_nItemPos ) ) );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     238                 :            : 
     239                 :       3794 :     return sText;
     240                 :            : }
     241                 :            : 
     242                 :            : // -----------------------------------------------------------------------------
     243                 :            : 
     244                 :       4310 : void OAccessibleMenuItemComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
     245                 :            : {
     246         [ +  + ]:       4310 :     if ( IsEnabled() )
     247                 :            :     {
     248                 :       4202 :         rStateSet.AddState( AccessibleStateType::ENABLED );
     249                 :       4202 :         rStateSet.AddState( AccessibleStateType::SENSITIVE );
     250                 :            :     }
     251                 :            : 
     252         [ +  + ]:       4310 :     if ( IsVisible() )
     253                 :            :     {
     254                 :        156 :         rStateSet.AddState( AccessibleStateType::VISIBLE );
     255                 :        156 :         rStateSet.AddState( AccessibleStateType::SHOWING );
     256                 :            :     }
     257                 :            : 
     258                 :       4310 :     rStateSet.AddState( AccessibleStateType::OPAQUE );
     259                 :       4310 : }
     260                 :            : 
     261                 :            : // -----------------------------------------------------------------------------
     262                 :            : // OCommonAccessibleComponent
     263                 :            : // -----------------------------------------------------------------------------
     264                 :            : 
     265                 :       2948 : awt::Rectangle OAccessibleMenuItemComponent::implGetBounds() throw (RuntimeException)
     266                 :            : {
     267                 :       2948 :     awt::Rectangle aBounds( 0, 0, 0, 0 );
     268                 :            : 
     269         [ +  - ]:       2948 :     if ( m_pParent )
     270                 :            :     {
     271                 :            :         // get bounding rectangle of the item relative to the containing window
     272         [ +  - ]:       2948 :         aBounds = AWTRectangle( m_pParent->GetBoundingRectangle( m_nItemPos ) );
     273                 :            : 
     274                 :            :         // get position of containing window in screen coordinates
     275                 :       2948 :         Window* pWindow = m_pParent->GetWindow();
     276         [ +  - ]:       2948 :         if ( pWindow )
     277                 :            :         {
     278         [ +  - ]:       2948 :             Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL );
     279                 :       2948 :             awt::Point aWindowScreenLoc = AWTPoint( aRect.TopLeft() );
     280                 :            : 
     281                 :            :             // get position of accessible parent in screen coordinates
     282         [ +  - ]:       2948 :             Reference< XAccessible > xParent = getAccessibleParent();
     283         [ +  - ]:       2948 :             if ( xParent.is() )
     284                 :            :             {
     285 [ +  - ][ +  - ]:       2948 :                 Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY );
                 [ +  - ]
     286         [ +  - ]:       2948 :                 if ( xParentComponent.is() )
     287                 :            :                 {
     288 [ +  - ][ +  - ]:       2948 :                     awt::Point aParentScreenLoc = xParentComponent->getLocationOnScreen();
     289                 :            : 
     290                 :            :                     // calculate bounding rectangle of the item relative to the accessible parent
     291                 :       2948 :                     aBounds.X += aWindowScreenLoc.X - aParentScreenLoc.X;
     292                 :       2948 :                     aBounds.Y += aWindowScreenLoc.Y - aParentScreenLoc.Y;
     293                 :       2948 :                 }
     294                 :       2948 :             }
     295                 :            :         }
     296                 :            :     }
     297                 :            : 
     298                 :       2948 :     return aBounds;
     299                 :            : }
     300                 :            : 
     301                 :            : // -----------------------------------------------------------------------------
     302                 :            : // XComponent
     303                 :            : // -----------------------------------------------------------------------------
     304                 :            : 
     305                 :       3794 : void SAL_CALL OAccessibleMenuItemComponent::disposing()
     306                 :            : {
     307                 :       3794 :     OAccessibleMenuBaseComponent::disposing();
     308                 :            : 
     309                 :       3794 :     m_pParent = NULL;
     310                 :       3794 :     m_sAccessibleName = ::rtl::OUString();
     311                 :       3794 :     m_sItemText = ::rtl::OUString();
     312                 :       3794 : }
     313                 :            : 
     314                 :            : // -----------------------------------------------------------------------------
     315                 :            : // XAccessibleContext
     316                 :            : // -----------------------------------------------------------------------------
     317                 :            : 
     318                 :       7446 : sal_Int32 OAccessibleMenuItemComponent::getAccessibleChildCount() throw (RuntimeException)
     319                 :            : {
     320         [ +  - ]:       7446 :     OExternalLockGuard aGuard( this );
     321                 :            : 
     322         [ +  - ]:       7446 :     return 0;
     323                 :            : }
     324                 :            : 
     325                 :            : // -----------------------------------------------------------------------------
     326                 :            : 
     327                 :          0 : Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
     328                 :            : {
     329         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     330                 :            : 
     331 [ #  # ][ #  # ]:          0 :     if ( i < 0 || i >= getAccessibleChildCount() )
         [ #  # ][ #  # ]
     332         [ #  # ]:          0 :         throw IndexOutOfBoundsException();
     333                 :            : 
     334         [ #  # ]:          0 :     return Reference< XAccessible >();
     335                 :            : }
     336                 :            : 
     337                 :            : // -----------------------------------------------------------------------------
     338                 :            : 
     339                 :       4648 : Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleParent(  ) throw (RuntimeException)
     340                 :            : {
     341         [ +  - ]:       4648 :     OExternalLockGuard aGuard( this );
     342                 :            : 
     343 [ +  - ][ +  - ]:       4648 :     return m_pParent->GetAccessible();
     344                 :            : }
     345                 :            : 
     346                 :            : // -----------------------------------------------------------------------------
     347                 :            : 
     348                 :        104 : sal_Int32 OAccessibleMenuItemComponent::getAccessibleIndexInParent(  ) throw (RuntimeException)
     349                 :            : {
     350         [ +  - ]:        104 :     OExternalLockGuard aGuard( this );
     351                 :            : 
     352         [ +  - ]:        104 :     return m_nItemPos;
     353                 :            : }
     354                 :            : 
     355                 :            : // -----------------------------------------------------------------------------
     356                 :            : 
     357                 :          0 : sal_Int16 OAccessibleMenuItemComponent::getAccessibleRole(  ) throw (RuntimeException)
     358                 :            : {
     359         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     360                 :            : 
     361         [ #  # ]:          0 :     return AccessibleRole::UNKNOWN;
     362                 :            : }
     363                 :            : 
     364                 :            : // -----------------------------------------------------------------------------
     365                 :            : 
     366                 :        402 : ::rtl::OUString OAccessibleMenuItemComponent::getAccessibleDescription( ) throw (RuntimeException)
     367                 :            : {
     368         [ +  - ]:        402 :     OExternalLockGuard aGuard( this );
     369                 :            : 
     370                 :        402 :     ::rtl::OUString sDescription;
     371         [ +  - ]:        402 :     if ( m_pParent )
     372 [ +  - ][ +  - ]:        402 :         sDescription = m_pParent->GetHelpText( m_pParent->GetItemId( m_nItemPos ) );
                 [ +  - ]
     373                 :            : 
     374         [ +  - ]:        402 :     return sDescription;
     375                 :            : }
     376                 :            : 
     377                 :            : // -----------------------------------------------------------------------------
     378                 :            : 
     379                 :        402 : ::rtl::OUString OAccessibleMenuItemComponent::getAccessibleName(  ) throw (RuntimeException)
     380                 :            : {
     381         [ +  - ]:        402 :     OExternalLockGuard aGuard( this );
     382                 :            : 
     383         [ +  - ]:        402 :     return m_sAccessibleName;
     384                 :            : }
     385                 :            : 
     386                 :            : // -----------------------------------------------------------------------------
     387                 :            : 
     388                 :          4 : Reference< XAccessibleRelationSet > OAccessibleMenuItemComponent::getAccessibleRelationSet(  ) throw (RuntimeException)
     389                 :            : {
     390         [ +  - ]:          4 :     OExternalLockGuard aGuard( this );
     391                 :            : 
     392         [ +  - ]:          4 :     utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
     393 [ +  - ][ +  - ]:          4 :     Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
     394         [ +  - ]:          4 :     return xSet;
     395                 :            : }
     396                 :            : 
     397                 :            : // -----------------------------------------------------------------------------
     398                 :            : 
     399                 :          4 : Locale OAccessibleMenuItemComponent::getLocale(  ) throw (IllegalAccessibleComponentStateException, RuntimeException)
     400                 :            : {
     401         [ +  - ]:          4 :     OExternalLockGuard aGuard( this );
     402                 :            : 
     403 [ +  - ][ +  - ]:          4 :     return Application::GetSettings().GetLocale();
                 [ +  - ]
     404                 :            : }
     405                 :            : 
     406                 :            : // -----------------------------------------------------------------------------
     407                 :            : // XAccessibleComponent
     408                 :            : // -----------------------------------------------------------------------------
     409                 :            : 
     410                 :          0 : Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
     411                 :            : {
     412         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     413                 :            : 
     414         [ #  # ]:          0 :     return Reference< XAccessible >();
     415                 :            : }
     416                 :            : 
     417                 :            : // -----------------------------------------------------------------------------
     418                 :            : 
     419                 :          2 : void OAccessibleMenuItemComponent::grabFocus(  ) throw (RuntimeException)
     420                 :            : {
     421                 :            :     // no focus for items
     422                 :          2 : }
     423                 :            : 
     424                 :            : // -----------------------------------------------------------------------------
     425                 :            : 
     426                 :          2 : sal_Int32 OAccessibleMenuItemComponent::getForeground(  ) throw (RuntimeException)
     427                 :            : {
     428         [ +  - ]:          2 :     OExternalLockGuard aGuard( this );
     429                 :            : 
     430                 :          2 :     sal_Int32 nColor = 0;
     431         [ +  - ]:          2 :     Reference< XAccessible > xParent = getAccessibleParent();
     432         [ +  - ]:          2 :     if ( xParent.is() )
     433                 :            :     {
     434 [ +  - ][ +  - ]:          2 :         Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
                 [ +  - ]
     435         [ +  - ]:          2 :         if ( xParentComp.is() )
     436 [ +  - ][ +  - ]:          2 :             nColor = xParentComp->getForeground();
     437                 :            :     }
     438                 :            : 
     439         [ +  - ]:          2 :     return nColor;
     440                 :            : }
     441                 :            : 
     442                 :            : // -----------------------------------------------------------------------------
     443                 :            : 
     444                 :          2 : sal_Int32 OAccessibleMenuItemComponent::getBackground(  ) throw (RuntimeException)
     445                 :            : {
     446         [ +  - ]:          2 :     OExternalLockGuard aGuard( this );
     447                 :            : 
     448                 :          2 :     sal_Int32 nColor = 0;
     449         [ +  - ]:          2 :     Reference< XAccessible > xParent = getAccessibleParent();
     450         [ +  - ]:          2 :     if ( xParent.is() )
     451                 :            :     {
     452 [ +  - ][ +  - ]:          2 :         Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
                 [ +  - ]
     453         [ +  - ]:          2 :         if ( xParentComp.is() )
     454 [ +  - ][ +  - ]:          2 :             nColor = xParentComp->getBackground();
     455                 :            :     }
     456                 :            : 
     457         [ +  - ]:          2 :     return nColor;
     458                 :            : }
     459                 :            : 
     460                 :            : // -----------------------------------------------------------------------------
     461                 :            : // XAccessibleExtendedComponent
     462                 :            : // -----------------------------------------------------------------------------
     463                 :            : 
     464                 :          6 : Reference< awt::XFont > OAccessibleMenuItemComponent::getFont(  ) throw (RuntimeException)
     465                 :            : {
     466         [ +  - ]:          6 :     OExternalLockGuard aGuard( this );
     467                 :            : 
     468                 :          6 :     Reference< awt::XFont > xFont;
     469         [ +  - ]:          6 :     Reference< XAccessible > xParent = getAccessibleParent();
     470         [ +  - ]:          6 :     if ( xParent.is() )
     471                 :            :     {
     472 [ +  - ][ +  - ]:          6 :         Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
                 [ +  - ]
     473         [ +  - ]:          6 :         if ( xParentComp.is() )
     474 [ +  - ][ +  - ]:          6 :             xFont = xParentComp->getFont();
                 [ +  - ]
     475                 :            :     }
     476                 :            : 
     477         [ +  - ]:          6 :     return xFont;
     478                 :            : }
     479                 :            : 
     480                 :            : // -----------------------------------------------------------------------------
     481                 :            : 
     482                 :          4 : ::rtl::OUString OAccessibleMenuItemComponent::getTitledBorderText(  ) throw (RuntimeException)
     483                 :            : {
     484         [ +  - ]:          4 :     OExternalLockGuard aGuard( this );
     485                 :            : 
     486         [ +  - ]:          4 :     return ::rtl::OUString();
     487                 :            : }
     488                 :            : 
     489                 :            : // -----------------------------------------------------------------------------
     490                 :            : 
     491                 :          4 : ::rtl::OUString OAccessibleMenuItemComponent::getToolTipText(  ) throw (RuntimeException)
     492                 :            : {
     493         [ +  - ]:          4 :     OExternalLockGuard aGuard( this );
     494                 :            : 
     495                 :          4 :     ::rtl::OUString sRet;
     496         [ +  - ]:          4 :     if ( m_pParent )
     497 [ +  - ][ +  - ]:          4 :         sRet = m_pParent->GetTipHelpText( m_pParent->GetItemId( m_nItemPos ) );
                 [ +  - ]
     498                 :            : 
     499         [ +  - ]:          4 :     return sRet;
     500                 :            : }
     501                 :            : 
     502                 :            : // -----------------------------------------------------------------------------
     503                 :            : 
     504                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10