LCOV - code coverage report
Current view: top level - accessibility/source/extended - AccessibleGridControlBase.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 213 0.0 %
Date: 2012-08-25 Functions: 0 45 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 372 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                 :            : #include "accessibility/extended/AccessibleGridControlBase.hxx"
      30                 :            : #include <svtools/accessibletable.hxx>
      31                 :            : #include <comphelper/servicehelper.hxx>
      32                 :            : //
      33                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      34                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      35                 :            : #include <unotools/accessiblerelationsethelper.hxx>
      36                 :            : 
      37                 :            : // ============================================================================
      38                 :            : 
      39                 :            : using ::rtl::OUString;
      40                 :            : 
      41                 :            : using ::com::sun::star::uno::Reference;
      42                 :            : using ::com::sun::star::uno::Sequence;
      43                 :            : using ::com::sun::star::uno::Any;
      44                 :            : 
      45                 :            : using namespace ::com::sun::star;
      46                 :            : using namespace ::com::sun::star::accessibility;
      47                 :            : using namespace ::comphelper;
      48                 :            : using namespace ::svt;
      49                 :            : using namespace ::svt::table;
      50                 :            : 
      51                 :            : 
      52                 :            : // ============================================================================
      53                 :            : 
      54                 :            : namespace accessibility {
      55                 :            : 
      56                 :            : using namespace com::sun::star::accessibility::AccessibleStateType;
      57                 :            : // ============================================================================
      58                 :            : 
      59                 :          0 : AccessibleGridControlBase::AccessibleGridControlBase(
      60                 :            :         const Reference< XAccessible >& rxParent,
      61                 :            :         svt::table::IAccessibleTable& rTable,
      62                 :            :         AccessibleTableControlObjType      eObjType ) :
      63                 :            :     AccessibleGridControlImplHelper( m_aMutex ),
      64                 :            :     m_xParent( rxParent ),
      65                 :            :     m_aTable( rTable),
      66                 :            :     m_eObjType( eObjType ),
      67                 :          0 :     m_aName( rTable.GetAccessibleObjectName( eObjType, 0, 0 ) ),
      68                 :          0 :     m_aDescription( rTable.GetAccessibleObjectDescription( eObjType ) ),
      69 [ #  # ][ #  # ]:          0 :     m_aClientId(0)
      70                 :            : {
      71                 :          0 : }
      72                 :            : 
      73         [ #  # ]:          0 : AccessibleGridControlBase::~AccessibleGridControlBase()
      74                 :            : {
      75         [ #  # ]:          0 :     if( isAlive() )
      76                 :            :     {
      77                 :            :         // increment ref count to prevent double call of Dtor
      78         [ #  # ]:          0 :         osl_incrementInterlockedCount( &m_refCount );
      79         [ #  # ]:          0 :         dispose();
      80                 :            :     }
      81         [ #  # ]:          0 : }
      82                 :            : 
      83                 :          0 : void SAL_CALL AccessibleGridControlBase::disposing()
      84                 :            : {
      85         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
      86 [ #  # ][ #  # ]:          0 :     m_xParent = NULL;
      87                 :          0 : }
      88                 :            : 
      89                 :            : // XAccessibleContext ---------------------------------------------------------
      90                 :            : 
      91                 :          0 : Reference< XAccessible > SAL_CALL AccessibleGridControlBase::getAccessibleParent()
      92                 :            :     throw ( uno::RuntimeException )
      93                 :            : {
      94         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
      95         [ #  # ]:          0 :     ensureIsAlive();
      96         [ #  # ]:          0 :     return m_xParent;
      97                 :            : }
      98                 :            : 
      99                 :          0 : sal_Int32 SAL_CALL AccessibleGridControlBase::getAccessibleIndexInParent()
     100                 :            :     throw ( uno::RuntimeException )
     101                 :            : {
     102         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     103         [ #  # ]:          0 :     ensureIsAlive();
     104                 :            : 
     105                 :            :     // -1 for child not found/no parent (according to specification)
     106                 :          0 :     sal_Int32 nRet = -1;
     107                 :            : 
     108         [ #  # ]:          0 :     Reference< uno::XInterface > xMeMyselfAndI( static_cast< XAccessibleContext* >( this ), uno::UNO_QUERY );
     109                 :            : 
     110                 :            :     //  iterate over parent's children and search for this object
     111         [ #  # ]:          0 :     if( m_xParent.is() )
     112                 :            :     {
     113                 :            :         Reference< XAccessibleContext >
     114 [ #  # ][ #  # ]:          0 :             xParentContext( m_xParent->getAccessibleContext() );
     115         [ #  # ]:          0 :         if( xParentContext.is() )
     116                 :            :         {
     117                 :          0 :         Reference< uno::XInterface > xChild;
     118                 :            : 
     119 [ #  # ][ #  # ]:          0 :             sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
     120         [ #  # ]:          0 :             for( sal_Int32 nChild = 0; nChild < nChildCount; ++nChild )
     121                 :            :             {
     122 [ #  # ][ #  # ]:          0 :             xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) );
         [ #  # ][ #  # ]
     123 [ #  # ][ #  # ]:          0 :             if ( xMeMyselfAndI.get() == xChild.get() )
                 [ #  # ]
     124                 :            :             {
     125                 :          0 :                 nRet = nChild;
     126                 :          0 :                 break;
     127                 :            :             }
     128                 :          0 :         }
     129                 :          0 :         }
     130                 :            :    }
     131         [ #  # ]:          0 :    return nRet;
     132                 :            : }
     133                 :            : 
     134                 :          0 : OUString SAL_CALL AccessibleGridControlBase::getAccessibleDescription()
     135                 :            :     throw ( uno::RuntimeException )
     136                 :            : {
     137         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     138         [ #  # ]:          0 :     ensureIsAlive();
     139         [ #  # ]:          0 :     return m_aDescription;
     140                 :            : }
     141                 :            : 
     142                 :          0 : OUString SAL_CALL AccessibleGridControlBase::getAccessibleName()
     143                 :            :     throw ( uno::RuntimeException )
     144                 :            : {
     145         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     146         [ #  # ]:          0 :     ensureIsAlive();
     147         [ #  # ]:          0 :     return m_aName;
     148                 :            : }
     149                 :            : 
     150                 :            : Reference< XAccessibleRelationSet > SAL_CALL
     151                 :          0 : AccessibleGridControlBase::getAccessibleRelationSet()
     152                 :            :     throw ( uno::RuntimeException )
     153                 :            : {
     154                 :          0 :    ensureIsAlive();
     155                 :            :    // GridControl does not have relations.
     156 [ #  # ][ #  # ]:          0 :    return new utl::AccessibleRelationSetHelper;
     157                 :            : }
     158                 :            : 
     159                 :            : Reference< XAccessibleStateSet > SAL_CALL
     160                 :          0 : AccessibleGridControlBase::getAccessibleStateSet()
     161                 :            :     throw ( uno::RuntimeException )
     162                 :            : {
     163         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     164         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     165                 :            :     // don't check whether alive -> StateSet may contain DEFUNC
     166 [ #  # ][ #  # ]:          0 :     return implCreateStateSetHelper();
         [ #  # ][ #  # ]
                 [ #  # ]
     167                 :            : }
     168                 :            : 
     169                 :          0 : lang::Locale SAL_CALL AccessibleGridControlBase::getLocale()
     170                 :            :     throw ( IllegalAccessibleComponentStateException, uno::RuntimeException )
     171                 :            : {
     172         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     173         [ #  # ]:          0 :     ensureIsAlive();
     174         [ #  # ]:          0 :     if( m_xParent.is() )
     175                 :            :     {
     176                 :            :         Reference< XAccessibleContext >
     177 [ #  # ][ #  # ]:          0 :             xParentContext( m_xParent->getAccessibleContext() );
     178         [ #  # ]:          0 :         if( xParentContext.is() )
     179 [ #  # ][ #  # ]:          0 :         return xParentContext->getLocale();
                 [ #  # ]
     180                 :            :     }
     181 [ #  # ][ #  # ]:          0 :     throw IllegalAccessibleComponentStateException();
     182                 :            : }
     183                 :            : 
     184                 :            : // XAccessibleComponent -------------------------------------------------------
     185                 :            : 
     186                 :          0 : sal_Bool SAL_CALL AccessibleGridControlBase::containsPoint( const awt::Point& rPoint )
     187                 :            :     throw ( uno::RuntimeException )
     188                 :            : {
     189 [ #  # ][ #  # ]:          0 :    return Rectangle( Point(), getBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
         [ #  # ][ #  # ]
     190                 :            : }
     191                 :            : 
     192                 :          0 : awt::Rectangle SAL_CALL AccessibleGridControlBase::getBounds()
     193                 :            :     throw ( uno::RuntimeException )
     194                 :            : {
     195         [ #  # ]:          0 :    return AWTRectangle( getBoundingBox() );
     196                 :            : }
     197                 :            : 
     198                 :          0 : awt::Point SAL_CALL AccessibleGridControlBase::getLocation()
     199                 :            :     throw ( uno::RuntimeException )
     200                 :            : {
     201                 :          0 :     return AWTPoint( getBoundingBox().TopLeft() );
     202                 :            : }
     203                 :            : 
     204                 :          0 : awt::Point SAL_CALL AccessibleGridControlBase::getLocationOnScreen()
     205                 :            :     throw ( uno::RuntimeException )
     206                 :            : {
     207                 :          0 :     return AWTPoint( getBoundingBoxOnScreen().TopLeft() );
     208                 :            : }
     209                 :            : 
     210                 :          0 : awt::Size SAL_CALL AccessibleGridControlBase::getSize()
     211                 :            :     throw ( uno::RuntimeException )
     212                 :            : {
     213         [ #  # ]:          0 :     return AWTSize( getBoundingBox().GetSize() );
     214                 :            : }
     215                 :            : 
     216                 :          0 : sal_Bool SAL_CALL AccessibleGridControlBase::isShowing()
     217                 :            :     throw ( uno::RuntimeException )
     218                 :            : {
     219         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     220         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     221         [ #  # ]:          0 :     ensureIsAlive();
     222 [ #  # ][ #  # ]:          0 :     return implIsShowing();
                 [ #  # ]
     223                 :            : }
     224                 :            : 
     225                 :          0 : sal_Bool SAL_CALL AccessibleGridControlBase::isVisible()
     226                 :            :     throw ( uno::RuntimeException )
     227                 :            : {
     228         [ #  # ]:          0 :     Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet();
     229                 :          0 :     return xStateSet.is() ?
     230 [ #  # ][ #  # ]:          0 :         xStateSet->contains( AccessibleStateType::VISIBLE ) : sal_False;
                 [ #  # ]
     231                 :            : }
     232                 :            : 
     233                 :          0 : sal_Bool SAL_CALL AccessibleGridControlBase::isFocusTraversable()
     234                 :            :     throw ( uno::RuntimeException )
     235                 :            : {
     236         [ #  # ]:          0 :     Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet();
     237                 :          0 :     return xStateSet.is() ?
     238 [ #  # ][ #  # ]:          0 :         xStateSet->contains( AccessibleStateType::FOCUSABLE ) : sal_False;
                 [ #  # ]
     239                 :            : }
     240                 :            : // XAccessibleEventBroadcaster ------------------------------------------------
     241                 :            : 
     242                 :          0 : void SAL_CALL AccessibleGridControlBase::addEventListener(
     243                 :            :         const Reference< XAccessibleEventListener>& _rxListener )
     244                 :            :     throw ( uno::RuntimeException )
     245                 :            : {
     246         [ #  # ]:          0 :     if ( _rxListener.is() )
     247                 :            :     {
     248         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( getOslMutex() );
     249         [ #  # ]:          0 :         if ( !getClientId( ) )
     250         [ #  # ]:          0 :             setClientId( AccessibleEventNotifier::registerClient( ) );
     251                 :            : 
     252 [ #  # ][ #  # ]:          0 :         AccessibleEventNotifier::addEventListener( getClientId( ), _rxListener );
     253                 :            :     }
     254                 :          0 : }
     255                 :            : 
     256                 :          0 : void SAL_CALL AccessibleGridControlBase::removeEventListener(
     257                 :            :         const Reference< XAccessibleEventListener>& _rxListener )
     258                 :            :     throw ( uno::RuntimeException )
     259                 :            : {
     260 [ #  # ][ #  # ]:          0 :     if( _rxListener.is() && getClientId( ) )
                 [ #  # ]
     261                 :            :     {
     262         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     263         [ #  # ]:          0 :         sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener );
     264         [ #  # ]:          0 :     if ( !nListenerCount )
     265                 :            :     {
     266                 :            :         // no listeners anymore
     267                 :            :         // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
     268                 :            :         // and at least to us not firing any events anymore, in case somebody calls
     269                 :            :         // NotifyAccessibleEvent, again
     270                 :          0 :         AccessibleEventNotifier::TClientId nId( getClientId( ) );
     271                 :          0 :         setClientId( 0 );
     272         [ #  # ]:          0 :         AccessibleEventNotifier::revokeClient( nId );
     273         [ #  # ]:          0 :     }
     274                 :            :     }
     275                 :          0 : }
     276                 :            : 
     277                 :            : // XTypeProvider --------------------------------------------------------------
     278                 :            : 
     279                 :            : namespace
     280                 :            : {
     281                 :            :     class theAccessibleGridControlBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleGridControlBaseImplementationId > {};
     282                 :            : }
     283                 :            : 
     284                 :          0 : Sequence< sal_Int8 > SAL_CALL AccessibleGridControlBase::getImplementationId()
     285                 :            :     throw ( uno::RuntimeException )
     286                 :            : {
     287                 :          0 :     return theAccessibleGridControlBaseImplementationId::get().getSeq();
     288                 :            : }
     289                 :            : 
     290                 :            : // XServiceInfo ---------------------------------------------------------------
     291                 :            : 
     292                 :          0 : sal_Bool SAL_CALL AccessibleGridControlBase::supportsService(
     293                 :            :         const OUString& rServiceName )
     294                 :            :     throw ( uno::RuntimeException )
     295                 :            : {
     296         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     297                 :            : 
     298         [ #  # ]:          0 :     Sequence< OUString > aSupportedServices( getSupportedServiceNames() );
     299                 :          0 :     const OUString* pArrBegin = aSupportedServices.getConstArray();
     300                 :          0 :     const OUString* pArrEnd = pArrBegin + aSupportedServices.getLength();
     301                 :          0 :     const OUString* pString = pArrBegin;
     302                 :            : 
     303 [ #  # ][ #  # ]:          0 :     for( ; ( pString != pArrEnd ) && ( rServiceName != *pString ); ++pString )
                 [ #  # ]
     304                 :            :         ;
     305 [ #  # ][ #  # ]:          0 :     return pString != pArrEnd;
     306                 :            : }
     307                 :            : 
     308                 :          0 : Sequence< OUString > SAL_CALL AccessibleGridControlBase::getSupportedServiceNames()
     309                 :            :     throw ( uno::RuntimeException )
     310                 :            : {
     311         [ #  # ]:          0 :     const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) );
     312         [ #  # ]:          0 :     return Sequence< OUString >( &aServiceName, 1 );
     313                 :            : }
     314                 :            : // internal virtual methods ---------------------------------------------------
     315                 :            : 
     316                 :          0 : sal_Bool AccessibleGridControlBase::implIsShowing()
     317                 :            : {
     318                 :          0 :     sal_Bool bShowing = sal_False;
     319         [ #  # ]:          0 :     if( m_xParent.is() )
     320                 :            :     {
     321                 :            :         Reference< XAccessibleComponent >
     322 [ #  # ][ #  # ]:          0 :             xParentComp( m_xParent->getAccessibleContext(), uno::UNO_QUERY );
                 [ #  # ]
     323         [ #  # ]:          0 :         if( xParentComp.is() )
     324                 :          0 :             bShowing = implGetBoundingBox().IsOver(
     325 [ #  # ][ #  # ]:          0 :                 VCLRectangle( xParentComp->getBounds() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     326                 :            :     }
     327                 :          0 :     return bShowing;
     328                 :            : }
     329                 :            : 
     330                 :          0 : ::utl::AccessibleStateSetHelper* AccessibleGridControlBase::implCreateStateSetHelper()
     331                 :            : {
     332                 :            :     ::utl::AccessibleStateSetHelper*
     333         [ #  # ]:          0 :         pStateSetHelper = new ::utl::AccessibleStateSetHelper;
     334                 :            : 
     335         [ #  # ]:          0 :     if( isAlive() )
     336                 :            :     {
     337                 :            :         // SHOWING done with m_xParent
     338         [ #  # ]:          0 :         if( implIsShowing() )
     339                 :          0 :             pStateSetHelper->AddState( AccessibleStateType::SHOWING );
     340                 :            :         // GridControl fills StateSet with states depending on object type
     341                 :          0 :         m_aTable.FillAccessibleStateSet( *pStateSetHelper, getType() );
     342                 :            :     }
     343                 :            :     else
     344                 :          0 :         pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
     345                 :          0 :     return pStateSetHelper;
     346                 :            : }
     347                 :            : 
     348                 :            : // internal helper methods ----------------------------------------------------
     349                 :            : 
     350                 :          0 : sal_Bool AccessibleGridControlBase::isAlive() const
     351                 :            : {
     352 [ #  # ][ #  # ]:          0 :     return !rBHelper.bDisposed && !rBHelper.bInDispose && &m_aTable;
                 [ #  # ]
     353                 :            : }
     354                 :            : 
     355                 :          0 : void AccessibleGridControlBase::ensureIsAlive() const
     356                 :            :     throw ( lang::DisposedException )
     357                 :            : {
     358         [ #  # ]:          0 :     if( !isAlive() )
     359         [ #  # ]:          0 :         throw lang::DisposedException();
     360                 :          0 : }
     361                 :            : 
     362                 :          0 : Rectangle AccessibleGridControlBase::getBoundingBox()
     363                 :            :     throw ( lang::DisposedException )
     364                 :            : {
     365         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     366         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     367         [ #  # ]:          0 :     ensureIsAlive();
     368         [ #  # ]:          0 :     Rectangle aRect = implGetBoundingBox();
     369 [ #  # ][ #  # ]:          0 :     if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
         [ #  # ][ #  # ]
     370                 :            :     {
     371                 :            :         SAL_WARN( "accessibility", "rectangle doesn't exist" );
     372                 :            :     }
     373 [ #  # ][ #  # ]:          0 :     return aRect;
     374                 :            : }
     375                 :            : 
     376                 :          0 : Rectangle AccessibleGridControlBase::getBoundingBoxOnScreen()
     377                 :            :     throw ( lang::DisposedException )
     378                 :            : {
     379         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     380         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     381         [ #  # ]:          0 :     ensureIsAlive();
     382         [ #  # ]:          0 :     Rectangle aRect = implGetBoundingBoxOnScreen();
     383 [ #  # ][ #  # ]:          0 :     if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
         [ #  # ][ #  # ]
     384                 :            :     {
     385                 :            :         SAL_WARN( "accessibility", "rectangle doesn't exist" );
     386                 :            :     }
     387 [ #  # ][ #  # ]:          0 :     return aRect;
     388                 :            : }
     389                 :            : 
     390                 :          0 : void AccessibleGridControlBase::commitEvent(
     391                 :            :         sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
     392                 :            : {
     393         [ #  # ]:          0 :     ::osl::ClearableMutexGuard aGuard( getOslMutex() );
     394         [ #  # ]:          0 :     if ( !getClientId( ) )
     395                 :            :             // if we don't have a client id for the notifier, then we don't have listeners, then
     396                 :            :             // we don't need to notify anything
     397                 :          0 :             return;
     398                 :            : 
     399                 :            :     // build an event object
     400         [ #  # ]:          0 :     AccessibleEventObject aEvent;
     401 [ #  # ][ #  # ]:          0 :     aEvent.Source = *this;
     402                 :          0 :     aEvent.EventId = _nEventId;
     403                 :          0 :     aEvent.OldValue = _rOldValue;
     404                 :          0 :     aEvent.NewValue = _rNewValue;
     405                 :            : 
     406                 :            :     // let the notifier handle this event
     407                 :            : 
     408 [ #  # ][ #  # ]:          0 :     AccessibleEventNotifier::addEvent( getClientId( ), aEvent );
         [ #  # ][ #  # ]
     409                 :            : }
     410                 :            : 
     411                 :          0 : sal_Int16 SAL_CALL AccessibleGridControlBase::getAccessibleRole()
     412                 :            :     throw ( uno::RuntimeException )
     413                 :            : {
     414                 :          0 :     ensureIsAlive();
     415                 :          0 :     sal_Int16 nRole = AccessibleRole::UNKNOWN;
     416   [ #  #  #  #  :          0 :     switch ( m_eObjType )
                   #  # ]
     417                 :            :     {
     418                 :            :         case TCTYPE_ROWHEADERCELL:
     419                 :          0 :         nRole = AccessibleRole::ROW_HEADER;
     420                 :          0 :         break;
     421                 :            :     case TCTYPE_COLUMNHEADERCELL:
     422                 :          0 :         nRole = AccessibleRole::COLUMN_HEADER;
     423                 :          0 :         break;
     424                 :            :     case TCTYPE_COLUMNHEADERBAR:
     425                 :            :     case TCTYPE_ROWHEADERBAR:
     426                 :            :     case TCTYPE_TABLE:
     427                 :          0 :         nRole = AccessibleRole::TABLE;
     428                 :          0 :         break;
     429                 :            :     case TCTYPE_TABLECELL:
     430                 :          0 :         nRole = AccessibleRole::TABLE_CELL;
     431                 :          0 :         break;
     432                 :            :     case TCTYPE_GRIDCONTROL:
     433                 :          0 :         nRole = AccessibleRole::PANEL;
     434                 :          0 :         break;
     435                 :            :     }
     436                 :          0 :     return nRole;
     437                 :            : }
     438                 :            : // -----------------------------------------------------------------------------
     439                 :          0 : Any SAL_CALL AccessibleGridControlBase::getAccessibleKeyBinding()
     440                 :            :         throw ( uno::RuntimeException )
     441                 :            : {
     442                 :          0 :     return Any();
     443                 :            : }
     444                 :            : // -----------------------------------------------------------------------------
     445                 :          0 : Reference<XAccessible > SAL_CALL AccessibleGridControlBase::getAccessibleAtPoint( const ::com::sun::star::awt::Point& )
     446                 :            :         throw ( uno::RuntimeException )
     447                 :            : {
     448                 :          0 :     return NULL;
     449                 :            : }
     450                 :            : //// -----------------------------------------------------------------------------
     451                 :          0 : sal_Int32 SAL_CALL AccessibleGridControlBase::getForeground(  ) throw (::com::sun::star::uno::RuntimeException)
     452                 :            : {
     453         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     454         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     455         [ #  # ]:          0 :     ensureIsAlive();
     456                 :            : 
     457                 :          0 :     sal_Int32 nColor = 0;
     458         [ #  # ]:          0 :     Window* pInst = m_aTable.GetWindowInstance();
     459         [ #  # ]:          0 :     if ( pInst )
     460                 :            :     {
     461 [ #  # ][ #  # ]:          0 :         if ( pInst->IsControlForeground() )
     462         [ #  # ]:          0 :             nColor = pInst->GetControlForeground().GetColor();
     463                 :            :     else
     464                 :            :     {
     465         [ #  # ]:          0 :         Font aFont;
     466 [ #  # ][ #  # ]:          0 :         if ( pInst->IsControlFont() )
     467 [ #  # ][ #  # ]:          0 :             aFont = pInst->GetControlFont();
                 [ #  # ]
     468                 :            :         else
     469         [ #  # ]:          0 :             aFont = pInst->GetFont();
     470 [ #  # ][ #  # ]:          0 :         nColor = aFont.GetColor().GetColor();
     471                 :            :     }
     472                 :            :     }
     473 [ #  # ][ #  # ]:          0 :     return nColor;
     474                 :            : }
     475                 :            : // -----------------------------------------------------------------------------
     476                 :          0 : sal_Int32 SAL_CALL AccessibleGridControlBase::getBackground(  ) throw (::com::sun::star::uno::RuntimeException)
     477                 :            : {
     478         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     479         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     480         [ #  # ]:          0 :     ensureIsAlive();
     481                 :          0 :     sal_Int32 nColor = 0;
     482         [ #  # ]:          0 :     Window* pInst = m_aTable.GetWindowInstance();
     483         [ #  # ]:          0 :     if ( pInst )
     484                 :            :     {
     485 [ #  # ][ #  # ]:          0 :         if ( pInst->IsControlBackground() )
     486         [ #  # ]:          0 :             nColor = pInst->GetControlBackground().GetColor();
     487                 :            :     else
     488         [ #  # ]:          0 :             nColor = pInst->GetBackground().GetColor().GetColor();
     489                 :            :     }
     490 [ #  # ][ #  # ]:          0 :     return nColor;
     491                 :            : }
     492                 :            : 
     493                 :            : //// ============================================================================
     494                 :          0 : GridControlAccessibleElement::GridControlAccessibleElement( const Reference< XAccessible >& rxParent,
     495                 :            :                         IAccessibleTable& rTable,
     496                 :            :                         AccessibleTableControlObjType  eObjType )
     497                 :          0 :     :AccessibleGridControlBase( rxParent, rTable, eObjType )
     498                 :            : {
     499                 :          0 : }
     500                 :            : 
     501                 :            : // XInterface -----------------------------------------------------------------
     502 [ #  # ][ #  # ]:          0 : IMPLEMENT_FORWARD_XINTERFACE2( GridControlAccessibleElement, AccessibleGridControlBase, GridControlAccessibleElement_Base)
     503                 :            : 
     504                 :            : // XTypeProvider --------------------------------------------------------------
     505 [ #  # ][ #  # ]:          0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( GridControlAccessibleElement, AccessibleGridControlBase, GridControlAccessibleElement_Base )
                 [ #  # ]
     506                 :            : 
     507                 :            : // XAccessible ----------------------------------------------------------------
     508                 :            : 
     509                 :          0 : Reference< XAccessibleContext > SAL_CALL GridControlAccessibleElement::getAccessibleContext() throw ( uno::RuntimeException )
     510                 :            : {
     511                 :          0 :     ensureIsAlive();
     512                 :          0 :     return this;
     513                 :            : }
     514                 :            : // ----------------------------------------------------------------------------
     515                 :          0 : GridControlAccessibleElement::~GridControlAccessibleElement( )
     516                 :            : {
     517         [ #  # ]:          0 : }
     518                 :            : 
     519                 :            : // ============================================================================
     520                 :            : 
     521                 :            : } // namespace accessibility
     522                 :            : 
     523                 :            : // ============================================================================
     524                 :            : 
     525                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10