LCOV - code coverage report
Current view: top level - svtools/source/control - toolbarmenuacc.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 418 0.0 %
Date: 2012-08-25 Functions: 0 66 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 682 0.0 %

           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                 :            : 
      30                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      31                 :            : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      32                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      33                 :            : 
      34                 :            : #include <unotools/accessiblestatesethelper.hxx>
      35                 :            : 
      36                 :            : #include <vcl/svapp.hxx>
      37                 :            : 
      38                 :            : #include "svtools/toolbarmenu.hxx"
      39                 :            : 
      40                 :            : #include "toolbarmenuimp.hxx"
      41                 :            : 
      42                 :            : using ::rtl::OUString;
      43                 :            : 
      44                 :            : using namespace ::com::sun::star;
      45                 :            : using namespace ::com::sun::star::uno;
      46                 :            : using namespace ::com::sun::star::lang;
      47                 :            : using namespace ::com::sun::star::accessibility;
      48                 :            : 
      49                 :            : namespace svtools {
      50                 :            : 
      51                 :            : // ------------------
      52                 :            : // - ToolbarMenuAcc -
      53                 :            : // ------------------
      54                 :            : 
      55                 :          0 : ToolbarMenuAcc::ToolbarMenuAcc( ToolbarMenu_Impl& rParent )
      56                 :            : : ToolbarMenuAccComponentBase(m_aMutex)
      57                 :            : , mpParent( &rParent )
      58         [ #  # ]:          0 : , mbIsFocused(false)
      59                 :            : {
      60 [ #  # ][ #  # ]:          0 :     mpParent->mrMenu.AddEventListener( LINK( this, ToolbarMenuAcc, WindowEventListener ) );
      61                 :          0 : }
      62                 :            : 
      63                 :            : // -----------------------------------------------------------------------------
      64                 :            : 
      65         [ #  # ]:          0 : ToolbarMenuAcc::~ToolbarMenuAcc()
      66                 :            : {
      67         [ #  # ]:          0 :     if( mpParent )
      68 [ #  # ][ #  # ]:          0 :         mpParent->mrMenu.RemoveEventListener( LINK( this, ToolbarMenuAcc, WindowEventListener ) );
      69         [ #  # ]:          0 : }
      70                 :            : 
      71                 :            : // -----------------------------------------------------------------------
      72                 :            : 
      73                 :          0 : IMPL_LINK( ToolbarMenuAcc, WindowEventListener, VclSimpleEvent*, pEvent )
      74                 :            : {
      75                 :            :     DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
      76                 :            : 
      77                 :            :     /* Ignore VCLEVENT_WINDOW_ENDPOPUPMODE, because the UNO accessibility wrapper
      78                 :            :      * might have been destroyed by the previous VCLEventListener (if no AT tool
      79                 :            :      * is running), e.g. sub-toolbars in impress.
      80                 :            :      */
      81 [ #  # ][ #  # ]:          0 :     if ( mpParent && pEvent && pEvent->ISA( VclWindowEvent ) && (pEvent->GetId() != VCLEVENT_WINDOW_ENDPOPUPMODE) )
         [ #  # ][ #  # ]
                 [ #  # ]
      82                 :            :     {
      83                 :            :         DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "Window???" );
      84 [ #  # ][ #  # ]:          0 :         if( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
                 [ #  # ]
      85                 :            :         {
      86                 :          0 :             ProcessWindowEvent( *(VclWindowEvent*)pEvent );
      87                 :            :         }
      88                 :            :     }
      89                 :          0 :     return 0;
      90                 :            : }
      91                 :            : 
      92                 :            : // -----------------------------------------------------------------------
      93                 :            : 
      94                 :          0 : void ToolbarMenuAcc::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
      95                 :            : {
      96                 :          0 :     Any aOldValue, aNewValue;
      97                 :            : 
      98   [ #  #  #  # ]:          0 :     switch ( rVclWindowEvent.GetId() )
      99                 :            :     {
     100                 :            :         case VCLEVENT_OBJECT_DYING:
     101                 :            :         {
     102 [ #  # ][ #  # ]:          0 :             mpParent->mrMenu.RemoveEventListener( LINK( this, ToolbarMenuAcc, WindowEventListener ) );
     103                 :          0 :             mpParent = 0;
     104                 :            :         }
     105                 :          0 :         break;
     106                 :            : 
     107                 :            :         case VCLEVENT_WINDOW_GETFOCUS:
     108                 :            :         {
     109         [ #  # ]:          0 :             if( !mbIsFocused )
     110                 :            :             {
     111         [ #  # ]:          0 :                 mpParent->notifyHighlightedEntry();
     112                 :          0 :                 mbIsFocused = true;
     113                 :            :             }
     114                 :            :         }
     115                 :          0 :         break;
     116                 :            :         case VCLEVENT_WINDOW_LOSEFOCUS:
     117                 :            :         {
     118         [ #  # ]:          0 :             if( mbIsFocused )
     119                 :            :             {
     120                 :          0 :                 mbIsFocused = false;
     121                 :            :             }
     122                 :            :         }
     123                 :          0 :         break;
     124                 :            :         default:
     125                 :            :         {
     126                 :            :         }
     127                 :          0 :         break;
     128                 :          0 :     }
     129                 :          0 : }
     130                 :            : 
     131                 :            : // -----------------------------------------------------------------------
     132                 :            : 
     133                 :          0 : void ToolbarMenuAcc::FireAccessibleEvent( short nEventId, const Any& rOldValue, const Any& rNewValue )
     134                 :            : {
     135         [ #  # ]:          0 :     if( nEventId )
     136                 :            :     {
     137         [ #  # ]:          0 :         EventListenerVector                  aTmpListeners( mxEventListeners );
     138   [ #  #  #  # ]:          0 :         EventListenerVector::const_iterator  aIter( aTmpListeners.begin() );
     139         [ #  # ]:          0 :         AccessibleEventObject aEvtObject;
     140                 :            : 
     141                 :          0 :         aEvtObject.EventId = nEventId;
     142         [ #  # ]:          0 :         aEvtObject.Source = static_cast<XWeak*>(this);
     143                 :          0 :         aEvtObject.NewValue = rNewValue;
     144                 :          0 :         aEvtObject.OldValue = rOldValue;
     145                 :            : 
     146 [ #  # ][ #  # ]:          0 :         while( aIter != aTmpListeners.end() )
     147                 :            :         {
     148                 :            :             try
     149                 :            :             {
     150 [ #  # ][ #  # ]:          0 :                 (*aIter)->notifyEvent( aEvtObject );
     151                 :            :             }
     152         [ #  # ]:          0 :             catch( Exception& )
     153                 :            :             {
     154                 :            :             }
     155                 :            : 
     156         [ #  # ]:          0 :             aIter++;
     157         [ #  # ]:          0 :         }
     158                 :            :     }
     159                 :          0 : }
     160                 :            : 
     161                 :            : // -----------------------------------------------------------------------------
     162                 :            : 
     163                 :          0 : Reference< XAccessibleContext > SAL_CALL ToolbarMenuAcc::getAccessibleContext() throw (RuntimeException)
     164                 :            : {
     165                 :          0 :     ThrowIfDisposed();
     166                 :          0 :     return this;
     167                 :            : }
     168                 :            : 
     169                 :            : // -----------------------------------------------------------------------------
     170                 :            : 
     171                 :          0 : sal_Int32 SAL_CALL ToolbarMenuAcc::getAccessibleChildCount() throw (RuntimeException)
     172                 :            : {
     173         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     174         [ #  # ]:          0 :     ThrowIfDisposed();
     175                 :            : 
     176 [ #  # ][ #  # ]:          0 :     return mpParent->getAccessibleChildCount();
     177                 :            : }
     178                 :            : 
     179                 :            : // -----------------------------------------------------------------------------
     180                 :            : 
     181                 :          0 : Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
     182                 :            : {
     183         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     184         [ #  # ]:          0 :     ThrowIfDisposed();
     185                 :            : 
     186 [ #  # ][ #  # ]:          0 :     return mpParent->getAccessibleChild(i);
     187                 :            : }
     188                 :            : 
     189                 :            : // -----------------------------------------------------------------------------
     190                 :            : 
     191                 :          0 : Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleParent() throw (RuntimeException)
     192                 :            : {
     193         [ #  # ]:          0 :     ThrowIfDisposed();
     194         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     195                 :            : 
     196                 :          0 :     Reference< XAccessible > xRet;
     197                 :            : 
     198         [ #  # ]:          0 :     Window* pParent = mpParent->mrMenu.GetParent();
     199         [ #  # ]:          0 :     if( pParent )
     200 [ #  # ][ #  # ]:          0 :         xRet = pParent->GetAccessible();
     201                 :            : 
     202         [ #  # ]:          0 :     return xRet;
     203                 :            : }
     204                 :            : 
     205                 :            : // -----------------------------------------------------------------------------
     206                 :            : 
     207                 :          0 : sal_Int32 SAL_CALL ToolbarMenuAcc::getAccessibleIndexInParent() throw (RuntimeException)
     208                 :            : {
     209         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     210         [ #  # ]:          0 :     ThrowIfDisposed();
     211                 :            : 
     212         [ #  # ]:          0 :     Window* pParent = mpParent->mrMenu.GetParent();
     213         [ #  # ]:          0 :     if( pParent )
     214                 :            :     {
     215 [ #  # ][ #  # ]:          0 :         for( sal_uInt16 i = 0, nCount = pParent->GetChildCount(); i < nCount ; i++ )
     216                 :            :         {
     217 [ #  # ][ #  # ]:          0 :             if( pParent->GetChild( i ) == &mpParent->mrMenu )
     218                 :          0 :                 return i;
     219                 :            :         }
     220                 :            :     }
     221                 :            : 
     222         [ #  # ]:          0 :     return 0;
     223                 :            : }
     224                 :            : 
     225                 :            : // -----------------------------------------------------------------------------
     226                 :            : 
     227                 :          0 : sal_Int16 SAL_CALL ToolbarMenuAcc::getAccessibleRole() throw (RuntimeException)
     228                 :            : {
     229                 :          0 :     ThrowIfDisposed();
     230                 :          0 :     return AccessibleRole::LIST;
     231                 :            : }
     232                 :            : 
     233                 :            : // -----------------------------------------------------------------------------
     234                 :            : 
     235                 :          0 : OUString SAL_CALL ToolbarMenuAcc::getAccessibleDescription() throw (RuntimeException)
     236                 :            : {
     237                 :          0 :     ThrowIfDisposed();
     238                 :          0 :     return OUString( RTL_CONSTASCII_USTRINGPARAM( "ToolbarMenu" ) );
     239                 :            : }
     240                 :            : 
     241                 :            : // -----------------------------------------------------------------------------
     242                 :            : 
     243                 :          0 : OUString SAL_CALL ToolbarMenuAcc::getAccessibleName() throw (RuntimeException)
     244                 :            : {
     245         [ #  # ]:          0 :     ThrowIfDisposed();
     246         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     247                 :          0 :     OUString aRet;
     248                 :            : 
     249         [ #  # ]:          0 :     if( mpParent )
     250 [ #  # ][ #  # ]:          0 :         aRet = mpParent->mrMenu.GetAccessibleName();
                 [ #  # ]
     251                 :            : 
     252         [ #  # ]:          0 :     if( aRet.isEmpty() )
     253                 :            :     {
     254         [ #  # ]:          0 :         Window* pLabel = mpParent->mrMenu.GetAccessibleRelationLabeledBy();
     255 [ #  # ][ #  # ]:          0 :         if( pLabel && pLabel != &mpParent->mrMenu )
     256 [ #  # ][ #  # ]:          0 :             aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() );
         [ #  # ][ #  # ]
                 [ #  # ]
     257                 :            :     }
     258                 :            : 
     259         [ #  # ]:          0 :     return aRet;
     260                 :            : }
     261                 :            : 
     262                 :            : // -----------------------------------------------------------------------------
     263                 :            : 
     264                 :          0 : Reference< XAccessibleRelationSet > SAL_CALL ToolbarMenuAcc::getAccessibleRelationSet() throw (RuntimeException)
     265                 :            : {
     266                 :          0 :     ThrowIfDisposed();
     267                 :          0 :     return Reference< XAccessibleRelationSet >();
     268                 :            : }
     269                 :            : 
     270                 :            : // -----------------------------------------------------------------------------
     271                 :            : 
     272                 :          0 : Reference< XAccessibleStateSet > SAL_CALL ToolbarMenuAcc::getAccessibleStateSet() throw (RuntimeException)
     273                 :            : {
     274                 :          0 :     ThrowIfDisposed();
     275         [ #  # ]:          0 :     ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper();
     276                 :            : 
     277                 :            :     // Set some states.
     278                 :          0 :     pStateSet->AddState (AccessibleStateType::ENABLED);
     279                 :          0 :     pStateSet->AddState (AccessibleStateType::SENSITIVE);
     280                 :          0 :     pStateSet->AddState (AccessibleStateType::SHOWING);
     281                 :          0 :     pStateSet->AddState (AccessibleStateType::VISIBLE);
     282                 :          0 :     pStateSet->AddState (AccessibleStateType::MANAGES_DESCENDANTS);
     283                 :          0 :     pStateSet->AddState (AccessibleStateType::FOCUSABLE);
     284         [ #  # ]:          0 :     if (mbIsFocused)
     285                 :          0 :         pStateSet->AddState (AccessibleStateType::FOCUSED);
     286                 :            : 
     287         [ #  # ]:          0 :     return pStateSet;
     288                 :            : }
     289                 :            : 
     290                 :            : // -----------------------------------------------------------------------------
     291                 :            : 
     292                 :          0 : Locale SAL_CALL ToolbarMenuAcc::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException)
     293                 :            : {
     294         [ #  # ]:          0 :     ThrowIfDisposed();
     295         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     296                 :          0 :     const ::rtl::OUString aEmptyStr;
     297         [ #  # ]:          0 :     Reference< XAccessible > xParent( getAccessibleParent() );
     298                 :          0 :     Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr );
     299                 :            : 
     300         [ #  # ]:          0 :     if( xParent.is() )
     301                 :            :     {
     302 [ #  # ][ #  # ]:          0 :         Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
     303                 :            : 
     304         [ #  # ]:          0 :         if( xParentContext.is() )
     305 [ #  # ][ #  # ]:          0 :             aRet = xParentContext->getLocale ();
     306                 :            :     }
     307                 :            : 
     308         [ #  # ]:          0 :     return aRet;
     309                 :            : }
     310                 :            : 
     311                 :            : // -----------------------------------------------------------------------------
     312                 :            : 
     313                 :          0 : void SAL_CALL ToolbarMenuAcc::addEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException)
     314                 :            : {
     315         [ #  # ]:          0 :     ThrowIfDisposed();
     316         [ #  # ]:          0 :     ::osl::MutexGuard aGuard(m_aMutex);
     317                 :            : 
     318         [ #  # ]:          0 :     if( rxListener.is() )
     319                 :            :     {
     320         [ #  # ]:          0 :            EventListenerVector::const_iterator aIter = mxEventListeners.begin();
     321                 :          0 :         bool bFound = false;
     322                 :            : 
     323 [ #  # ][ #  # ]:          0 :         while( !bFound && ( aIter != mxEventListeners.end() ) )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     324                 :            :         {
     325 [ #  # ][ #  # ]:          0 :             if( *aIter == rxListener )
     326                 :          0 :                 bFound = true;
     327                 :            :             else
     328                 :          0 :                 ++aIter;
     329                 :            :         }
     330                 :            : 
     331         [ #  # ]:          0 :         if (!bFound)
     332         [ #  # ]:          0 :             mxEventListeners.push_back( rxListener );
     333         [ #  # ]:          0 :     }
     334                 :          0 : }
     335                 :            : 
     336                 :            : // -----------------------------------------------------------------------------
     337                 :            : 
     338                 :          0 : void SAL_CALL ToolbarMenuAcc::removeEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException)
     339                 :            : {
     340         [ #  # ]:          0 :     ThrowIfDisposed();
     341         [ #  # ]:          0 :     ::osl::MutexGuard aGuard(m_aMutex);
     342                 :            : 
     343         [ #  # ]:          0 :     if( rxListener.is() )
     344                 :            :     {
     345                 :          0 :            EventListenerVector::iterator aIter = mxEventListeners.begin();
     346                 :          0 :         bool bFound = false;
     347                 :            : 
     348 [ #  # ][ #  # ]:          0 :         while( !bFound && ( aIter != mxEventListeners.end() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     349                 :            :         {
     350 [ #  # ][ #  # ]:          0 :             if( *aIter == rxListener )
     351                 :            :             {
     352         [ #  # ]:          0 :                 mxEventListeners.erase( aIter );
     353                 :          0 :                 bFound = true;
     354                 :            :             }
     355                 :            :             else
     356                 :          0 :                 ++aIter;
     357                 :            :         }
     358         [ #  # ]:          0 :     }
     359                 :          0 : }
     360                 :            : 
     361                 :            : // -----------------------------------------------------------------------------
     362                 :            : 
     363                 :          0 : sal_Bool SAL_CALL ToolbarMenuAcc::containsPoint( const awt::Point& aPoint ) throw (RuntimeException)
     364                 :            : {
     365         [ #  # ]:          0 :     ThrowIfDisposed();
     366         [ #  # ]:          0 :     const awt::Rectangle aRect( getBounds() );
     367                 :          0 :     const Point aSize( aRect.Width, aRect.Height );
     368                 :          0 :     const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
     369                 :            : 
     370 [ #  # ][ #  # ]:          0 :     return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
     371                 :            : }
     372                 :            : 
     373                 :            : // -----------------------------------------------------------------------------
     374                 :            : 
     375                 :          0 : Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
     376                 :            : {
     377         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     378         [ #  # ]:          0 :     ThrowIfDisposed();
     379                 :            : 
     380                 :          0 :     Reference< XAccessible > xRet;
     381                 :            : 
     382                 :          0 :     const Point aVclPoint( aPoint.X, aPoint.Y );
     383                 :            : 
     384                 :          0 :     const int nEntryCount = mpParent->maEntryVector.size();
     385 [ #  # ][ #  # ]:          0 :     for( int nEntry = 0; (nEntry < nEntryCount) && !xRet.is(); nEntry++ )
                 [ #  # ]
     386                 :            :     {
     387                 :          0 :         ToolbarMenuEntry* pEntry = mpParent->maEntryVector[nEntry];
     388 [ #  # ][ #  # ]:          0 :         if( pEntry && pEntry->maRect.IsInside( aVclPoint ) )
         [ #  # ][ #  # ]
     389                 :            :         {
     390         [ #  # ]:          0 :             if( pEntry->mpControl )
     391                 :            :             {
     392                 :          0 :                 awt::Point aChildPoint( aPoint.X - pEntry->maRect.Left(), aPoint.Y - pEntry->maRect.Top() );
     393 [ #  # ][ #  # ]:          0 :                 Reference< XAccessibleComponent > xComp( pEntry->GetAccessible(true), UNO_QUERY_THROW );
     394 [ #  # ][ #  # ]:          0 :                 xRet = xComp->getAccessibleAtPoint(aChildPoint);
                 [ #  # ]
     395                 :            :             }
     396                 :            :             else
     397                 :            :             {
     398 [ #  # ][ #  # ]:          0 :                 xRet = Reference< XAccessible >( pEntry->GetAccessible(true), UNO_QUERY );
                 [ #  # ]
     399                 :            :             }
     400                 :            :         }
     401                 :            :     }
     402         [ #  # ]:          0 :     return xRet;
     403                 :            : }
     404                 :            : 
     405                 :            : // -----------------------------------------------------------------------------
     406                 :            : 
     407                 :          0 : awt::Rectangle SAL_CALL ToolbarMenuAcc::getBounds() throw (RuntimeException)
     408                 :            : {
     409         [ #  # ]:          0 :     ThrowIfDisposed();
     410         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     411         [ #  # ]:          0 :     const Point         aOutPos( mpParent->mrMenu.GetPosPixel() );
     412         [ #  # ]:          0 :     const Size          aOutSize( mpParent->mrMenu.GetOutputSizePixel() );
     413                 :          0 :     awt::Rectangle      aRet;
     414                 :            : 
     415                 :          0 :     aRet.X = aOutPos.X();
     416                 :          0 :     aRet.Y = aOutPos.Y();
     417                 :          0 :     aRet.Width = aOutSize.Width();
     418                 :          0 :     aRet.Height = aOutSize.Height();
     419                 :            : 
     420         [ #  # ]:          0 :     return aRet;
     421                 :            : }
     422                 :            : 
     423                 :            : // -----------------------------------------------------------------------------
     424                 :            : 
     425                 :          0 : awt::Point SAL_CALL ToolbarMenuAcc::getLocation() throw (RuntimeException)
     426                 :            : {
     427         [ #  # ]:          0 :     ThrowIfDisposed();
     428         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     429         [ #  # ]:          0 :     const Point aOutPos( mpParent->mrMenu.GetPosPixel() );
     430         [ #  # ]:          0 :     return awt::Point( aOutPos.X(), aOutPos.Y() );
     431                 :            : }
     432                 :            : 
     433                 :            : // -----------------------------------------------------------------------------
     434                 :            : 
     435                 :          0 : awt::Point SAL_CALL ToolbarMenuAcc::getLocationOnScreen()  throw (RuntimeException)
     436                 :            : {
     437         [ #  # ]:          0 :     ThrowIfDisposed();
     438         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     439         [ #  # ]:          0 :     const Point aScreenPos( mpParent->mrMenu.OutputToAbsoluteScreenPixel( Point() ) );
     440         [ #  # ]:          0 :     return awt::Point( aScreenPos.X(), aScreenPos.Y() );
     441                 :            : }
     442                 :            : 
     443                 :            : // -----------------------------------------------------------------------------
     444                 :            : 
     445                 :          0 : awt::Size SAL_CALL ToolbarMenuAcc::getSize() throw (RuntimeException)
     446                 :            : {
     447         [ #  # ]:          0 :     ThrowIfDisposed();
     448         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     449         [ #  # ]:          0 :     const Size aOutSize( mpParent->mrMenu.GetOutputSizePixel() );
     450         [ #  # ]:          0 :     return awt::Size( aOutSize.Width(), aOutSize.Height() );
     451                 :            : }
     452                 :            : 
     453                 :            : // -----------------------------------------------------------------------------
     454                 :            : 
     455                 :          0 : void SAL_CALL ToolbarMenuAcc::grabFocus() throw (RuntimeException)
     456                 :            : {
     457         [ #  # ]:          0 :     ThrowIfDisposed();
     458         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     459 [ #  # ][ #  # ]:          0 :     mpParent->mrMenu.GrabFocus();
     460                 :          0 : }
     461                 :            : 
     462                 :            : // -----------------------------------------------------------------------------
     463                 :            : 
     464                 :          0 : Any SAL_CALL ToolbarMenuAcc::getAccessibleKeyBinding() throw (RuntimeException)
     465                 :            : {
     466                 :          0 :     ThrowIfDisposed();
     467                 :          0 :     return Any();
     468                 :            : }
     469                 :            : 
     470                 :            : // -----------------------------------------------------------------------------
     471                 :            : 
     472                 :          0 : sal_Int32 SAL_CALL ToolbarMenuAcc::getForeground() throw (RuntimeException)
     473                 :            : {
     474                 :          0 :     ThrowIfDisposed();
     475                 :          0 :     sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetMenuTextColor().GetColor();
     476                 :          0 :     return static_cast<sal_Int32>(nColor);
     477                 :            : }
     478                 :            : 
     479                 :            : // -----------------------------------------------------------------------------
     480                 :            : 
     481                 :          0 : sal_Int32 SAL_CALL ToolbarMenuAcc::getBackground() throw (RuntimeException)
     482                 :            : {
     483                 :          0 :     ThrowIfDisposed();
     484                 :          0 :     sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor();
     485                 :          0 :     return static_cast<sal_Int32>(nColor);
     486                 :            : }
     487                 :            : 
     488                 :            : // -----------------------------------------------------------------------------
     489                 :            : 
     490                 :          0 : void SAL_CALL ToolbarMenuAcc::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     491                 :            : {
     492         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     493         [ #  # ]:          0 :     ThrowIfDisposed();
     494                 :            : 
     495 [ #  # ][ #  # ]:          0 :     mpParent->selectAccessibleChild( nChildIndex );
     496                 :          0 : }
     497                 :            : 
     498                 :            : // -----------------------------------------------------------------------------
     499                 :            : 
     500                 :          0 : sal_Bool SAL_CALL ToolbarMenuAcc::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     501                 :            : {
     502         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     503         [ #  # ]:          0 :     ThrowIfDisposed();
     504 [ #  # ][ #  # ]:          0 :     return mpParent->isAccessibleChildSelected( nChildIndex );
     505                 :            : }
     506                 :            : 
     507                 :            : // -----------------------------------------------------------------------------
     508                 :            : 
     509                 :          0 : void SAL_CALL ToolbarMenuAcc::clearAccessibleSelection() throw (RuntimeException)
     510                 :            : {
     511         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     512         [ #  # ]:          0 :     ThrowIfDisposed();
     513 [ #  # ][ #  # ]:          0 :     mpParent->clearAccessibleSelection();
     514                 :          0 : }
     515                 :            : 
     516                 :            : // -----------------------------------------------------------------------------
     517                 :            : 
     518                 :          0 : void SAL_CALL ToolbarMenuAcc::selectAllAccessibleChildren() throw (RuntimeException)
     519                 :            : {
     520                 :          0 :     ThrowIfDisposed();
     521                 :            :     // unsupported due to single selection only
     522                 :          0 : }
     523                 :            : 
     524                 :            : // -----------------------------------------------------------------------------
     525                 :            : 
     526                 :          0 : sal_Int32 SAL_CALL ToolbarMenuAcc::getSelectedAccessibleChildCount() throw (RuntimeException)
     527                 :            : {
     528         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     529         [ #  # ]:          0 :     ThrowIfDisposed();
     530                 :            : 
     531 [ #  # ][ #  # ]:          0 :     return mpParent->mnHighlightedEntry != -1 ? 1 : 0;
     532                 :            : }
     533                 :            : 
     534                 :            : // -----------------------------------------------------------------------------
     535                 :            : 
     536                 :          0 : Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     537                 :            : {
     538         [ #  # ]:          0 :     ThrowIfDisposed();
     539         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     540                 :            : 
     541 [ #  # ][ #  # ]:          0 :     if( (mpParent->mnHighlightedEntry != -1) && (nSelectedChildIndex == 0) )
     542                 :            :     {
     543                 :          0 :         ToolbarMenuEntry* pEntry = mpParent->maEntryVector[ mpParent->mnHighlightedEntry ];
     544         [ #  # ]:          0 :         if( pEntry )
     545                 :            :         {
     546         [ #  # ]:          0 :             if( pEntry->mpControl )
     547                 :            :             {
     548 [ #  # ][ #  # ]:          0 :                 Reference< XAccessibleSelection > xSel( pEntry->GetAccessible(true), UNO_QUERY_THROW );
     549 [ #  # ][ #  # ]:          0 :                 return xSel->getSelectedAccessibleChild(0);
     550                 :            :             }
     551                 :            :             else
     552 [ #  # ][ #  # ]:          0 :                 return Reference< XAccessible >( pEntry->GetAccessible(true), UNO_QUERY );
     553                 :            :         }
     554                 :            :     }
     555                 :            : 
     556 [ #  # ][ #  # ]:          0 :     throw IndexOutOfBoundsException();
     557                 :            : }
     558                 :            : 
     559                 :            : // -----------------------------------------------------------------------------
     560                 :            : 
     561                 :          0 : void SAL_CALL ToolbarMenuAcc::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     562                 :            : {
     563         [ #  # ]:          0 :     ThrowIfDisposed();
     564         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     565                 :            :     // Because of the single selection we can reset the whole selection when
     566                 :            :     // the specified child is currently selected.
     567 [ #  # ][ #  # ]:          0 :     if (isAccessibleChildSelected(nChildIndex))
     568 [ #  # ][ #  # ]:          0 :         mpParent->clearAccessibleSelection();
     569                 :          0 : }
     570                 :            : 
     571                 :            : // -----------------------------------------------------------------------------
     572                 :            : 
     573                 :          0 : void SAL_CALL ToolbarMenuAcc::disposing (void)
     574                 :            : {
     575         [ #  # ]:          0 :     EventListenerVector aListenerListCopy;
     576                 :            : 
     577                 :            :     {
     578                 :            :         // Make a copy of the list and clear the original.
     579         [ #  # ]:          0 :         const SolarMutexGuard aSolarGuard;
     580         [ #  # ]:          0 :         ::osl::MutexGuard aGuard (m_aMutex);
     581         [ #  # ]:          0 :         aListenerListCopy = mxEventListeners;
     582                 :          0 :         mxEventListeners.clear();
     583                 :            : 
     584                 :            :         // Reset the pointer to the parent.  It has to be the one who has
     585                 :            :         // disposed us because he is dying.
     586 [ #  # ][ #  # ]:          0 :         mpParent = NULL;
     587                 :            :     }
     588                 :            : 
     589                 :            :     // Inform all listeners that this objects is disposing.
     590         [ #  # ]:          0 :     EventListenerVector::const_iterator aListenerIterator (aListenerListCopy.begin());
     591 [ #  # ][ #  # ]:          0 :     EventObject aEvent (static_cast<XAccessible*>(this));
                 [ #  # ]
     592 [ #  # ][ #  # ]:          0 :     while(aListenerIterator != aListenerListCopy.end())
     593                 :            :     {
     594                 :            :         try
     595                 :            :         {
     596 [ #  # ][ #  # ]:          0 :             (*aListenerIterator)->disposing (aEvent);
     597                 :            :         }
     598         [ #  # ]:          0 :         catch( Exception& )
     599                 :            :         {
     600                 :            :             // Ignore exceptions.
     601                 :            :         }
     602                 :            : 
     603                 :          0 :         ++aListenerIterator;
     604         [ #  # ]:          0 :     }
     605                 :          0 : }
     606                 :            : 
     607                 :          0 : void ToolbarMenuAcc::ThrowIfDisposed (void) throw (DisposedException)
     608                 :            : {
     609 [ #  # ][ #  # ]:          0 :     if(rBHelper.bDisposed || rBHelper.bInDispose || !mpParent)
                 [ #  # ]
     610                 :            :     {
     611 [ #  # ][ #  # ]:          0 :         throw DisposedException ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")), static_cast<XWeak*>(this));
                 [ #  # ]
     612                 :            :     }
     613                 :          0 : }
     614                 :            : 
     615                 :            : // -----------------------
     616                 :            : // - ToolbarMenuEntryAcc -
     617                 :            : // -----------------------
     618                 :            : 
     619                 :          0 : ToolbarMenuEntryAcc::ToolbarMenuEntryAcc( ToolbarMenuEntry* pParent )
     620                 :            : : ToolbarMenuEntryAccBase( m_aMutex )
     621 [ #  # ][ #  # ]:          0 : , mpParent( pParent )
     622                 :            : {
     623                 :          0 : }
     624                 :            : 
     625                 :            : // -----------------------------------------------------------------------------
     626                 :            : 
     627 [ #  # ][ #  # ]:          0 : ToolbarMenuEntryAcc::~ToolbarMenuEntryAcc()
     628                 :            : {
     629         [ #  # ]:          0 : }
     630                 :            : 
     631                 :            : // -----------------------------------------------------------------------
     632                 :            : 
     633                 :          0 : void SAL_CALL ToolbarMenuEntryAcc::disposing (void)
     634                 :            : {
     635         [ #  # ]:          0 :     EventListenerVector aListenerListCopy;
     636                 :            : 
     637                 :            :     {
     638                 :            :         // Make a copy of the list and clear the original.
     639         [ #  # ]:          0 :         const SolarMutexGuard aSolarGuard;
     640         [ #  # ]:          0 :         ::osl::MutexGuard aGuard (m_aMutex);
     641         [ #  # ]:          0 :         aListenerListCopy = mxEventListeners;
     642                 :          0 :         mxEventListeners.clear();
     643                 :            : 
     644                 :            :         // Reset the pointer to the parent.  It has to be the one who has
     645                 :            :         // disposed us because he is dying.
     646 [ #  # ][ #  # ]:          0 :         mpParent = NULL;
     647                 :            :     }
     648                 :            : 
     649                 :            :     // Inform all listeners that this objects is disposing.
     650         [ #  # ]:          0 :     EventListenerVector::const_iterator aListenerIterator (aListenerListCopy.begin());
     651 [ #  # ][ #  # ]:          0 :     EventObject aEvent (static_cast<XAccessible*>(this));
                 [ #  # ]
     652 [ #  # ][ #  # ]:          0 :     while(aListenerIterator != aListenerListCopy.end())
     653                 :            :     {
     654                 :            :         try
     655                 :            :         {
     656 [ #  # ][ #  # ]:          0 :             (*aListenerIterator)->disposing (aEvent);
     657                 :            :         }
     658         [ #  # ]:          0 :         catch( Exception& )
     659                 :            :         {
     660                 :            :             // Ignore exceptions.
     661                 :            :         }
     662                 :            : 
     663                 :          0 :         ++aListenerIterator;
     664         [ #  # ]:          0 :     }
     665                 :          0 : }
     666                 :            : // -----------------------------------------------------------------------------
     667                 :            : 
     668                 :          0 : Reference< XAccessibleContext > SAL_CALL ToolbarMenuEntryAcc::getAccessibleContext() throw (RuntimeException)
     669                 :            : {
     670                 :          0 :     return this;
     671                 :            : }
     672                 :            : 
     673                 :            : // -----------------------------------------------------------------------------
     674                 :            : 
     675                 :          0 : sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getAccessibleChildCount() throw (RuntimeException)
     676                 :            : {
     677                 :          0 :     return 0;
     678                 :            : }
     679                 :            : 
     680                 :            : // -----------------------------------------------------------------------------
     681                 :            : 
     682                 :          0 : Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleChild( sal_Int32 ) throw (IndexOutOfBoundsException, RuntimeException)
     683                 :            : {
     684         [ #  # ]:          0 :     throw IndexOutOfBoundsException();
     685                 :            : }
     686                 :            : 
     687                 :            : // -----------------------------------------------------------------------------
     688                 :            : 
     689                 :          0 : Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleParent() throw (RuntimeException)
     690                 :            : {
     691         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     692                 :          0 :     Reference< XAccessible > xRet;
     693                 :            : 
     694         [ #  # ]:          0 :     if( mpParent )
     695 [ #  # ][ #  # ]:          0 :         xRet = mpParent->mrMenu.GetAccessible();
     696                 :            : 
     697         [ #  # ]:          0 :     return xRet;
     698                 :            : }
     699                 :            : 
     700                 :            : // -----------------------------------------------------------------------------
     701                 :            : 
     702                 :          0 : sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getAccessibleIndexInParent() throw (RuntimeException)
     703                 :            : {
     704         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     705                 :            :     // The index defaults to -1 to indicate the child does not belong to its
     706                 :            :     // parent.
     707                 :          0 :     sal_Int32 nIndexInParent = -1;
     708                 :            : 
     709         [ #  # ]:          0 :     if( mpParent )
     710                 :            :     {
     711 [ #  # ][ #  # ]:          0 :         Reference< XAccessibleContext > xParent( mpParent->mrMenu.GetAccessible(), UNO_QUERY );
     712                 :            : 
     713         [ #  # ]:          0 :         if( xParent.is() )
     714                 :            :         {
     715         [ #  # ]:          0 :             Reference< XAccessible > xThis( this );
     716                 :            : 
     717 [ #  # ][ #  # ]:          0 :             const sal_Int32 nCount = xParent->getAccessibleChildCount();
     718         [ #  # ]:          0 :             for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
     719                 :            :             {
     720 [ #  # ][ #  # ]:          0 :                 if( xParent->getAccessibleChild(nIndex) == xThis )
         [ #  # ][ #  # ]
     721                 :            :                 {
     722                 :          0 :                     nIndexInParent = nIndex;
     723                 :          0 :                     break;
     724                 :            :                 }
     725                 :          0 :             }
     726                 :          0 :         }
     727                 :            :     }
     728                 :            : 
     729         [ #  # ]:          0 :     return nIndexInParent;
     730                 :            : }
     731                 :            : 
     732                 :            : // -----------------------------------------------------------------------------
     733                 :            : 
     734                 :          0 : sal_Int16 SAL_CALL ToolbarMenuEntryAcc::getAccessibleRole() throw (RuntimeException)
     735                 :            : {
     736                 :          0 :     return AccessibleRole::LIST_ITEM;
     737                 :            : }
     738                 :            : 
     739                 :            : // -----------------------------------------------------------------------------
     740                 :            : 
     741                 :          0 : ::rtl::OUString SAL_CALL ToolbarMenuEntryAcc::getAccessibleDescription() throw (RuntimeException)
     742                 :            : {
     743                 :          0 :     return ::rtl::OUString();
     744                 :            : }
     745                 :            : 
     746                 :            : // -----------------------------------------------------------------------------
     747                 :            : 
     748                 :          0 : ::rtl::OUString SAL_CALL ToolbarMenuEntryAcc::getAccessibleName() throw (RuntimeException)
     749                 :            : {
     750         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     751         [ #  # ]:          0 :     String              aRet;
     752                 :            : 
     753         [ #  # ]:          0 :     if( mpParent )
     754                 :            :     {
     755         [ #  # ]:          0 :         aRet = mpParent->maText;
     756                 :            : 
     757         [ #  # ]:          0 :         if( !aRet.Len() )
     758                 :            :         {
     759 [ #  # ][ #  # ]:          0 :             aRet = String( RTL_CONSTASCII_USTRINGPARAM( "Item " ) );
                 [ #  # ]
     760 [ #  # ][ #  # ]:          0 :             aRet += String::CreateFromInt32( mpParent->mnEntryId );
                 [ #  # ]
     761                 :            :         }
     762                 :            :     }
     763                 :            : 
     764 [ #  # ][ #  # ]:          0 :     return aRet;
                 [ #  # ]
     765                 :            : }
     766                 :            : 
     767                 :            : // -----------------------------------------------------------------------------
     768                 :            : 
     769                 :          0 : Reference< XAccessibleRelationSet > SAL_CALL ToolbarMenuEntryAcc::getAccessibleRelationSet() throw (RuntimeException)
     770                 :            : {
     771                 :          0 :     return Reference< XAccessibleRelationSet >();
     772                 :            : }
     773                 :            : 
     774                 :            : // -----------------------------------------------------------------------------
     775                 :            : 
     776                 :          0 : Reference< XAccessibleStateSet > SAL_CALL ToolbarMenuEntryAcc::getAccessibleStateSet() throw (RuntimeException)
     777                 :            : {
     778         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     779         [ #  # ]:          0 :     ::utl::AccessibleStateSetHelper*    pStateSet = new ::utl::AccessibleStateSetHelper;
     780                 :            : 
     781         [ #  # ]:          0 :     if( mpParent )
     782                 :            :     {
     783         [ #  # ]:          0 :         pStateSet->AddState (AccessibleStateType::ENABLED);
     784         [ #  # ]:          0 :         pStateSet->AddState (AccessibleStateType::SENSITIVE);
     785         [ #  # ]:          0 :         pStateSet->AddState (AccessibleStateType::SHOWING);
     786         [ #  # ]:          0 :         pStateSet->AddState (AccessibleStateType::VISIBLE);
     787         [ #  # ]:          0 :         pStateSet->AddState (AccessibleStateType::TRANSIENT);
     788         [ #  # ]:          0 :         if( mpParent->mnEntryId != TITLE_ID )
     789                 :            :         {
     790         [ #  # ]:          0 :             pStateSet->AddState( AccessibleStateType::SELECTABLE );
     791                 :            : 
     792                 :            :             // SELECTED
     793 [ #  # ][ #  # ]:          0 :             if( mpParent->mrMenu.getHighlightedEntryId() == mpParent->mnEntryId )
     794         [ #  # ]:          0 :                 pStateSet->AddState( AccessibleStateType::SELECTED );
     795                 :            :         }
     796                 :            :     }
     797                 :            : 
     798 [ #  # ][ #  # ]:          0 :     return pStateSet;
                 [ #  # ]
     799                 :            : }
     800                 :            : 
     801                 :            : // -----------------------------------------------------------------------------
     802                 :            : 
     803                 :          0 : Locale SAL_CALL ToolbarMenuEntryAcc::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException)
     804                 :            : {
     805                 :          0 :     const ::rtl::OUString aEmptyStr;
     806                 :          0 :     Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr );
     807                 :            : 
     808         [ #  # ]:          0 :     Reference< XAccessible > xParent( getAccessibleParent() );
     809         [ #  # ]:          0 :     if( xParent.is() )
     810                 :            :     {
     811 [ #  # ][ #  # ]:          0 :         Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
     812                 :            : 
     813         [ #  # ]:          0 :         if( xParentContext.is() )
     814 [ #  # ][ #  # ]:          0 :             aRet = xParentContext->getLocale();
     815                 :            :     }
     816                 :            : 
     817                 :          0 :     return aRet;
     818                 :            : }
     819                 :            : 
     820                 :            : // -----------------------------------------------------------------------------
     821                 :            : 
     822                 :          0 : void SAL_CALL ToolbarMenuEntryAcc::addEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException)
     823                 :            : {
     824         [ #  # ]:          0 :     const ::osl::MutexGuard aGuard( maMutex );
     825                 :            : 
     826         [ #  # ]:          0 :     if( rxListener.is() )
     827                 :            :     {
     828         [ #  # ]:          0 :            EventListenerVector::const_iterator aIter( mxEventListeners.begin() );
     829                 :          0 :         bool bFound = false;
     830                 :            : 
     831 [ #  # ][ #  # ]:          0 :         while( !bFound && ( aIter != mxEventListeners.end() ) )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     832                 :            :         {
     833 [ #  # ][ #  # ]:          0 :             if( *aIter == rxListener )
     834                 :          0 :                 bFound = true;
     835                 :            :             else
     836         [ #  # ]:          0 :                 aIter++;
     837                 :            :         }
     838                 :            : 
     839         [ #  # ]:          0 :         if (!bFound)
     840         [ #  # ]:          0 :             mxEventListeners.push_back( rxListener );
     841         [ #  # ]:          0 :     }
     842                 :          0 : }
     843                 :            : 
     844                 :            : // -----------------------------------------------------------------------------
     845                 :            : 
     846                 :          0 : void SAL_CALL ToolbarMenuEntryAcc::removeEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException)
     847                 :            : {
     848         [ #  # ]:          0 :     const ::osl::MutexGuard aGuard( maMutex );
     849                 :            : 
     850         [ #  # ]:          0 :     if( rxListener.is() )
     851                 :            :     {
     852                 :          0 :            EventListenerVector::iterator aIter = mxEventListeners.begin();
     853                 :          0 :         bool bFound = false;
     854                 :            : 
     855 [ #  # ][ #  # ]:          0 :         while( !bFound && ( aIter != mxEventListeners.end() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     856                 :            :         {
     857 [ #  # ][ #  # ]:          0 :             if( *aIter == rxListener )
     858                 :            :             {
     859         [ #  # ]:          0 :                 mxEventListeners.erase( aIter );
     860                 :          0 :                 bFound = true;
     861                 :            :             }
     862                 :            :             else
     863                 :          0 :                 ++aIter;
     864                 :            :         }
     865         [ #  # ]:          0 :     }
     866                 :          0 : }
     867                 :            : 
     868                 :            : // -----------------------------------------------------------------------------
     869                 :            : 
     870                 :          0 : sal_Bool SAL_CALL ToolbarMenuEntryAcc::containsPoint( const awt::Point& aPoint ) throw (RuntimeException)
     871                 :            : {
     872         [ #  # ]:          0 :     const awt::Rectangle    aRect( getBounds() );
     873                 :          0 :     const Point             aSize( aRect.Width, aRect.Height );
     874                 :          0 :     const Point             aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
     875                 :            : 
     876 [ #  # ][ #  # ]:          0 :     return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
     877                 :            : }
     878                 :            : 
     879                 :            : // -----------------------------------------------------------------------------
     880                 :            : 
     881                 :          0 : Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
     882                 :            : {
     883                 :          0 :     Reference< XAccessible > xRet;
     884                 :          0 :     return xRet;
     885                 :            : }
     886                 :            : 
     887                 :            : // -----------------------------------------------------------------------------
     888                 :            : 
     889                 :          0 : awt::Rectangle SAL_CALL ToolbarMenuEntryAcc::getBounds() throw (RuntimeException)
     890                 :            : {
     891         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     892                 :          0 :     awt::Rectangle      aRet;
     893                 :            : 
     894         [ #  # ]:          0 :     if( mpParent )
     895                 :            :     {
     896                 :          0 :         Rectangle   aRect( mpParent->maRect );
     897                 :          0 :         Point       aOrigin;
     898 [ #  # ][ #  # ]:          0 :         Rectangle   aParentRect( aOrigin, mpParent->mrMenu.GetOutputSizePixel() );
     899                 :            : 
     900         [ #  # ]:          0 :         aRect.Intersection( aParentRect );
     901                 :            : 
     902                 :          0 :         aRet.X = aRect.Left();
     903                 :          0 :         aRet.Y = aRect.Top();
     904         [ #  # ]:          0 :         aRet.Width = aRect.GetWidth();
     905         [ #  # ]:          0 :         aRet.Height = aRect.GetHeight();
     906                 :            :     }
     907                 :            : 
     908         [ #  # ]:          0 :     return aRet;
     909                 :            : }
     910                 :            : 
     911                 :            : // -----------------------------------------------------------------------------
     912                 :            : 
     913                 :          0 : awt::Point SAL_CALL ToolbarMenuEntryAcc::getLocation() throw (RuntimeException)
     914                 :            : {
     915         [ #  # ]:          0 :     const awt::Rectangle aRect( getBounds() );
     916                 :          0 :     return awt::Point( aRect.X, aRect.Y );
     917                 :            : }
     918                 :            : 
     919                 :            : // -----------------------------------------------------------------------------
     920                 :            : 
     921                 :          0 : awt::Point SAL_CALL ToolbarMenuEntryAcc::getLocationOnScreen() throw (RuntimeException)
     922                 :            : {
     923         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     924                 :          0 :     awt::Point aRet;
     925                 :            : 
     926         [ #  # ]:          0 :     if( mpParent )
     927                 :            :     {
     928         [ #  # ]:          0 :         const Point aScreenPos( mpParent->mrMenu.OutputToAbsoluteScreenPixel( mpParent->maRect.TopLeft() ) );
     929                 :            : 
     930                 :          0 :         aRet.X = aScreenPos.X();
     931                 :          0 :         aRet.Y = aScreenPos.Y();
     932                 :            :     }
     933                 :            : 
     934         [ #  # ]:          0 :     return aRet;
     935                 :            : }
     936                 :            : 
     937                 :            : // -----------------------------------------------------------------------------
     938                 :            : 
     939                 :          0 : awt::Size SAL_CALL ToolbarMenuEntryAcc::getSize() throw (RuntimeException)
     940                 :            : {
     941         [ #  # ]:          0 :     const awt::Rectangle aRect( getBounds() );
     942                 :          0 :     awt::Size aRet;
     943                 :            : 
     944                 :          0 :     aRet.Width = aRect.Width;
     945                 :          0 :     aRet.Height = aRect.Height;
     946                 :            : 
     947                 :          0 :     return aRet;
     948                 :            : }
     949                 :            : 
     950                 :            : // -----------------------------------------------------------------------------
     951                 :            : 
     952                 :          0 : void SAL_CALL ToolbarMenuEntryAcc::grabFocus() throw (RuntimeException)
     953                 :            : {
     954                 :            :     // nothing to do
     955                 :          0 : }
     956                 :            : 
     957                 :            : // -----------------------------------------------------------------------------
     958                 :            : 
     959                 :          0 : Any SAL_CALL ToolbarMenuEntryAcc::getAccessibleKeyBinding() throw (RuntimeException)
     960                 :            : {
     961                 :          0 :     return Any();
     962                 :            : }
     963                 :            : 
     964                 :            : // -----------------------------------------------------------------------------
     965                 :            : 
     966                 :          0 : sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getForeground(  ) throw (RuntimeException)
     967                 :            : {
     968                 :          0 :     return static_cast<sal_Int32>(Application::GetSettings().GetStyleSettings().GetMenuTextColor().GetColor());
     969                 :            : }
     970                 :            : 
     971                 :            : // -----------------------------------------------------------------------------
     972                 :            : 
     973                 :          0 : sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getBackground(  )  throw (RuntimeException)
     974                 :            : {
     975                 :          0 :     return static_cast<sal_Int32>(Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor());
     976                 :            : }
     977                 :            : 
     978                 :            : }
     979                 :            : 
     980                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10