LCOV - code coverage report
Current view: top level - accessibility/source/extended - AccessibleBrowseBoxBase.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 264 0.0 %
Date: 2012-08-25 Functions: 0 52 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 439 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/AccessibleBrowseBoxBase.hxx"
      30                 :            : #include <svtools/accessibletableprovider.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                 :            : 
      50                 :            : 
      51                 :            : // ============================================================================
      52                 :            : 
      53                 :            : namespace accessibility {
      54                 :            : 
      55                 :            : using namespace com::sun::star::accessibility::AccessibleStateType;
      56                 :            : // ============================================================================
      57                 :            : 
      58                 :            : // Ctor/Dtor/disposing --------------------------------------------------------
      59                 :            : 
      60                 :          0 : AccessibleBrowseBoxBase::AccessibleBrowseBoxBase(
      61                 :            :         const Reference< XAccessible >& rxParent,
      62                 :            :         IAccessibleTableProvider&                      rBrowseBox,
      63                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
      64                 :            :         AccessibleBrowseBoxObjType      eObjType ) :
      65                 :            :     AccessibleBrowseBoxImplHelper( m_aMutex ),
      66                 :            :     mxParent( rxParent ),
      67                 :            :     mpBrowseBox( &rBrowseBox ),
      68                 :            :     m_xFocusWindow(_xFocusWindow),
      69                 :          0 :     maName( rBrowseBox.GetAccessibleObjectName( eObjType ) ),
      70                 :          0 :     maDescription( rBrowseBox.GetAccessibleObjectDescription( eObjType ) ),
      71                 :            :     meObjType( eObjType ),
      72 [ #  # ][ #  # ]:          0 :     m_aClientId(0)
      73                 :            : {
      74         [ #  # ]:          0 :     if ( m_xFocusWindow.is() )
      75 [ #  # ][ #  # ]:          0 :         m_xFocusWindow->addFocusListener( this );
                 [ #  # ]
      76                 :          0 : }
      77                 :            : 
      78                 :          0 : AccessibleBrowseBoxBase::AccessibleBrowseBoxBase(
      79                 :            :         const Reference< XAccessible >& rxParent,
      80                 :            :         IAccessibleTableProvider&                      rBrowseBox,
      81                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
      82                 :            :         AccessibleBrowseBoxObjType      eObjType,
      83                 :            :         const ::rtl::OUString&          rName,
      84                 :            :         const ::rtl::OUString&          rDescription ) :
      85                 :            :     AccessibleBrowseBoxImplHelper( m_aMutex ),
      86                 :            :     mxParent( rxParent ),
      87                 :            :     mpBrowseBox( &rBrowseBox ),
      88                 :            :     m_xFocusWindow(_xFocusWindow),
      89                 :            :     maName( rName ),
      90                 :            :     maDescription( rDescription ),
      91                 :            :     meObjType( eObjType ),
      92                 :          0 :     m_aClientId(0)
      93                 :            : {
      94         [ #  # ]:          0 :     if ( m_xFocusWindow.is() )
      95 [ #  # ][ #  # ]:          0 :         m_xFocusWindow->addFocusListener( this );
                 [ #  # ]
      96                 :          0 : }
      97                 :            : 
      98         [ #  # ]:          0 : AccessibleBrowseBoxBase::~AccessibleBrowseBoxBase()
      99                 :            : {
     100         [ #  # ]:          0 :     if( isAlive() )
     101                 :            :     {
     102                 :            :         // increment ref count to prevent double call of Dtor
     103         [ #  # ]:          0 :         osl_incrementInterlockedCount( &m_refCount );
     104         [ #  # ]:          0 :         dispose();
     105                 :            :     }
     106         [ #  # ]:          0 : }
     107                 :            : 
     108                 :          0 : void SAL_CALL AccessibleBrowseBoxBase::disposing()
     109                 :            : {
     110         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     111         [ #  # ]:          0 :     if ( m_xFocusWindow.is() )
     112                 :            :     {
     113         [ #  # ]:          0 :         SolarMutexGuard aSolarGuard;
     114 [ #  # ][ #  # ]:          0 :         m_xFocusWindow->removeFocusListener( this );
         [ #  # ][ #  # ]
     115                 :            :     }
     116                 :            : 
     117         [ #  # ]:          0 :     if ( getClientId( ) )
     118                 :            :     {
     119                 :          0 :         AccessibleEventNotifier::TClientId nId( getClientId( ) );
     120                 :          0 :         setClientId( 0 );
     121 [ #  # ][ #  # ]:          0 :         AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
     122                 :            :     }
     123                 :            : 
     124         [ #  # ]:          0 :     mxParent = NULL;
     125         [ #  # ]:          0 :     mpBrowseBox = NULL;
     126                 :          0 : }
     127                 :            : 
     128                 :            : // XAccessibleContext ---------------------------------------------------------
     129                 :            : 
     130                 :          0 : Reference< XAccessible > SAL_CALL AccessibleBrowseBoxBase::getAccessibleParent()
     131                 :            :     throw ( uno::RuntimeException )
     132                 :            : {
     133         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     134         [ #  # ]:          0 :     ensureIsAlive();
     135         [ #  # ]:          0 :     return mxParent;
     136                 :            : }
     137                 :            : 
     138                 :          0 : sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getAccessibleIndexInParent()
     139                 :            :     throw ( uno::RuntimeException )
     140                 :            : {
     141         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     142         [ #  # ]:          0 :     ensureIsAlive();
     143                 :            : 
     144                 :            :     // -1 for child not found/no parent (according to specification)
     145                 :          0 :     sal_Int32 nRet = -1;
     146                 :            : 
     147         [ #  # ]:          0 :     Reference< uno::XInterface > xMeMyselfAndI( static_cast< XAccessibleContext* >( this ), uno::UNO_QUERY );
     148                 :            : 
     149                 :            :     //  iterate over parent's children and search for this object
     150         [ #  # ]:          0 :     if( mxParent.is() )
     151                 :            :     {
     152                 :            :         Reference< XAccessibleContext >
     153 [ #  # ][ #  # ]:          0 :             xParentContext( mxParent->getAccessibleContext() );
     154         [ #  # ]:          0 :         if( xParentContext.is() )
     155                 :            :         {
     156                 :          0 :             Reference< uno::XInterface > xChild;
     157                 :            : 
     158 [ #  # ][ #  # ]:          0 :             sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
     159         [ #  # ]:          0 :             for( sal_Int32 nChild = 0; nChild < nChildCount; ++nChild )
     160                 :            :             {
     161 [ #  # ][ #  # ]:          0 :                 xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) );
         [ #  # ][ #  # ]
     162                 :            : 
     163 [ #  # ][ #  # ]:          0 :                 if ( xMeMyselfAndI.get() == xChild.get() )
                 [ #  # ]
     164                 :            :                 {
     165                 :          0 :                     nRet = nChild;
     166                 :          0 :                     break;
     167                 :            :                 }
     168                 :          0 :             }
     169                 :          0 :         }
     170                 :            :    }
     171         [ #  # ]:          0 :    return nRet;
     172                 :            : }
     173                 :            : 
     174                 :          0 : OUString SAL_CALL AccessibleBrowseBoxBase::getAccessibleDescription()
     175                 :            :     throw ( uno::RuntimeException )
     176                 :            : {
     177         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     178         [ #  # ]:          0 :     ensureIsAlive();
     179         [ #  # ]:          0 :     return maDescription;
     180                 :            : }
     181                 :            : 
     182                 :          0 : OUString SAL_CALL AccessibleBrowseBoxBase::getAccessibleName()
     183                 :            :     throw ( uno::RuntimeException )
     184                 :            : {
     185         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     186         [ #  # ]:          0 :     ensureIsAlive();
     187         [ #  # ]:          0 :     return maName;
     188                 :            : }
     189                 :            : 
     190                 :            : Reference< XAccessibleRelationSet > SAL_CALL
     191                 :          0 : AccessibleBrowseBoxBase::getAccessibleRelationSet()
     192                 :            :     throw ( uno::RuntimeException )
     193                 :            : {
     194                 :          0 :     ensureIsAlive();
     195                 :            :     // BrowseBox does not have relations.
     196 [ #  # ][ #  # ]:          0 :        return new utl::AccessibleRelationSetHelper;
     197                 :            : }
     198                 :            : 
     199                 :            : Reference< XAccessibleStateSet > SAL_CALL
     200                 :          0 : AccessibleBrowseBoxBase::getAccessibleStateSet()
     201                 :            :     throw ( uno::RuntimeException )
     202                 :            : {
     203         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     204         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     205                 :            :     // don't check whether alive -> StateSet may contain DEFUNC
     206 [ #  # ][ #  # ]:          0 :     return implCreateStateSetHelper();
         [ #  # ][ #  # ]
                 [ #  # ]
     207                 :            : }
     208                 :            : 
     209                 :          0 : lang::Locale SAL_CALL AccessibleBrowseBoxBase::getLocale()
     210                 :            :     throw ( IllegalAccessibleComponentStateException, uno::RuntimeException )
     211                 :            : {
     212         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     213         [ #  # ]:          0 :     ensureIsAlive();
     214         [ #  # ]:          0 :     if( mxParent.is() )
     215                 :            :     {
     216                 :            :         Reference< XAccessibleContext >
     217 [ #  # ][ #  # ]:          0 :             xParentContext( mxParent->getAccessibleContext() );
     218         [ #  # ]:          0 :         if( xParentContext.is() )
     219 [ #  # ][ #  # ]:          0 :             return xParentContext->getLocale();
                 [ #  # ]
     220                 :            :     }
     221 [ #  # ][ #  # ]:          0 :     throw IllegalAccessibleComponentStateException();
     222                 :            : }
     223                 :            : 
     224                 :            : // XAccessibleComponent -------------------------------------------------------
     225                 :            : 
     226                 :          0 : sal_Bool SAL_CALL AccessibleBrowseBoxBase::containsPoint( const awt::Point& rPoint )
     227                 :            :     throw ( uno::RuntimeException )
     228                 :            : {
     229 [ #  # ][ #  # ]:          0 :     return Rectangle( Point(), getBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
         [ #  # ][ #  # ]
     230                 :            : }
     231                 :            : 
     232                 :          0 : awt::Rectangle SAL_CALL AccessibleBrowseBoxBase::getBounds()
     233                 :            :     throw ( uno::RuntimeException )
     234                 :            : {
     235         [ #  # ]:          0 :     return AWTRectangle( getBoundingBox() );
     236                 :            : }
     237                 :            : 
     238                 :          0 : awt::Point SAL_CALL AccessibleBrowseBoxBase::getLocation()
     239                 :            :     throw ( uno::RuntimeException )
     240                 :            : {
     241                 :          0 :     return AWTPoint( getBoundingBox().TopLeft() );
     242                 :            : }
     243                 :            : 
     244                 :          0 : awt::Point SAL_CALL AccessibleBrowseBoxBase::getLocationOnScreen()
     245                 :            :     throw ( uno::RuntimeException )
     246                 :            : {
     247                 :          0 :     return AWTPoint( getBoundingBoxOnScreen().TopLeft() );
     248                 :            : }
     249                 :            : 
     250                 :          0 : awt::Size SAL_CALL AccessibleBrowseBoxBase::getSize()
     251                 :            :     throw ( uno::RuntimeException )
     252                 :            : {
     253         [ #  # ]:          0 :     return AWTSize( getBoundingBox().GetSize() );
     254                 :            : }
     255                 :            : 
     256                 :          0 : sal_Bool SAL_CALL AccessibleBrowseBoxBase::isShowing()
     257                 :            :     throw ( uno::RuntimeException )
     258                 :            : {
     259         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     260         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     261         [ #  # ]:          0 :     ensureIsAlive();
     262 [ #  # ][ #  # ]:          0 :     return implIsShowing();
                 [ #  # ]
     263                 :            : }
     264                 :            : 
     265                 :          0 : sal_Bool SAL_CALL AccessibleBrowseBoxBase::isVisible()
     266                 :            :     throw ( uno::RuntimeException )
     267                 :            : {
     268         [ #  # ]:          0 :     Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet();
     269                 :          0 :     return xStateSet.is() ?
     270 [ #  # ][ #  # ]:          0 :         xStateSet->contains( AccessibleStateType::VISIBLE ) : sal_False;
                 [ #  # ]
     271                 :            : }
     272                 :            : 
     273                 :          0 : sal_Bool SAL_CALL AccessibleBrowseBoxBase::isFocusTraversable()
     274                 :            :     throw ( uno::RuntimeException )
     275                 :            : {
     276         [ #  # ]:          0 :     Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet();
     277                 :          0 :     return xStateSet.is() ?
     278 [ #  # ][ #  # ]:          0 :         xStateSet->contains( AccessibleStateType::FOCUSABLE ) : sal_False;
                 [ #  # ]
     279                 :            : }
     280                 :            : 
     281                 :          0 : void SAL_CALL AccessibleBrowseBoxBase::focusGained( const ::com::sun::star::awt::FocusEvent& ) throw (::com::sun::star::uno::RuntimeException)
     282                 :            : {
     283                 :          0 :     com::sun::star::uno::Any aFocused;
     284                 :          0 :     com::sun::star::uno::Any aEmpty;
     285         [ #  # ]:          0 :     aFocused <<= FOCUSED;
     286                 :            : 
     287         [ #  # ]:          0 :     commitEvent(AccessibleEventId::STATE_CHANGED,aFocused,aEmpty);
     288                 :          0 : }
     289                 :            : // -----------------------------------------------------------------------------
     290                 :            : 
     291                 :          0 : void SAL_CALL AccessibleBrowseBoxBase::focusLost( const ::com::sun::star::awt::FocusEvent& ) throw (::com::sun::star::uno::RuntimeException)
     292                 :            : {
     293                 :          0 :     com::sun::star::uno::Any aFocused;
     294                 :          0 :     com::sun::star::uno::Any aEmpty;
     295         [ #  # ]:          0 :     aFocused <<= FOCUSED;
     296                 :            : 
     297         [ #  # ]:          0 :     commitEvent(AccessibleEventId::STATE_CHANGED,aEmpty,aFocused);
     298                 :          0 : }
     299                 :            : // XAccessibleEventBroadcaster ------------------------------------------------
     300                 :            : 
     301                 :          0 : void SAL_CALL AccessibleBrowseBoxBase::addEventListener(
     302                 :            :         const Reference< XAccessibleEventListener>& _rxListener )
     303                 :            :     throw ( uno::RuntimeException )
     304                 :            : {
     305         [ #  # ]:          0 :     if ( _rxListener.is() )
     306                 :            :     {
     307         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( getOslMutex() );
     308         [ #  # ]:          0 :         if ( !getClientId( ) )
     309         [ #  # ]:          0 :             setClientId( AccessibleEventNotifier::registerClient( ) );
     310                 :            : 
     311 [ #  # ][ #  # ]:          0 :         AccessibleEventNotifier::addEventListener( getClientId( ), _rxListener );
     312                 :            :     }
     313                 :          0 : }
     314                 :            : 
     315                 :          0 : void SAL_CALL AccessibleBrowseBoxBase::removeEventListener(
     316                 :            :         const Reference< XAccessibleEventListener>& _rxListener )
     317                 :            :     throw ( uno::RuntimeException )
     318                 :            : {
     319 [ #  # ][ #  # ]:          0 :     if( _rxListener.is() && getClientId( ) )
                 [ #  # ]
     320                 :            :     {
     321         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( getOslMutex() );
     322         [ #  # ]:          0 :         sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener );
     323         [ #  # ]:          0 :         if ( !nListenerCount )
     324                 :            :         {
     325                 :            :             // no listeners anymore
     326                 :            :             // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
     327                 :            :             // and at least to us not firing any events anymore, in case somebody calls
     328                 :            :             // NotifyAccessibleEvent, again
     329                 :            : 
     330                 :          0 :             AccessibleEventNotifier::TClientId nId( getClientId( ) );
     331                 :          0 :             setClientId( 0 );
     332         [ #  # ]:          0 :             AccessibleEventNotifier::revokeClient( nId );
     333         [ #  # ]:          0 :         }
     334                 :            :     }
     335                 :          0 : }
     336                 :            : 
     337                 :            : // XTypeProvider --------------------------------------------------------------
     338                 :            : 
     339                 :            : namespace
     340                 :            : {
     341                 :            :     class theAccessibleBrowseBoxBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleBrowseBoxBaseImplementationId > {};
     342                 :            : }
     343                 :            : 
     344                 :          0 : Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxBase::getImplementationId()
     345                 :            :     throw ( uno::RuntimeException )
     346                 :            : {
     347                 :          0 :     return theAccessibleBrowseBoxBaseImplementationId::get().getSeq();
     348                 :            : }
     349                 :            : 
     350                 :            : // XServiceInfo ---------------------------------------------------------------
     351                 :            : 
     352                 :          0 : sal_Bool SAL_CALL AccessibleBrowseBoxBase::supportsService(
     353                 :            :         const OUString& rServiceName )
     354                 :            :     throw ( uno::RuntimeException )
     355                 :            : {
     356         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     357                 :            : 
     358         [ #  # ]:          0 :     Sequence< OUString > aSupportedServices( getSupportedServiceNames() );
     359                 :          0 :     const OUString* pArrBegin = aSupportedServices.getConstArray();
     360                 :          0 :     const OUString* pArrEnd = pArrBegin + aSupportedServices.getLength();
     361                 :          0 :     const OUString* pString = pArrBegin;
     362                 :            : 
     363 [ #  # ][ #  # ]:          0 :     for( ; ( pString != pArrEnd ) && ( rServiceName != *pString ); ++pString )
                 [ #  # ]
     364                 :            :         ;
     365                 :            : 
     366 [ #  # ][ #  # ]:          0 :     return pString != pArrEnd;
     367                 :            : }
     368                 :            : 
     369                 :          0 : Sequence< OUString > SAL_CALL AccessibleBrowseBoxBase::getSupportedServiceNames()
     370                 :            :     throw ( uno::RuntimeException )
     371                 :            : {
     372         [ #  # ]:          0 :     const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) );
     373         [ #  # ]:          0 :     return Sequence< OUString >( &aServiceName, 1 );
     374                 :            : }
     375                 :            : 
     376                 :            : // other public methods -------------------------------------------------------
     377                 :            : 
     378                 :          0 : void AccessibleBrowseBoxBase::setAccessibleName( const OUString& rName )
     379                 :            : {
     380         [ #  # ]:          0 :     ::osl::ClearableMutexGuard aGuard( getOslMutex() );
     381                 :          0 :     Any aOld;
     382         [ #  # ]:          0 :     aOld <<= maName;
     383                 :          0 :     maName = rName;
     384                 :            : 
     385         [ #  # ]:          0 :     aGuard.clear();
     386                 :            : 
     387                 :            :     commitEvent(
     388                 :            :         AccessibleEventId::NAME_CHANGED,
     389                 :            :         uno::makeAny( maName ),
     390 [ #  # ][ #  # ]:          0 :         aOld );
                 [ #  # ]
     391                 :          0 : }
     392                 :            : 
     393                 :          0 : void AccessibleBrowseBoxBase::setAccessibleDescription( const OUString& rDescription )
     394                 :            : {
     395         [ #  # ]:          0 :     ::osl::ClearableMutexGuard aGuard( getOslMutex() );
     396                 :          0 :     Any aOld;
     397         [ #  # ]:          0 :     aOld <<= maDescription;
     398                 :          0 :     maDescription = rDescription;
     399                 :            : 
     400         [ #  # ]:          0 :     aGuard.clear();
     401                 :            : 
     402                 :            :     commitEvent(
     403                 :            :         AccessibleEventId::DESCRIPTION_CHANGED,
     404                 :            :         uno::makeAny( maDescription ),
     405 [ #  # ][ #  # ]:          0 :         aOld );
                 [ #  # ]
     406                 :          0 : }
     407                 :            : 
     408                 :            : // internal virtual methods ---------------------------------------------------
     409                 :            : 
     410                 :          0 : sal_Bool AccessibleBrowseBoxBase::implIsShowing()
     411                 :            : {
     412                 :          0 :     sal_Bool bShowing = sal_False;
     413         [ #  # ]:          0 :     if( mxParent.is() )
     414                 :            :     {
     415                 :            :         Reference< XAccessibleComponent >
     416 [ #  # ][ #  # ]:          0 :             xParentComp( mxParent->getAccessibleContext(), uno::UNO_QUERY );
                 [ #  # ]
     417         [ #  # ]:          0 :         if( xParentComp.is() )
     418                 :          0 :             bShowing = implGetBoundingBox().IsOver(
     419 [ #  # ][ #  # ]:          0 :                 VCLRectangle( xParentComp->getBounds() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     420                 :            :     }
     421                 :          0 :     return bShowing;
     422                 :            : }
     423                 :            : 
     424                 :          0 : ::utl::AccessibleStateSetHelper* AccessibleBrowseBoxBase::implCreateStateSetHelper()
     425                 :            : {
     426                 :            :     ::utl::AccessibleStateSetHelper*
     427         [ #  # ]:          0 :         pStateSetHelper = new ::utl::AccessibleStateSetHelper;
     428                 :            : 
     429         [ #  # ]:          0 :     if( isAlive() )
     430                 :            :     {
     431                 :            :         // SHOWING done with mxParent
     432         [ #  # ]:          0 :         if( implIsShowing() )
     433                 :          0 :             pStateSetHelper->AddState( AccessibleStateType::SHOWING );
     434                 :            :         // BrowseBox fills StateSet with states depending on object type
     435                 :          0 :         mpBrowseBox->FillAccessibleStateSet( *pStateSetHelper, getType() );
     436                 :            :     }
     437                 :            :     else
     438                 :          0 :         pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
     439                 :            : 
     440                 :          0 :     return pStateSetHelper;
     441                 :            : }
     442                 :            : 
     443                 :            : // internal helper methods ----------------------------------------------------
     444                 :            : 
     445                 :          0 : sal_Bool AccessibleBrowseBoxBase::isAlive() const
     446                 :            : {
     447 [ #  # ][ #  # ]:          0 :     return !rBHelper.bDisposed && !rBHelper.bInDispose && mpBrowseBox;
                 [ #  # ]
     448                 :            : }
     449                 :            : 
     450                 :          0 : void AccessibleBrowseBoxBase::ensureIsAlive() const
     451                 :            :     throw ( lang::DisposedException )
     452                 :            : {
     453         [ #  # ]:          0 :     if( !isAlive() )
     454         [ #  # ]:          0 :         throw lang::DisposedException();
     455                 :          0 : }
     456                 :            : 
     457                 :          0 : Rectangle AccessibleBrowseBoxBase::getBoundingBox()
     458                 :            :     throw ( lang::DisposedException )
     459                 :            : {
     460         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     461         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     462         [ #  # ]:          0 :     ensureIsAlive();
     463         [ #  # ]:          0 :     Rectangle aRect = implGetBoundingBox();
     464 [ #  # ][ #  # ]:          0 :     if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
         [ #  # ][ #  # ]
     465                 :            :     {
     466                 :            :         SAL_WARN( "accessibility", "rectangle doesn't exist" );
     467                 :            :     }
     468 [ #  # ][ #  # ]:          0 :     return aRect;
     469                 :            : }
     470                 :            : 
     471                 :          0 : Rectangle AccessibleBrowseBoxBase::getBoundingBoxOnScreen()
     472                 :            :     throw ( lang::DisposedException )
     473                 :            : {
     474         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     475         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     476         [ #  # ]:          0 :     ensureIsAlive();
     477         [ #  # ]:          0 :     Rectangle aRect = implGetBoundingBoxOnScreen();
     478 [ #  # ][ #  # ]:          0 :     if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
         [ #  # ][ #  # ]
     479                 :            :     {
     480                 :            :         SAL_WARN( "accessibility", "rectangle doesn't exist" );
     481                 :            :     }
     482 [ #  # ][ #  # ]:          0 :     return aRect;
     483                 :            : }
     484                 :            : 
     485                 :          0 : void AccessibleBrowseBoxBase::commitEvent(
     486                 :            :         sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
     487                 :            : {
     488         [ #  # ]:          0 :     ::osl::ClearableMutexGuard aGuard( getOslMutex() );
     489         [ #  # ]:          0 :     if ( !getClientId( ) )
     490                 :            :             // if we don't have a client id for the notifier, then we don't have listeners, then
     491                 :            :             // we don't need to notify anything
     492                 :          0 :             return;
     493                 :            : 
     494                 :            :     // build an event object
     495         [ #  # ]:          0 :     AccessibleEventObject aEvent;
     496 [ #  # ][ #  # ]:          0 :     aEvent.Source = *this;
     497                 :          0 :     aEvent.EventId = _nEventId;
     498                 :          0 :     aEvent.OldValue = _rOldValue;
     499                 :          0 :     aEvent.NewValue = _rNewValue;
     500                 :            : 
     501                 :            :     // let the notifier handle this event
     502                 :            : 
     503 [ #  # ][ #  # ]:          0 :     AccessibleEventNotifier::addEvent( getClientId( ), aEvent );
         [ #  # ][ #  # ]
     504                 :            : }
     505                 :            : 
     506                 :          0 : sal_Int16 SAL_CALL AccessibleBrowseBoxBase::getAccessibleRole()
     507                 :            :     throw ( uno::RuntimeException )
     508                 :            : {
     509                 :          0 :     ensureIsAlive();
     510                 :          0 :     sal_Int16 nRole = AccessibleRole::UNKNOWN;
     511   [ #  #  #  #  :          0 :     switch ( meObjType )
                #  #  # ]
     512                 :            :     {
     513                 :            :         case BBTYPE_ROWHEADERCELL:
     514                 :          0 :             nRole = AccessibleRole::ROW_HEADER;
     515                 :          0 :             break;
     516                 :            :         case BBTYPE_COLUMNHEADERCELL:
     517                 :          0 :             nRole = AccessibleRole::COLUMN_HEADER;
     518                 :          0 :             break;
     519                 :            :         case BBTYPE_COLUMNHEADERBAR:
     520                 :            :         case BBTYPE_ROWHEADERBAR:
     521                 :            :         case BBTYPE_TABLE:
     522                 :          0 :             nRole = AccessibleRole::TABLE;
     523                 :          0 :             break;
     524                 :            :         case BBTYPE_TABLECELL:
     525                 :          0 :             nRole = AccessibleRole::TABLE_CELL;
     526                 :          0 :             break;
     527                 :            :         case BBTYPE_BROWSEBOX:
     528                 :          0 :             nRole = AccessibleRole::PANEL;
     529                 :          0 :             break;
     530                 :            :         case BBTYPE_CHECKBOXCELL:
     531                 :          0 :             nRole = AccessibleRole::CHECK_BOX;
     532                 :          0 :             break;
     533                 :            :     }
     534                 :          0 :     return nRole;
     535                 :            : }
     536                 :            : // -----------------------------------------------------------------------------
     537                 :          0 : Any SAL_CALL AccessibleBrowseBoxBase::getAccessibleKeyBinding()
     538                 :            :         throw ( uno::RuntimeException )
     539                 :            : {
     540                 :          0 :     return Any();
     541                 :            : }
     542                 :            : // -----------------------------------------------------------------------------
     543                 :          0 : Reference<XAccessible > SAL_CALL AccessibleBrowseBoxBase::getAccessibleAtPoint( const ::com::sun::star::awt::Point& )
     544                 :            :         throw ( uno::RuntimeException )
     545                 :            : {
     546                 :          0 :     return NULL;
     547                 :            : }
     548                 :            : // -----------------------------------------------------------------------------
     549                 :          0 : void SAL_CALL AccessibleBrowseBoxBase::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
     550                 :            : {
     551                 :          0 :     m_xFocusWindow = NULL;
     552                 :          0 : }
     553                 :            : // -----------------------------------------------------------------------------
     554                 :          0 : sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getForeground(  ) throw (::com::sun::star::uno::RuntimeException)
     555                 :            : {
     556         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     557         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     558         [ #  # ]:          0 :     ensureIsAlive();
     559                 :            : 
     560                 :          0 :     sal_Int32 nColor = 0;
     561         [ #  # ]:          0 :     Window* pInst = mpBrowseBox->GetWindowInstance();
     562         [ #  # ]:          0 :     if ( pInst )
     563                 :            :     {
     564 [ #  # ][ #  # ]:          0 :         if ( pInst->IsControlForeground() )
     565         [ #  # ]:          0 :             nColor = pInst->GetControlForeground().GetColor();
     566                 :            :         else
     567                 :            :         {
     568         [ #  # ]:          0 :             Font aFont;
     569 [ #  # ][ #  # ]:          0 :             if ( pInst->IsControlFont() )
     570 [ #  # ][ #  # ]:          0 :                 aFont = pInst->GetControlFont();
                 [ #  # ]
     571                 :            :             else
     572         [ #  # ]:          0 :                 aFont = pInst->GetFont();
     573 [ #  # ][ #  # ]:          0 :             nColor = aFont.GetColor().GetColor();
     574                 :            :         }
     575                 :            :     }
     576                 :            : 
     577 [ #  # ][ #  # ]:          0 :     return nColor;
     578                 :            : }
     579                 :            : // -----------------------------------------------------------------------------
     580                 :          0 : sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getBackground(  ) throw (::com::sun::star::uno::RuntimeException)
     581                 :            : {
     582         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     583         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     584         [ #  # ]:          0 :     ensureIsAlive();
     585                 :          0 :     sal_Int32 nColor = 0;
     586         [ #  # ]:          0 :     Window* pInst = mpBrowseBox->GetWindowInstance();
     587         [ #  # ]:          0 :     if ( pInst )
     588                 :            :     {
     589 [ #  # ][ #  # ]:          0 :         if ( pInst->IsControlBackground() )
     590         [ #  # ]:          0 :             nColor = pInst->GetControlBackground().GetColor();
     591                 :            :         else
     592         [ #  # ]:          0 :             nColor = pInst->GetBackground().GetColor().GetColor();
     593                 :            :     }
     594                 :            : 
     595 [ #  # ][ #  # ]:          0 :     return nColor;
     596                 :            : }
     597                 :            : 
     598                 :            : // ============================================================================
     599                 :            : // XInterface -----------------------------------------------------------------
     600 [ #  # ][ #  # ]:          0 : IMPLEMENT_FORWARD_XINTERFACE2( BrowseBoxAccessibleElement, AccessibleBrowseBoxBase, BrowseBoxAccessibleElement_Base )
     601                 :            : 
     602                 :            : // XTypeProvider --------------------------------------------------------------
     603 [ #  # ][ #  # ]:          0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( BrowseBoxAccessibleElement, AccessibleBrowseBoxBase, BrowseBoxAccessibleElement_Base )
                 [ #  # ]
     604                 :            : 
     605                 :            : // XAccessible ----------------------------------------------------------------
     606                 :            : 
     607                 :          0 : Reference< XAccessibleContext > SAL_CALL BrowseBoxAccessibleElement::getAccessibleContext() throw ( uno::RuntimeException )
     608                 :            : {
     609                 :          0 :     ensureIsAlive();
     610                 :          0 :     return this;
     611                 :            : }
     612                 :            : 
     613                 :            : // ----------------------------------------------------------------------------
     614                 :          0 : BrowseBoxAccessibleElement::BrowseBoxAccessibleElement( const Reference< XAccessible >& rxParent, IAccessibleTableProvider& rBrowseBox,
     615                 :            :         const Reference< awt::XWindow >& _xFocusWindow, AccessibleBrowseBoxObjType  eObjType )
     616                 :          0 :     :AccessibleBrowseBoxBase( rxParent, rBrowseBox, _xFocusWindow, eObjType )
     617                 :            : {
     618                 :          0 : }
     619                 :            : 
     620                 :            : // ----------------------------------------------------------------------------
     621                 :          0 : BrowseBoxAccessibleElement::BrowseBoxAccessibleElement( const Reference< XAccessible >& rxParent, IAccessibleTableProvider& rBrowseBox,
     622                 :            :         const Reference< awt::XWindow >& _xFocusWindow, AccessibleBrowseBoxObjType  eObjType,
     623                 :            :         const ::rtl::OUString& rName, const ::rtl::OUString& rDescription )
     624                 :          0 :     :AccessibleBrowseBoxBase( rxParent, rBrowseBox, _xFocusWindow, eObjType, rName, rDescription )
     625                 :            : {
     626                 :          0 : }
     627                 :            : 
     628                 :            : // ----------------------------------------------------------------------------
     629                 :          0 : BrowseBoxAccessibleElement::~BrowseBoxAccessibleElement( )
     630                 :            : {
     631         [ #  # ]:          0 : }
     632                 :            : 
     633                 :            : // ============================================================================
     634                 :            : 
     635                 :            : } // namespace accessibility
     636                 :            : 
     637                 :            : // ============================================================================
     638                 :            : 
     639                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10