LCOV - code coverage report
Current view: top level - svtools/source/control - valueacc.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 9 500 1.8 %
Date: 2012-08-25 Functions: 3 78 3.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 5 730 0.7 %

           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                 :            : #define _SV_VALUESET_CXX
      31                 :            : 
      32                 :            : #include <unotools/accessiblestatesethelper.hxx>
      33                 :            : #include <vcl/svapp.hxx>
      34                 :            : #include <svtools/valueset.hxx>
      35                 :            : #include "valueimp.hxx"
      36                 :            : #include <comphelper/servicehelper.hxx>
      37                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      38                 :            : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      39                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      40                 :            : 
      41                 :            : using namespace ::com::sun::star;
      42                 :            : 
      43                 :            : // ----------------
      44                 :            : // - ValueSetItem -
      45                 :            : // ----------------
      46                 :            : 
      47                 :        583 : ValueSetItem::ValueSetItem( ValueSet& rParent )
      48                 :            :     : mrParent(rParent)
      49                 :            :     , mnId(0)
      50                 :            :     , meType(VALUESETITEM_NONE)
      51                 :            :     , mbVisible(true)
      52                 :            :     , mpData(NULL)
      53         [ +  - ]:        583 :     , mpxAcc(NULL)
      54                 :            : {
      55                 :        583 : }
      56                 :            : 
      57                 :            : // -----------------------------------------------------------------------
      58                 :            : 
      59         [ +  - ]:        583 : ValueSetItem::~ValueSetItem()
      60                 :            : {
      61         [ -  + ]:        583 :     if( mpxAcc )
      62                 :            :     {
      63 [ #  # ][ #  # ]:          0 :         static_cast< ValueItemAcc* >( mpxAcc->get() )->ParentDestroyed();
                 [ #  # ]
      64         [ #  # ]:          0 :         delete mpxAcc;
      65                 :            :     }
      66                 :        583 : }
      67                 :            : 
      68                 :            : // -----------------------------------------------------------------------
      69                 :            : 
      70                 :          0 : uno::Reference< accessibility::XAccessible > ValueSetItem::GetAccessible( bool bIsTransientChildrenDisabled )
      71                 :            : {
      72         [ #  # ]:          0 :     if( !mpxAcc )
      73 [ #  # ][ #  # ]:          0 :         mpxAcc = new uno::Reference< accessibility::XAccessible >( new ValueItemAcc( this, bIsTransientChildrenDisabled ) );
                 [ #  # ]
      74                 :            : 
      75                 :          0 :     return *mpxAcc;
      76                 :            : }
      77                 :            : 
      78                 :            : // ---------------
      79                 :            : // - ValueSetAcc -
      80                 :            : // ---------------
      81                 :            : 
      82                 :          0 : ValueSetAcc::ValueSetAcc( ValueSet* pParent, bool bIsTransientChildrenDisabled ) :
      83                 :            :     ValueSetAccComponentBase (m_aMutex),
      84                 :            :     mpParent( pParent ),
      85                 :            :     mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ),
      86         [ #  # ]:          0 :     mbIsFocused(false)
      87                 :            : {
      88                 :          0 : }
      89                 :            : 
      90                 :            : // -----------------------------------------------------------------------------
      91                 :            : 
      92         [ #  # ]:          0 : ValueSetAcc::~ValueSetAcc()
      93                 :            : {
      94         [ #  # ]:          0 : }
      95                 :            : 
      96                 :            : // -----------------------------------------------------------------------
      97                 :            : 
      98                 :          0 : void ValueSetAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue )
      99                 :            : {
     100         [ #  # ]:          0 :     if( nEventId )
     101                 :            :     {
     102         [ #  # ]:          0 :         ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >                  aTmpListeners( mxEventListeners );
     103   [ #  #  #  # ]:          0 :         ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator  aIter( aTmpListeners.begin() );
     104         [ #  # ]:          0 :         accessibility::AccessibleEventObject                                                        aEvtObject;
     105                 :            : 
     106                 :          0 :         aEvtObject.EventId = nEventId;
     107         [ #  # ]:          0 :         aEvtObject.Source = static_cast<uno::XWeak*>(this);
     108                 :          0 :         aEvtObject.NewValue = rNewValue;
     109                 :          0 :         aEvtObject.OldValue = rOldValue;
     110                 :            : 
     111 [ #  # ][ #  # ]:          0 :         while( aIter != aTmpListeners.end() )
     112                 :            :         {
     113                 :            :             try
     114                 :            :             {
     115 [ #  # ][ #  # ]:          0 :                 (*aIter)->notifyEvent( aEvtObject );
     116                 :            :             }
     117         [ #  # ]:          0 :             catch(const uno::Exception&)
     118                 :            :             {
     119                 :            :             }
     120                 :            : 
     121         [ #  # ]:          0 :             aIter++;
     122         [ #  # ]:          0 :         }
     123                 :            :     }
     124                 :          0 : }
     125                 :            : 
     126                 :            : namespace
     127                 :            : {
     128                 :            :     class theValueSetAccUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theValueSetAccUnoTunnelId > {};
     129                 :            : }
     130                 :            : 
     131                 :          0 : const uno::Sequence< sal_Int8 >& ValueSetAcc::getUnoTunnelId()
     132                 :            : {
     133                 :          0 :     return theValueSetAccUnoTunnelId::get().getSeq();
     134                 :            : }
     135                 :            : 
     136                 :            : // -----------------------------------------------------------------------------
     137                 :            : 
     138                 :        836 : ValueSetAcc* ValueSetAcc::getImplementation( const uno::Reference< uno::XInterface >& rxData )
     139                 :            :     throw()
     140                 :            : {
     141                 :            :     try
     142                 :            :     {
     143         [ +  - ]:        836 :         uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
     144 [ -  + ][ #  # ]:        836 :         return( xUnoTunnel.is() ? reinterpret_cast<ValueSetAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ValueSetAcc::getUnoTunnelId() ))) : NULL );
         [ #  # ][ #  # ]
                 [ #  # ]
     145                 :            :     }
     146                 :          0 :     catch(const ::com::sun::star::uno::Exception&)
     147                 :            :     {
     148                 :          0 :         return NULL;
     149                 :            :     }
     150                 :            : }
     151                 :            : 
     152                 :            : 
     153                 :            : // -----------------------------------------------------------------------------
     154                 :            : 
     155                 :          0 : void ValueSetAcc::GetFocus (void)
     156                 :            : {
     157                 :          0 :     mbIsFocused = true;
     158                 :            : 
     159                 :            :     // Boradcast the state change.
     160                 :          0 :     ::com::sun::star::uno::Any aOldState, aNewState;
     161         [ #  # ]:          0 :     aNewState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED;
     162                 :            :     FireAccessibleEvent(
     163                 :            :         ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED,
     164         [ #  # ]:          0 :         aOldState, aNewState);
     165                 :          0 : }
     166                 :            : 
     167                 :            : // -----------------------------------------------------------------------------
     168                 :            : 
     169                 :          0 : void ValueSetAcc::LoseFocus (void)
     170                 :            : {
     171                 :          0 :     mbIsFocused = false;
     172                 :            : 
     173                 :            :     // Boradcast the state change.
     174                 :          0 :     ::com::sun::star::uno::Any aOldState, aNewState;
     175         [ #  # ]:          0 :     aOldState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED;
     176                 :            :     FireAccessibleEvent(
     177                 :            :         ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED,
     178         [ #  # ]:          0 :         aOldState, aNewState);
     179                 :          0 : }
     180                 :            : 
     181                 :            : // -----------------------------------------------------------------------------
     182                 :            : 
     183                 :          0 : uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueSetAcc::getAccessibleContext()
     184                 :            :     throw (uno::RuntimeException)
     185                 :            : {
     186                 :          0 :     ThrowIfDisposed();
     187                 :          0 :     return this;
     188                 :            : }
     189                 :            : 
     190                 :            : // -----------------------------------------------------------------------------
     191                 :            : 
     192                 :          0 : sal_Int32 SAL_CALL ValueSetAcc::getAccessibleChildCount()
     193                 :            :     throw (uno::RuntimeException)
     194                 :            : {
     195         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     196         [ #  # ]:          0 :     ThrowIfDisposed();
     197                 :            : 
     198         [ #  # ]:          0 :     sal_Int32 nCount = mpParent->ImplGetVisibleItemCount();
     199 [ #  # ][ #  # ]:          0 :     if (HasNoneField())
     200                 :          0 :         nCount += 1;
     201         [ #  # ]:          0 :     return nCount;
     202                 :            : }
     203                 :            : 
     204                 :            : // -----------------------------------------------------------------------------
     205                 :            : 
     206                 :          0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleChild( sal_Int32 i )
     207                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     208                 :            : {
     209         [ #  # ]:          0 :     ThrowIfDisposed();
     210         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     211                 :          0 :     uno::Reference< accessibility::XAccessible >    xRet;
     212         [ #  # ]:          0 :     ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(i));
     213                 :            : 
     214         [ #  # ]:          0 :     if( pItem )
     215 [ #  # ][ #  # ]:          0 :         xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
     216                 :            :     else
     217         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
     218                 :            : 
     219         [ #  # ]:          0 :     return xRet;
     220                 :            : }
     221                 :            : 
     222                 :            : // -----------------------------------------------------------------------------
     223                 :            : 
     224                 :          0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleParent()
     225                 :            :     throw (uno::RuntimeException)
     226                 :            : {
     227         [ #  # ]:          0 :     ThrowIfDisposed();
     228         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     229         [ #  # ]:          0 :     Window*                                         pParent = mpParent->GetParent();
     230                 :          0 :     uno::Reference< accessibility::XAccessible >    xRet;
     231                 :            : 
     232         [ #  # ]:          0 :     if( pParent )
     233 [ #  # ][ #  # ]:          0 :         xRet = pParent->GetAccessible();
     234                 :            : 
     235         [ #  # ]:          0 :     return xRet;
     236                 :            : }
     237                 :            : 
     238                 :            : // -----------------------------------------------------------------------------
     239                 :            : 
     240                 :          0 : sal_Int32 SAL_CALL ValueSetAcc::getAccessibleIndexInParent()
     241                 :            :     throw (uno::RuntimeException)
     242                 :            : {
     243         [ #  # ]:          0 :     ThrowIfDisposed();
     244         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     245         [ #  # ]:          0 :     Window*                 pParent = mpParent->GetParent();
     246                 :          0 :     sal_Int32               nRet = 0;
     247                 :            : 
     248         [ #  # ]:          0 :     if( pParent )
     249                 :            :     {
     250                 :          0 :         sal_Bool bFound = sal_False;
     251                 :            : 
     252 [ #  # ][ #  # ]:          0 :         for( sal_uInt16 i = 0, nCount = pParent->GetChildCount(); ( i < nCount ) && !bFound; i++ )
         [ #  # ][ #  # ]
     253                 :            :         {
     254 [ #  # ][ #  # ]:          0 :             if( pParent->GetChild( i ) == mpParent )
     255                 :            :             {
     256                 :          0 :                 nRet = i;
     257                 :          0 :                 bFound = sal_True;
     258                 :            :             }
     259                 :            :         }
     260                 :            :     }
     261                 :            : 
     262         [ #  # ]:          0 :     return nRet;
     263                 :            : }
     264                 :            : 
     265                 :            : // -----------------------------------------------------------------------------
     266                 :            : 
     267                 :          0 : sal_Int16 SAL_CALL ValueSetAcc::getAccessibleRole()
     268                 :            :     throw (uno::RuntimeException)
     269                 :            : {
     270                 :          0 :     ThrowIfDisposed();
     271                 :            :     // #i73746# As the Java Access Bridge (v 2.0.1) uses "managesDescendants"
     272                 :            :     // always if the role is LIST, we need a different role in this case
     273                 :            :     return (mbIsTransientChildrenDisabled
     274                 :            :             ? accessibility::AccessibleRole::PANEL
     275         [ #  # ]:          0 :             : accessibility::AccessibleRole::LIST );
     276                 :            : }
     277                 :            : 
     278                 :            : // -----------------------------------------------------------------------------
     279                 :            : 
     280                 :          0 : ::rtl::OUString SAL_CALL ValueSetAcc::getAccessibleDescription()
     281                 :            :     throw (uno::RuntimeException)
     282                 :            : {
     283         [ #  # ]:          0 :     ThrowIfDisposed();
     284         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     285         [ #  # ]:          0 :     String              aRet( RTL_CONSTASCII_USTRINGPARAM( "ValueSet" ) );
     286                 :            : 
     287 [ #  # ][ #  # ]:          0 :     return aRet;
                 [ #  # ]
     288                 :            : }
     289                 :            : 
     290                 :            : // -----------------------------------------------------------------------------
     291                 :            : 
     292                 :          0 : ::rtl::OUString SAL_CALL ValueSetAcc::getAccessibleName()
     293                 :            :     throw (uno::RuntimeException)
     294                 :            : {
     295         [ #  # ]:          0 :     ThrowIfDisposed();
     296         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     297         [ #  # ]:          0 :     String              aRet;
     298                 :            : 
     299         [ #  # ]:          0 :     if ( mpParent )
     300 [ #  # ][ #  # ]:          0 :         aRet = mpParent->GetAccessibleName();
                 [ #  # ]
     301                 :            : 
     302         [ #  # ]:          0 :     if ( !aRet.Len() )
     303                 :            :     {
     304         [ #  # ]:          0 :         Window* pLabel = mpParent->GetAccessibleRelationLabeledBy();
     305 [ #  # ][ #  # ]:          0 :         if ( pLabel && pLabel != mpParent )
     306 [ #  # ][ #  # ]:          0 :             aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() );
         [ #  # ][ #  # ]
                 [ #  # ]
     307                 :            :     }
     308                 :            : 
     309 [ #  # ][ #  # ]:          0 :     return aRet;
                 [ #  # ]
     310                 :            : }
     311                 :            : 
     312                 :            : // -----------------------------------------------------------------------------
     313                 :            : 
     314                 :          0 : uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueSetAcc::getAccessibleRelationSet()
     315                 :            :     throw (uno::RuntimeException)
     316                 :            : {
     317                 :          0 :     ThrowIfDisposed();
     318                 :          0 :     return uno::Reference< accessibility::XAccessibleRelationSet >();
     319                 :            : }
     320                 :            : 
     321                 :            : // -----------------------------------------------------------------------------
     322                 :            : 
     323                 :          0 : uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueSetAcc::getAccessibleStateSet()
     324                 :            :     throw (uno::RuntimeException)
     325                 :            : {
     326                 :          0 :     ThrowIfDisposed();
     327         [ #  # ]:          0 :     ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper();
     328                 :            : 
     329                 :            :     // Set some states.
     330                 :          0 :     pStateSet->AddState (accessibility::AccessibleStateType::ENABLED);
     331                 :          0 :     pStateSet->AddState (accessibility::AccessibleStateType::SENSITIVE);
     332                 :          0 :     pStateSet->AddState (accessibility::AccessibleStateType::SHOWING);
     333                 :          0 :     pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE);
     334         [ #  # ]:          0 :     if ( !mbIsTransientChildrenDisabled )
     335                 :          0 :         pStateSet->AddState (accessibility::AccessibleStateType::MANAGES_DESCENDANTS);
     336                 :          0 :     pStateSet->AddState (accessibility::AccessibleStateType::FOCUSABLE);
     337         [ #  # ]:          0 :     if (mbIsFocused)
     338                 :          0 :         pStateSet->AddState (accessibility::AccessibleStateType::FOCUSED);
     339                 :            : 
     340         [ #  # ]:          0 :     return pStateSet;
     341                 :            : }
     342                 :            : 
     343                 :            : // -----------------------------------------------------------------------------
     344                 :            : 
     345                 :          0 : lang::Locale SAL_CALL ValueSetAcc::getLocale()
     346                 :            :     throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException)
     347                 :            : {
     348         [ #  # ]:          0 :     ThrowIfDisposed();
     349         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     350                 :          0 :     const ::rtl::OUString                           aEmptyStr;
     351         [ #  # ]:          0 :     uno::Reference< accessibility::XAccessible >    xParent( getAccessibleParent() );
     352                 :          0 :     lang::Locale                                    aRet( aEmptyStr, aEmptyStr, aEmptyStr );
     353                 :            : 
     354         [ #  # ]:          0 :     if( xParent.is() )
     355                 :            :     {
     356 [ #  # ][ #  # ]:          0 :         uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
     357                 :            : 
     358         [ #  # ]:          0 :         if( xParentContext.is() )
     359 [ #  # ][ #  # ]:          0 :             aRet = xParentContext->getLocale ();
     360                 :            :     }
     361                 :            : 
     362         [ #  # ]:          0 :     return aRet;
     363                 :            : }
     364                 :            : 
     365                 :            : // -----------------------------------------------------------------------------
     366                 :            : 
     367                 :          0 : void SAL_CALL ValueSetAcc::addEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
     368                 :            :     throw (uno::RuntimeException)
     369                 :            : {
     370         [ #  # ]:          0 :     ThrowIfDisposed();
     371         [ #  # ]:          0 :     ::osl::MutexGuard aGuard (m_aMutex);
     372                 :            : 
     373         [ #  # ]:          0 :     if( rxListener.is() )
     374                 :            :     {
     375         [ #  # ]:          0 :            ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin();
     376                 :          0 :         sal_Bool bFound = sal_False;
     377                 :            : 
     378 [ #  # ][ #  # ]:          0 :         while( !bFound && ( aIter != mxEventListeners.end() ) )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     379                 :            :         {
     380 [ #  # ][ #  # ]:          0 :             if( *aIter == rxListener )
     381                 :          0 :                 bFound = sal_True;
     382                 :            :             else
     383                 :          0 :                 ++aIter;
     384                 :            :         }
     385                 :            : 
     386         [ #  # ]:          0 :         if (!bFound)
     387         [ #  # ]:          0 :             mxEventListeners.push_back( rxListener );
     388         [ #  # ]:          0 :     }
     389                 :          0 : }
     390                 :            : 
     391                 :            : // -----------------------------------------------------------------------------
     392                 :            : 
     393                 :          0 : void SAL_CALL ValueSetAcc::removeEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
     394                 :            :     throw (uno::RuntimeException)
     395                 :            : {
     396         [ #  # ]:          0 :     ThrowIfDisposed();
     397         [ #  # ]:          0 :     ::osl::MutexGuard aGuard (m_aMutex);
     398                 :            : 
     399         [ #  # ]:          0 :     if( rxListener.is() )
     400                 :            :     {
     401                 :          0 :            ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::iterator aIter = mxEventListeners.begin();
     402                 :          0 :         sal_Bool bFound = sal_False;
     403                 :            : 
     404 [ #  # ][ #  # ]:          0 :         while( !bFound && ( aIter != mxEventListeners.end() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     405                 :            :         {
     406 [ #  # ][ #  # ]:          0 :             if( *aIter == rxListener )
     407                 :            :             {
     408         [ #  # ]:          0 :                 mxEventListeners.erase( aIter );
     409                 :          0 :                 bFound = sal_True;
     410                 :            :             }
     411                 :            :             else
     412                 :          0 :                 ++aIter;
     413                 :            :         }
     414         [ #  # ]:          0 :     }
     415                 :          0 : }
     416                 :            : 
     417                 :            : // -----------------------------------------------------------------------------
     418                 :            : 
     419                 :          0 : sal_Bool SAL_CALL ValueSetAcc::containsPoint( const awt::Point& aPoint )
     420                 :            :     throw (uno::RuntimeException)
     421                 :            : {
     422         [ #  # ]:          0 :     ThrowIfDisposed();
     423         [ #  # ]:          0 :     const awt::Rectangle    aRect( getBounds() );
     424                 :          0 :     const Point             aSize( aRect.Width, aRect.Height );
     425                 :          0 :     const Point             aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
     426                 :            : 
     427 [ #  # ][ #  # ]:          0 :     return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
     428                 :            : }
     429                 :            : 
     430                 :            : // -----------------------------------------------------------------------------
     431                 :            : 
     432                 :          0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleAtPoint( const awt::Point& aPoint )
     433                 :            :     throw (uno::RuntimeException)
     434                 :            : {
     435         [ #  # ]:          0 :     ThrowIfDisposed();
     436         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     437         [ #  # ]:          0 :     const sal_uInt16                                    nItemId = mpParent->GetItemId( Point( aPoint.X, aPoint.Y ) );
     438                 :          0 :     uno::Reference< accessibility::XAccessible >    xRet;
     439                 :            : 
     440         [ #  # ]:          0 :     if ( nItemId )
     441                 :            :     {
     442         [ #  # ]:          0 :         const size_t nItemPos = mpParent->GetItemPos( nItemId );
     443                 :            : 
     444         [ #  # ]:          0 :         if( VALUESET_ITEM_NONEITEM != nItemPos )
     445                 :            :         {
     446                 :          0 :             ValueSetItem *const pItem = mpParent->mItemList[nItemPos];
     447 [ #  # ][ #  # ]:          0 :             xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
     448                 :            :         }
     449                 :            :     }
     450                 :            : 
     451         [ #  # ]:          0 :     return xRet;
     452                 :            : }
     453                 :            : 
     454                 :            : // -----------------------------------------------------------------------------
     455                 :            : 
     456                 :          0 : awt::Rectangle SAL_CALL ValueSetAcc::getBounds()
     457                 :            :     throw (uno::RuntimeException)
     458                 :            : {
     459         [ #  # ]:          0 :     ThrowIfDisposed();
     460         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     461         [ #  # ]:          0 :     const Point         aOutPos( mpParent->GetPosPixel() );
     462                 :          0 :     const Size          aOutSize( mpParent->GetOutputSizePixel() );
     463                 :          0 :     awt::Rectangle      aRet;
     464                 :            : 
     465                 :          0 :     aRet.X = aOutPos.X();
     466                 :          0 :     aRet.Y = aOutPos.Y();
     467                 :          0 :     aRet.Width = aOutSize.Width();
     468                 :          0 :     aRet.Height = aOutSize.Height();
     469                 :            : 
     470         [ #  # ]:          0 :     return aRet;
     471                 :            : }
     472                 :            : 
     473                 :            : // -----------------------------------------------------------------------------
     474                 :            : 
     475                 :          0 : awt::Point SAL_CALL ValueSetAcc::getLocation()
     476                 :            :     throw (uno::RuntimeException)
     477                 :            : {
     478         [ #  # ]:          0 :     ThrowIfDisposed();
     479         [ #  # ]:          0 :     const awt::Rectangle    aRect( getBounds() );
     480                 :          0 :     awt::Point              aRet;
     481                 :            : 
     482                 :          0 :     aRet.X = aRect.X;
     483                 :          0 :     aRet.Y = aRect.Y;
     484                 :            : 
     485                 :          0 :     return aRet;
     486                 :            : }
     487                 :            : 
     488                 :            : // -----------------------------------------------------------------------------
     489                 :            : 
     490                 :          0 : awt::Point SAL_CALL ValueSetAcc::getLocationOnScreen()
     491                 :            :     throw (uno::RuntimeException)
     492                 :            : {
     493         [ #  # ]:          0 :     ThrowIfDisposed();
     494         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     495         [ #  # ]:          0 :     const Point         aScreenPos( mpParent->OutputToAbsoluteScreenPixel( Point() ) );
     496                 :          0 :     awt::Point          aRet;
     497                 :            : 
     498                 :          0 :     aRet.X = aScreenPos.X();
     499                 :          0 :     aRet.Y = aScreenPos.Y();
     500                 :            : 
     501         [ #  # ]:          0 :     return aRet;
     502                 :            : }
     503                 :            : 
     504                 :            : // -----------------------------------------------------------------------------
     505                 :            : 
     506                 :          0 : awt::Size SAL_CALL ValueSetAcc::getSize()
     507                 :            :     throw (uno::RuntimeException)
     508                 :            : {
     509         [ #  # ]:          0 :     ThrowIfDisposed();
     510         [ #  # ]:          0 :     const awt::Rectangle    aRect( getBounds() );
     511                 :          0 :     awt::Size               aRet;
     512                 :            : 
     513                 :          0 :     aRet.Width = aRect.Width;
     514                 :          0 :     aRet.Height = aRect.Height;
     515                 :            : 
     516                 :          0 :     return aRet;
     517                 :            : }
     518                 :            : 
     519                 :            : // -----------------------------------------------------------------------------
     520                 :            : 
     521                 :          0 : void SAL_CALL ValueSetAcc::grabFocus()
     522                 :            :     throw (uno::RuntimeException)
     523                 :            : {
     524         [ #  # ]:          0 :     ThrowIfDisposed();
     525         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     526 [ #  # ][ #  # ]:          0 :     mpParent->GrabFocus();
     527                 :          0 : }
     528                 :            : 
     529                 :            : // -----------------------------------------------------------------------------
     530                 :            : 
     531                 :          0 : uno::Any SAL_CALL ValueSetAcc::getAccessibleKeyBinding()
     532                 :            :     throw (uno::RuntimeException)
     533                 :            : {
     534                 :          0 :     ThrowIfDisposed();
     535                 :          0 :     return uno::Any();
     536                 :            : }
     537                 :            : 
     538                 :            : // -----------------------------------------------------------------------------
     539                 :            : 
     540                 :          0 : sal_Int32 SAL_CALL ValueSetAcc::getForeground(  )
     541                 :            :     throw (uno::RuntimeException)
     542                 :            : {
     543                 :          0 :     ThrowIfDisposed();
     544                 :          0 :     sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor().GetColor();
     545                 :          0 :     return static_cast<sal_Int32>(nColor);
     546                 :            : }
     547                 :            : 
     548                 :            : // -----------------------------------------------------------------------------
     549                 :            : 
     550                 :          0 : sal_Int32 SAL_CALL ValueSetAcc::getBackground(  )
     551                 :            :     throw (uno::RuntimeException)
     552                 :            : {
     553                 :          0 :     ThrowIfDisposed();
     554                 :          0 :     sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
     555                 :          0 :     return static_cast<sal_Int32>(nColor);
     556                 :            : }
     557                 :            : 
     558                 :            : // -----------------------------------------------------------------------------
     559                 :            : 
     560                 :          0 : void SAL_CALL ValueSetAcc::selectAccessibleChild( sal_Int32 nChildIndex )
     561                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     562                 :            : {
     563         [ #  # ]:          0 :     ThrowIfDisposed();
     564         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     565         [ #  # ]:          0 :     ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
     566                 :            : 
     567         [ #  # ]:          0 :     if(pItem != NULL)
     568                 :            :     {
     569         [ #  # ]:          0 :         mpParent->SelectItem( pItem->mnId );
     570         [ #  # ]:          0 :         mpParent->Select ();
     571                 :            :     }
     572                 :            :     else
     573 [ #  # ][ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
     574                 :          0 : }
     575                 :            : 
     576                 :            : // -----------------------------------------------------------------------------
     577                 :            : 
     578                 :          0 : sal_Bool SAL_CALL ValueSetAcc::isAccessibleChildSelected( sal_Int32 nChildIndex )
     579                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     580                 :            : {
     581         [ #  # ]:          0 :     ThrowIfDisposed();
     582         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     583         [ #  # ]:          0 :     ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
     584                 :          0 :     sal_Bool            bRet = sal_False;
     585                 :            : 
     586         [ #  # ]:          0 :     if (pItem != NULL)
     587                 :          0 :         bRet = mpParent->IsItemSelected( pItem->mnId );
     588                 :            :     else
     589         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
     590                 :            : 
     591         [ #  # ]:          0 :     return bRet;
     592                 :            : }
     593                 :            : 
     594                 :            : // -----------------------------------------------------------------------------
     595                 :            : 
     596                 :          0 : void SAL_CALL ValueSetAcc::clearAccessibleSelection()
     597                 :            :     throw (uno::RuntimeException)
     598                 :            : {
     599         [ #  # ]:          0 :     ThrowIfDisposed();
     600         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     601 [ #  # ][ #  # ]:          0 :     mpParent->SetNoSelection();
     602                 :          0 : }
     603                 :            : 
     604                 :            : // -----------------------------------------------------------------------------
     605                 :            : 
     606                 :          0 : void SAL_CALL ValueSetAcc::selectAllAccessibleChildren()
     607                 :            :     throw (uno::RuntimeException)
     608                 :            : {
     609                 :          0 :     ThrowIfDisposed();
     610                 :            :     // unsupported due to single selection only
     611                 :          0 : }
     612                 :            : 
     613                 :            : // -----------------------------------------------------------------------------
     614                 :            : 
     615                 :          0 : sal_Int32 SAL_CALL ValueSetAcc::getSelectedAccessibleChildCount()
     616                 :            :     throw (uno::RuntimeException)
     617                 :            : {
     618         [ #  # ]:          0 :     ThrowIfDisposed();
     619         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     620                 :          0 :     sal_Int32           nRet = 0;
     621                 :            : 
     622 [ #  # ][ #  # ]:          0 :     for( sal_uInt16 i = 0, nCount = getItemCount(); i < nCount; i++ )
     623                 :            :     {
     624         [ #  # ]:          0 :         ValueSetItem* pItem = getItem (i);
     625                 :            : 
     626 [ #  # ][ #  # ]:          0 :         if( pItem && mpParent->IsItemSelected( pItem->mnId ) )
                 [ #  # ]
     627                 :          0 :             ++nRet;
     628                 :            :     }
     629                 :            : 
     630         [ #  # ]:          0 :     return nRet;
     631                 :            : }
     632                 :            : 
     633                 :            : // -----------------------------------------------------------------------------
     634                 :            : 
     635                 :          0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
     636                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     637                 :            : {
     638         [ #  # ]:          0 :     ThrowIfDisposed();
     639         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     640                 :          0 :     uno::Reference< accessibility::XAccessible >    xRet;
     641                 :            : 
     642 [ #  # ][ #  # ]:          0 :     for( sal_uInt16 i = 0, nCount = getItemCount(), nSel = 0; ( i < nCount ) && !xRet.is(); i++ )
         [ #  # ][ #  # ]
     643                 :            :     {
     644         [ #  # ]:          0 :         ValueSetItem* pItem = getItem(i);
     645                 :            : 
     646 [ #  # ][ #  # ]:          0 :         if( pItem && mpParent->IsItemSelected( pItem->mnId ) && ( nSelectedChildIndex == static_cast< sal_Int32 >( nSel++ ) ) )
         [ #  # ][ #  # ]
     647 [ #  # ][ #  # ]:          0 :             xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
     648                 :            :     }
     649                 :            : 
     650         [ #  # ]:          0 :     return xRet;
     651                 :            : }
     652                 :            : 
     653                 :            : // -----------------------------------------------------------------------------
     654                 :            : 
     655                 :          0 : void SAL_CALL ValueSetAcc::deselectAccessibleChild( sal_Int32 nChildIndex )
     656                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     657                 :            : {
     658         [ #  # ]:          0 :     ThrowIfDisposed();
     659         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     660                 :            :     // Because of the single selection we can reset the whole selection when
     661                 :            :     // the specified child is currently selected.
     662 [ #  # ][ #  # ]:          0 :     if (isAccessibleChildSelected(nChildIndex))
     663 [ #  # ][ #  # ]:          0 :         mpParent->SetNoSelection();
     664                 :          0 : }
     665                 :            : 
     666                 :            : // -----------------------------------------------------------------------------
     667                 :            : 
     668                 :          0 : sal_Int64 SAL_CALL ValueSetAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw( uno::RuntimeException )
     669                 :            : {
     670                 :            :     sal_Int64 nRet;
     671                 :            : 
     672 [ #  # ][ #  # ]:          0 :     if( ( rId.getLength() == 16 ) && ( 0 == rtl_compareMemory( ValueSetAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
                 [ #  # ]
     673                 :          0 :         nRet = reinterpret_cast< sal_Int64 >( this );
     674                 :            :     else
     675                 :          0 :         nRet = 0;
     676                 :            : 
     677                 :          0 :     return nRet;
     678                 :            : }
     679                 :            : 
     680                 :            : 
     681                 :            : 
     682                 :            : 
     683                 :          0 : void SAL_CALL ValueSetAcc::disposing (void)
     684                 :            : {
     685         [ #  # ]:          0 :     ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> > aListenerListCopy;
     686                 :            : 
     687                 :            :     {
     688                 :            :         // Make a copy of the list and clear the original.
     689         [ #  # ]:          0 :         const SolarMutexGuard aSolarGuard;
     690         [ #  # ]:          0 :         ::osl::MutexGuard aGuard (m_aMutex);
     691         [ #  # ]:          0 :         aListenerListCopy = mxEventListeners;
     692                 :          0 :         mxEventListeners.clear();
     693                 :            : 
     694                 :            :         // Reset the pointer to the parent.  It has to be the one who has
     695                 :            :         // disposed us because he is dying.
     696 [ #  # ][ #  # ]:          0 :         mpParent = NULL;
     697                 :            :     }
     698                 :            : 
     699                 :            :     // Inform all listeners that this objects is disposing.
     700                 :            :     ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> >::const_iterator
     701         [ #  # ]:          0 :           aListenerIterator (aListenerListCopy.begin());
     702 [ #  # ][ #  # ]:          0 :     lang::EventObject aEvent (static_cast<accessibility::XAccessible*>(this));
                 [ #  # ]
     703 [ #  # ][ #  # ]:          0 :     while (aListenerIterator != aListenerListCopy.end())
     704                 :            :     {
     705                 :            :         try
     706                 :            :         {
     707 [ #  # ][ #  # ]:          0 :             (*aListenerIterator)->disposing (aEvent);
     708                 :            :         }
     709         [ #  # ]:          0 :         catch(const uno::Exception&)
     710                 :            :         {
     711                 :            :             // Ignore exceptions.
     712                 :            :         }
     713                 :            : 
     714                 :          0 :         ++aListenerIterator;
     715         [ #  # ]:          0 :     }
     716                 :          0 : }
     717                 :            : 
     718                 :            : 
     719                 :          0 : sal_uInt16 ValueSetAcc::getItemCount (void) const
     720                 :            : {
     721                 :          0 :     sal_uInt16 nCount = mpParent->ImplGetVisibleItemCount();
     722                 :            :     // When the None-Item is visible then increase the number of items by
     723                 :            :     // one.
     724         [ #  # ]:          0 :     if (HasNoneField())
     725                 :          0 :         nCount += 1;
     726                 :          0 :     return nCount;
     727                 :            : }
     728                 :            : 
     729                 :            : 
     730                 :          0 : ValueSetItem* ValueSetAcc::getItem (sal_uInt16 nIndex) const
     731                 :            : {
     732                 :          0 :     ValueSetItem* pItem = NULL;
     733                 :            : 
     734         [ #  # ]:          0 :     if (HasNoneField())
     735                 :            :     {
     736         [ #  # ]:          0 :         if (nIndex == 0)
     737                 :            :             // When present the first item is the then allways visible none field.
     738                 :          0 :             pItem = mpParent->ImplGetItem (VALUESET_ITEM_NONEITEM);
     739                 :            :         else
     740                 :            :             // Shift down the index to compensate for the none field.
     741                 :          0 :             nIndex -= 1;
     742                 :            :     }
     743         [ #  # ]:          0 :     if (pItem == NULL)
     744                 :          0 :         pItem = mpParent->ImplGetVisibleItem (static_cast<sal_uInt16>(nIndex));
     745                 :            : 
     746                 :          0 :     return pItem;
     747                 :            : }
     748                 :            : 
     749                 :            : 
     750                 :            : 
     751                 :            : 
     752                 :          0 : void ValueSetAcc::ThrowIfDisposed (void)
     753                 :            :     throw (::com::sun::star::lang::DisposedException)
     754                 :            : {
     755 [ #  # ][ #  # ]:          0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
     756                 :            :     {
     757                 :            :         OSL_TRACE ("Calling disposed object. Throwing exception:");
     758                 :            :         throw lang::DisposedException (
     759                 :            :             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")),
     760 [ #  # ][ #  # ]:          0 :             static_cast<uno::XWeak*>(this));
                 [ #  # ]
     761                 :            :     }
     762                 :            :     else
     763                 :            :     {
     764                 :            :         DBG_ASSERT (mpParent!=NULL, "ValueSetAcc not disposed but mpParent == NULL");
     765                 :            :     }
     766                 :          0 : }
     767                 :            : 
     768                 :            : 
     769                 :            : 
     770                 :          0 : bool ValueSetAcc::HasNoneField (void) const
     771                 :            : {
     772                 :            :     DBG_ASSERT (mpParent!=NULL, "ValueSetAcc::HasNoneField called with mpParent==NULL");
     773                 :          0 :     return ((mpParent->GetStyle() & WB_NONEFIELD) != 0);
     774                 :            : }
     775                 :            : 
     776                 :            : 
     777                 :            : 
     778                 :            : 
     779                 :            : // ----------------
     780                 :            : // - ValueItemAcc -
     781                 :            : // ----------------
     782                 :            : 
     783                 :          0 : ValueItemAcc::ValueItemAcc( ValueSetItem* pParent, bool bIsTransientChildrenDisabled ) :
     784                 :            :     mpParent( pParent ),
     785 [ #  # ][ #  # ]:          0 :     mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled )
     786                 :            : {
     787                 :          0 : }
     788                 :            : 
     789                 :            : // -----------------------------------------------------------------------------
     790                 :            : 
     791         [ #  # ]:          0 : ValueItemAcc::~ValueItemAcc()
     792                 :            : {
     793         [ #  # ]:          0 : }
     794                 :            : 
     795                 :            : // -----------------------------------------------------------------------
     796                 :            : 
     797                 :          0 : void ValueItemAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue )
     798                 :            : {
     799         [ #  # ]:          0 :     if( nEventId )
     800                 :            :     {
     801         [ #  # ]:          0 :         ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >                  aTmpListeners( mxEventListeners );
     802         [ #  # ]:          0 :         ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator  aIter( aTmpListeners.begin() );
     803         [ #  # ]:          0 :         accessibility::AccessibleEventObject                                                        aEvtObject;
     804                 :            : 
     805                 :          0 :         aEvtObject.EventId = nEventId;
     806         [ #  # ]:          0 :         aEvtObject.Source = static_cast<uno::XWeak*>(this);
     807                 :          0 :         aEvtObject.NewValue = rNewValue;
     808                 :          0 :         aEvtObject.OldValue = rOldValue;
     809                 :            : 
     810 [ #  # ][ #  # ]:          0 :         while( aIter != aTmpListeners.end() )
     811                 :            :         {
     812 [ #  # ][ #  # ]:          0 :             (*aIter)->notifyEvent( aEvtObject );
     813         [ #  # ]:          0 :             aIter++;
     814         [ #  # ]:          0 :         }
     815                 :            :     }
     816                 :          0 : }
     817                 :            : 
     818                 :            : // -----------------------------------------------------------------------------
     819                 :            : 
     820                 :          0 : void ValueItemAcc::ParentDestroyed()
     821                 :            : {
     822         [ #  # ]:          0 :     const ::osl::MutexGuard aGuard( maMutex );
     823         [ #  # ]:          0 :     mpParent = NULL;
     824                 :          0 : }
     825                 :            : 
     826                 :            : namespace
     827                 :            : {
     828                 :            :     class theValueItemAccUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theValueItemAccUnoTunnelId > {};
     829                 :            : }
     830                 :            : 
     831                 :          0 : const uno::Sequence< sal_Int8 >& ValueItemAcc::getUnoTunnelId()
     832                 :            : {
     833                 :          0 :     return theValueItemAccUnoTunnelId::get().getSeq();
     834                 :            : }
     835                 :            : 
     836                 :            : // -----------------------------------------------------------------------------
     837                 :            : 
     838                 :          0 : ValueItemAcc* ValueItemAcc::getImplementation( const uno::Reference< uno::XInterface >& rxData )
     839                 :            :     throw()
     840                 :            : {
     841                 :            :     try
     842                 :            :     {
     843         [ #  # ]:          0 :         uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
     844 [ #  # ][ #  # ]:          0 :         return( xUnoTunnel.is() ? reinterpret_cast<ValueItemAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ValueItemAcc::getUnoTunnelId() ))) : NULL );
         [ #  # ][ #  # ]
                 [ #  # ]
     845                 :            :     }
     846                 :          0 :     catch(const ::com::sun::star::uno::Exception&)
     847                 :            :     {
     848                 :          0 :         return NULL;
     849                 :            :     }
     850                 :            : }
     851                 :            : 
     852                 :            : // -----------------------------------------------------------------------------
     853                 :            : 
     854                 :          0 : uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueItemAcc::getAccessibleContext()
     855                 :            :     throw (uno::RuntimeException)
     856                 :            : {
     857                 :          0 :     return this;
     858                 :            : }
     859                 :            : 
     860                 :            : // -----------------------------------------------------------------------------
     861                 :            : 
     862                 :          0 : sal_Int32 SAL_CALL ValueItemAcc::getAccessibleChildCount()
     863                 :            :     throw (uno::RuntimeException)
     864                 :            : {
     865                 :          0 :     return 0;
     866                 :            : }
     867                 :            : 
     868                 :            : // -----------------------------------------------------------------------------
     869                 :            : 
     870                 :          0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleChild( sal_Int32 )
     871                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     872                 :            : {
     873         [ #  # ]:          0 :     throw lang::IndexOutOfBoundsException();
     874                 :            : }
     875                 :            : 
     876                 :            : // -----------------------------------------------------------------------------
     877                 :            : 
     878                 :          0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleParent()
     879                 :            :     throw (uno::RuntimeException)
     880                 :            : {
     881         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     882                 :          0 :     uno::Reference< accessibility::XAccessible >    xRet;
     883                 :            : 
     884         [ #  # ]:          0 :     if( mpParent )
     885 [ #  # ][ #  # ]:          0 :         xRet = mpParent->mrParent.GetAccessible();
     886                 :            : 
     887         [ #  # ]:          0 :     return xRet;
     888                 :            : }
     889                 :            : 
     890                 :            : // -----------------------------------------------------------------------------
     891                 :            : 
     892                 :          0 : sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent()
     893                 :            :     throw (uno::RuntimeException)
     894                 :            : {
     895         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     896                 :            :     // The index defaults to -1 to indicate the child does not belong to its
     897                 :            :     // parent.
     898                 :          0 :     sal_Int32 nIndexInParent = -1;
     899                 :            : 
     900         [ #  # ]:          0 :     if( mpParent )
     901                 :            :     {
     902                 :          0 :         bool bDone = false;
     903                 :            : 
     904         [ #  # ]:          0 :         sal_uInt16 nCount = mpParent->mrParent.ImplGetVisibleItemCount();
     905                 :            :         ValueSetItem* pItem;
     906 [ #  # ][ #  # ]:          0 :         for (sal_uInt16 i=0; i<nCount && !bDone; i++)
                 [ #  # ]
     907                 :            :         {
     908                 :            :             // Guard the retrieval of the i-th child with a try/catch block
     909                 :            :             // just in case the number of children changes in the mean time.
     910                 :            :             try
     911                 :            :             {
     912         [ #  # ]:          0 :                 pItem = mpParent->mrParent.ImplGetVisibleItem (i);
     913                 :            :             }
     914         [ #  # ]:          0 :             catch (const lang::IndexOutOfBoundsException&)
     915                 :            :             {
     916                 :          0 :                 pItem = NULL;
     917                 :            :             }
     918                 :            : 
     919                 :            :             // Do not create an accessible object for the test.
     920 [ #  # ][ #  # ]:          0 :             if (pItem != NULL && pItem->mpxAcc != NULL)
     921 [ #  # ][ #  # ]:          0 :                 if (pItem->GetAccessible( mbIsTransientChildrenDisabled ).get() == this )
                 [ #  # ]
     922                 :            :                 {
     923                 :          0 :                     nIndexInParent = i;
     924                 :          0 :                     bDone = true;
     925                 :            :                 }
     926                 :            :         }
     927                 :            :     }
     928                 :            : 
     929 [ #  # ][ #  # ]:          0 :     return nIndexInParent;
     930                 :            : }
     931                 :            : 
     932                 :            : // -----------------------------------------------------------------------------
     933                 :            : 
     934                 :          0 : sal_Int16 SAL_CALL ValueItemAcc::getAccessibleRole()
     935                 :            :     throw (uno::RuntimeException)
     936                 :            : {
     937                 :          0 :     return accessibility::AccessibleRole::LIST_ITEM;
     938                 :            : }
     939                 :            : 
     940                 :            : // -----------------------------------------------------------------------------
     941                 :            : 
     942                 :          0 : ::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleDescription()
     943                 :            :     throw (uno::RuntimeException)
     944                 :            : {
     945                 :          0 :     return ::rtl::OUString();
     946                 :            : }
     947                 :            : 
     948                 :            : // -----------------------------------------------------------------------------
     949                 :            : 
     950                 :          0 : ::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleName()
     951                 :            :     throw (uno::RuntimeException)
     952                 :            : {
     953         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     954                 :          0 :     rtl::OUString aRet;
     955                 :            : 
     956         [ #  # ]:          0 :     if( mpParent )
     957                 :            :     {
     958         [ #  # ]:          0 :         aRet = mpParent->maText;
     959                 :            : 
     960         [ #  # ]:          0 :         if( aRet.isEmpty() )
     961                 :            :         {
     962                 :          0 :             rtl::OUStringBuffer aBuffer("Item ");
     963         [ #  # ]:          0 :             aBuffer.append(static_cast<sal_Int32>(mpParent->mnId));
     964         [ #  # ]:          0 :             aRet = aBuffer.makeStringAndClear();
     965                 :            :         }
     966                 :            :     }
     967                 :            : 
     968         [ #  # ]:          0 :     return aRet;
     969                 :            : }
     970                 :            : 
     971                 :            : // -----------------------------------------------------------------------------
     972                 :            : 
     973                 :          0 : uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueItemAcc::getAccessibleRelationSet()
     974                 :            :     throw (uno::RuntimeException)
     975                 :            : {
     976                 :          0 :     return uno::Reference< accessibility::XAccessibleRelationSet >();
     977                 :            : }
     978                 :            : 
     979                 :            : // -----------------------------------------------------------------------------
     980                 :            : 
     981                 :          0 : uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueItemAcc::getAccessibleStateSet()
     982                 :            :     throw (uno::RuntimeException)
     983                 :            : {
     984         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     985         [ #  # ]:          0 :     ::utl::AccessibleStateSetHelper*    pStateSet = new ::utl::AccessibleStateSetHelper;
     986                 :            : 
     987         [ #  # ]:          0 :     if( mpParent )
     988                 :            :     {
     989         [ #  # ]:          0 :         pStateSet->AddState (accessibility::AccessibleStateType::ENABLED);
     990         [ #  # ]:          0 :         pStateSet->AddState (accessibility::AccessibleStateType::SENSITIVE);
     991         [ #  # ]:          0 :         pStateSet->AddState (accessibility::AccessibleStateType::SHOWING);
     992         [ #  # ]:          0 :         pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE);
     993         [ #  # ]:          0 :         if ( !mbIsTransientChildrenDisabled )
     994         [ #  # ]:          0 :             pStateSet->AddState (accessibility::AccessibleStateType::TRANSIENT);
     995                 :            : 
     996                 :            :         // SELECTABLE
     997         [ #  # ]:          0 :         pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE );
     998                 :            :         //      pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE );
     999                 :            : 
    1000                 :            :         // SELECTED
    1001         [ #  # ]:          0 :         if( mpParent->mrParent.GetSelectItemId() == mpParent->mnId )
    1002                 :            :         {
    1003         [ #  # ]:          0 :             pStateSet->AddState( accessibility::AccessibleStateType::SELECTED );
    1004                 :            :             //              pStateSet->AddState( accessibility::AccessibleStateType::FOCUSED );
    1005                 :            :         }
    1006                 :            :     }
    1007                 :            : 
    1008 [ #  # ][ #  # ]:          0 :     return pStateSet;
                 [ #  # ]
    1009                 :            : }
    1010                 :            : 
    1011                 :            : // -----------------------------------------------------------------------------
    1012                 :            : 
    1013                 :          0 : lang::Locale SAL_CALL ValueItemAcc::getLocale()
    1014                 :            :     throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException)
    1015                 :            : {
    1016         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
    1017                 :          0 :     const ::rtl::OUString                           aEmptyStr;
    1018         [ #  # ]:          0 :     uno::Reference< accessibility::XAccessible >    xParent( getAccessibleParent() );
    1019                 :          0 :     lang::Locale                                    aRet( aEmptyStr, aEmptyStr, aEmptyStr );
    1020                 :            : 
    1021         [ #  # ]:          0 :     if( xParent.is() )
    1022                 :            :     {
    1023 [ #  # ][ #  # ]:          0 :         uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
    1024                 :            : 
    1025         [ #  # ]:          0 :         if( xParentContext.is() )
    1026 [ #  # ][ #  # ]:          0 :             aRet = xParentContext->getLocale();
    1027                 :            :     }
    1028                 :            : 
    1029         [ #  # ]:          0 :     return aRet;
    1030                 :            : }
    1031                 :            : 
    1032                 :            : // -----------------------------------------------------------------------------
    1033                 :            : 
    1034                 :          0 : void SAL_CALL ValueItemAcc::addEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
    1035                 :            :     throw (uno::RuntimeException)
    1036                 :            : {
    1037         [ #  # ]:          0 :     const ::osl::MutexGuard aGuard( maMutex );
    1038                 :            : 
    1039         [ #  # ]:          0 :     if( rxListener.is() )
    1040                 :            :     {
    1041         [ #  # ]:          0 :            ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin();
    1042                 :          0 :         sal_Bool bFound = sal_False;
    1043                 :            : 
    1044 [ #  # ][ #  # ]:          0 :         while( !bFound && ( aIter != mxEventListeners.end() ) )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1045                 :            :         {
    1046 [ #  # ][ #  # ]:          0 :             if( *aIter == rxListener )
    1047                 :          0 :                 bFound = sal_True;
    1048                 :            :             else
    1049                 :          0 :                 ++aIter;
    1050                 :            :         }
    1051                 :            : 
    1052         [ #  # ]:          0 :         if (!bFound)
    1053         [ #  # ]:          0 :             mxEventListeners.push_back( rxListener );
    1054         [ #  # ]:          0 :     }
    1055                 :          0 : }
    1056                 :            : 
    1057                 :            : // -----------------------------------------------------------------------------
    1058                 :            : 
    1059                 :          0 : void SAL_CALL ValueItemAcc::removeEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
    1060                 :            :     throw (uno::RuntimeException)
    1061                 :            : {
    1062         [ #  # ]:          0 :     const ::osl::MutexGuard aGuard( maMutex );
    1063                 :            : 
    1064         [ #  # ]:          0 :     if( rxListener.is() )
    1065                 :            :     {
    1066                 :          0 :            ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::iterator aIter = mxEventListeners.begin();
    1067                 :          0 :         sal_Bool bFound = sal_False;
    1068                 :            : 
    1069 [ #  # ][ #  # ]:          0 :         while( !bFound && ( aIter != mxEventListeners.end() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1070                 :            :         {
    1071 [ #  # ][ #  # ]:          0 :             if( *aIter == rxListener )
    1072                 :            :             {
    1073         [ #  # ]:          0 :                 mxEventListeners.erase( aIter );
    1074                 :          0 :                 bFound = sal_True;
    1075                 :            :             }
    1076                 :            :             else
    1077                 :          0 :                 ++aIter;
    1078                 :            :         }
    1079         [ #  # ]:          0 :     }
    1080                 :          0 : }
    1081                 :            : 
    1082                 :            : // -----------------------------------------------------------------------------
    1083                 :            : 
    1084                 :          0 : sal_Bool SAL_CALL ValueItemAcc::containsPoint( const awt::Point& aPoint )
    1085                 :            :     throw (uno::RuntimeException)
    1086                 :            : {
    1087         [ #  # ]:          0 :     const awt::Rectangle    aRect( getBounds() );
    1088                 :          0 :     const Point             aSize( aRect.Width, aRect.Height );
    1089                 :          0 :     const Point             aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
    1090                 :            : 
    1091 [ #  # ][ #  # ]:          0 :     return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
    1092                 :            : }
    1093                 :            : 
    1094                 :            : // -----------------------------------------------------------------------------
    1095                 :            : 
    1096                 :          0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleAtPoint( const awt::Point& )
    1097                 :            :     throw (uno::RuntimeException)
    1098                 :            : {
    1099                 :          0 :     uno::Reference< accessibility::XAccessible > xRet;
    1100                 :          0 :     return xRet;
    1101                 :            : }
    1102                 :            : 
    1103                 :            : // -----------------------------------------------------------------------------
    1104                 :            : 
    1105                 :          0 : awt::Rectangle SAL_CALL ValueItemAcc::getBounds()
    1106                 :            :     throw (uno::RuntimeException)
    1107                 :            : {
    1108         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
    1109                 :          0 :     awt::Rectangle      aRet;
    1110                 :            : 
    1111         [ #  # ]:          0 :     if( mpParent )
    1112                 :            :     {
    1113         [ #  # ]:          0 :         Rectangle   aRect( mpParent->mrParent.GetItemRect(mpParent->mnId) );
    1114                 :          0 :         Point       aOrigin;
    1115         [ #  # ]:          0 :         Rectangle   aParentRect( aOrigin, mpParent->mrParent.GetOutputSizePixel() );
    1116                 :            : 
    1117         [ #  # ]:          0 :         aRect.Intersection( aParentRect );
    1118                 :            : 
    1119                 :          0 :         aRet.X = aRect.Left();
    1120                 :          0 :         aRet.Y = aRect.Top();
    1121         [ #  # ]:          0 :         aRet.Width = aRect.GetWidth();
    1122         [ #  # ]:          0 :         aRet.Height = aRect.GetHeight();
    1123                 :            :     }
    1124                 :            : 
    1125         [ #  # ]:          0 :     return aRet;
    1126                 :            : }
    1127                 :            : 
    1128                 :            : // -----------------------------------------------------------------------------
    1129                 :            : 
    1130                 :          0 : awt::Point SAL_CALL ValueItemAcc::getLocation()
    1131                 :            :     throw (uno::RuntimeException)
    1132                 :            : {
    1133         [ #  # ]:          0 :     const awt::Rectangle    aRect( getBounds() );
    1134                 :          0 :     awt::Point              aRet;
    1135                 :            : 
    1136                 :          0 :     aRet.X = aRect.X;
    1137                 :          0 :     aRet.Y = aRect.Y;
    1138                 :            : 
    1139                 :          0 :     return aRet;
    1140                 :            : }
    1141                 :            : 
    1142                 :            : // -----------------------------------------------------------------------------
    1143                 :            : 
    1144                 :          0 : awt::Point SAL_CALL ValueItemAcc::getLocationOnScreen()
    1145                 :            :     throw (uno::RuntimeException)
    1146                 :            : {
    1147         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
    1148                 :          0 :     awt::Point          aRet;
    1149                 :            : 
    1150         [ #  # ]:          0 :     if( mpParent )
    1151                 :            :     {
    1152         [ #  # ]:          0 :         const Point aPos = mpParent->mrParent.GetItemRect(mpParent->mnId).TopLeft();
    1153         [ #  # ]:          0 :         const Point aScreenPos( mpParent->mrParent.OutputToAbsoluteScreenPixel( aPos ) );
    1154                 :            : 
    1155                 :          0 :         aRet.X = aScreenPos.X();
    1156                 :          0 :         aRet.Y = aScreenPos.Y();
    1157                 :            :     }
    1158                 :            : 
    1159         [ #  # ]:          0 :     return aRet;
    1160                 :            : }
    1161                 :            : 
    1162                 :            : // -----------------------------------------------------------------------------
    1163                 :            : 
    1164                 :          0 : awt::Size SAL_CALL ValueItemAcc::getSize()
    1165                 :            :     throw (uno::RuntimeException)
    1166                 :            : {
    1167         [ #  # ]:          0 :     const awt::Rectangle    aRect( getBounds() );
    1168                 :          0 :     awt::Size               aRet;
    1169                 :            : 
    1170                 :          0 :     aRet.Width = aRect.Width;
    1171                 :          0 :     aRet.Height = aRect.Height;
    1172                 :            : 
    1173                 :          0 :     return aRet;
    1174                 :            : }
    1175                 :            : 
    1176                 :            : // -----------------------------------------------------------------------------
    1177                 :            : 
    1178                 :          0 : void SAL_CALL ValueItemAcc::grabFocus()
    1179                 :            :     throw (uno::RuntimeException)
    1180                 :            : {
    1181                 :            :     // nothing to do
    1182                 :          0 : }
    1183                 :            : 
    1184                 :            : // -----------------------------------------------------------------------------
    1185                 :            : 
    1186                 :          0 : uno::Any SAL_CALL ValueItemAcc::getAccessibleKeyBinding()
    1187                 :            :     throw (uno::RuntimeException)
    1188                 :            : {
    1189                 :          0 :     return uno::Any();
    1190                 :            : }
    1191                 :            : 
    1192                 :            : // -----------------------------------------------------------------------------
    1193                 :            : 
    1194                 :          0 : sal_Int32 SAL_CALL ValueItemAcc::getForeground(  )
    1195                 :            :     throw (uno::RuntimeException)
    1196                 :            : {
    1197                 :          0 :     sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor().GetColor();
    1198                 :          0 :     return static_cast<sal_Int32>(nColor);
    1199                 :            : }
    1200                 :            : 
    1201                 :            : // -----------------------------------------------------------------------------
    1202                 :            : 
    1203                 :          0 : sal_Int32 SAL_CALL ValueItemAcc::getBackground(  )
    1204                 :            :     throw (uno::RuntimeException)
    1205                 :            : {
    1206                 :            :     sal_uInt32 nColor;
    1207 [ #  # ][ #  # ]:          0 :     if (mpParent && mpParent->meType == VALUESETITEM_COLOR)
    1208                 :          0 :         nColor = mpParent->maColor.GetColor();
    1209                 :            :     else
    1210                 :          0 :         nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
    1211                 :          0 :     return static_cast<sal_Int32>(nColor);
    1212                 :            : }
    1213                 :            : 
    1214                 :            : // -----------------------------------------------------------------------------
    1215                 :            : 
    1216                 :          0 : sal_Int64 SAL_CALL ValueItemAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw( uno::RuntimeException )
    1217                 :            : {
    1218                 :            :     sal_Int64 nRet;
    1219                 :            : 
    1220 [ #  # ][ #  # ]:          0 :     if( ( rId.getLength() == 16 ) && ( 0 == rtl_compareMemory( ValueItemAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
                 [ #  # ]
    1221                 :          0 :         nRet = reinterpret_cast< sal_Int64 >( this );
    1222                 :            :     else
    1223                 :          0 :         nRet = 0;
    1224                 :            : 
    1225                 :          0 :     return nRet;
    1226                 :            : }
    1227                 :            : 
    1228                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10