LCOV - code coverage report
Current view: top level - accessibility/source/standard - vclxaccessiblelist.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 128 411 31.1 %
Date: 2012-08-25 Functions: 20 42 47.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 104 700 14.9 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include <accessibility/standard/vclxaccessiblelist.hxx>
      21                 :            : #include <accessibility/standard/vclxaccessiblelistitem.hxx>
      22                 :            : #include <accessibility/helper/listboxhelper.hxx>
      23                 :            : 
      24                 :            : #include <unotools/accessiblestatesethelper.hxx>
      25                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      26                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      27                 :            : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      28                 :            : #include <vcl/svapp.hxx>
      29                 :            : #include <vcl/combobox.hxx>
      30                 :            : #include <vcl/lstbox.hxx>
      31                 :            : #include <toolkit/helper/convert.hxx>
      32                 :            : 
      33                 :            : using namespace ::com::sun::star;
      34                 :            : using namespace ::com::sun::star::uno;
      35                 :            : using namespace ::com::sun::star::lang;
      36                 :            : using namespace ::com::sun::star::beans;
      37                 :            : using namespace ::com::sun::star::accessibility;
      38                 :            : using namespace ::accessibility;
      39                 :            : 
      40                 :            : namespace
      41                 :            : {
      42                 :          0 :     void checkSelection_Impl( sal_Int32 _nIndex, const IComboListBoxHelper& _rListBox, sal_Bool bSelected )
      43                 :            :         throw (::com::sun::star::lang::IndexOutOfBoundsException)
      44                 :            :     {
      45                 :          0 :         sal_Int32 nCount = bSelected ? (sal_Int32)_rListBox.GetSelectEntryCount()
      46         [ #  # ]:          0 :                                      : (sal_Int32)_rListBox.GetEntryCount();
      47 [ #  # ][ #  # ]:          0 :         if ( _nIndex < 0 || _nIndex >= nCount )
      48         [ #  # ]:          0 :             throw ::com::sun::star::lang::IndexOutOfBoundsException();
      49                 :          0 :     }
      50                 :            : }
      51                 :            : 
      52                 :         16 : VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType,
      53                 :            :                                         const Reference< XAccessible >& _xParent)
      54                 :            :     : VCLXAccessibleComponent   (pVCLWindow),
      55                 :            :       m_aBoxType                (aBoxType),
      56                 :            :       m_nVisibleLineCount       (0),
      57                 :            :       m_nIndexInParent          (DEFAULT_INDEX_IN_PARENT),
      58                 :            :       m_nLastTopEntry           ( 0 ),
      59                 :            :       m_nLastSelectedPos        ( LISTBOX_ENTRY_NOTFOUND ),
      60                 :            :       m_bDisableProcessEvent    ( false ),
      61                 :            :       m_bVisible                ( true ),
      62 [ +  - ][ +  - ]:         16 :       m_xParent                 ( _xParent )
      63                 :            : {
      64                 :            :     // Because combo boxes and list boxes don't have a common interface for
      65                 :            :     // methods with identical signature we have to write down twice the
      66                 :            :     // same code.
      67      [ +  +  - ]:         16 :     switch (m_aBoxType)
      68                 :            :     {
      69                 :            :         case COMBOBOX:
      70                 :            :         {
      71         [ +  - ]:         10 :             ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
      72         [ +  - ]:         10 :             if ( pBox != NULL )
      73 [ +  - ][ +  - ]:         10 :                 m_pListBoxHelper = new VCLListBoxHelper<ComboBox> (*pBox);
      74                 :         10 :             break;
      75                 :            :         }
      76                 :            : 
      77                 :            :         case LISTBOX:
      78                 :            :         {
      79         [ +  - ]:          6 :             ListBox* pBox = static_cast<ListBox*>(GetWindow());
      80         [ +  - ]:          6 :             if ( pBox != NULL )
      81 [ +  - ][ +  - ]:          6 :                 m_pListBoxHelper = new VCLListBoxHelper<ListBox> (*pBox);
      82                 :          6 :             break;
      83                 :            :         }
      84                 :            :     }
      85         [ +  - ]:         16 :     UpdateVisibleLineCount();
      86                 :            : 
      87         [ +  - ]:         16 :     sal_uInt16 nCount = static_cast<sal_uInt16>(getAccessibleChildCount());
      88         [ +  - ]:         16 :     m_aAccessibleChildren.reserve(nCount);
      89                 :         16 : }
      90                 :            : // -----------------------------------------------------------------------------
      91                 :            : 
      92         [ #  # ]:          0 : VCLXAccessibleList::~VCLXAccessibleList (void)
      93                 :            : {
      94 [ #  # ][ #  # ]:          0 :     delete m_pListBoxHelper;
      95         [ #  # ]:          0 : }
      96                 :            : // -----------------------------------------------------------------------------
      97                 :            : 
      98                 :         16 : void VCLXAccessibleList::SetIndexInParent (sal_Int32 nIndex)
      99                 :            : {
     100                 :         16 :     m_nIndexInParent = nIndex;
     101                 :         16 : }
     102                 :            : // -----------------------------------------------------------------------------
     103                 :            : 
     104                 :         16 : void SAL_CALL VCLXAccessibleList::disposing (void)
     105                 :            : {
     106                 :         16 :     VCLXAccessibleComponent::disposing();
     107                 :            : 
     108                 :            :     // Dispose all items in the list.
     109                 :         16 :     clearItems();
     110                 :            : 
     111         [ +  - ]:         16 :     delete m_pListBoxHelper;
     112                 :         16 :     m_pListBoxHelper = NULL;
     113                 :         16 : }
     114                 :            : // -----------------------------------------------------------------------------
     115                 :            : 
     116                 :         16 : void VCLXAccessibleList::clearItems()
     117                 :            : {
     118                 :            :     // Clear the list itself and delete all the rest.
     119                 :         16 :     ListItems().swap(m_aAccessibleChildren); // clear and minimize
     120                 :         16 : }
     121                 :            : // -----------------------------------------------------------------------------
     122                 :            : 
     123                 :         22 : void VCLXAccessibleList::FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet)
     124                 :            : {
     125         [ +  - ]:         22 :     SolarMutexGuard aSolarGuard;
     126                 :            : 
     127         [ +  - ]:         22 :     VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
     128                 :            :     // check if our list should be visible
     129 [ +  - ][ +  - ]:         66 :     if (    m_pListBoxHelper
         [ +  - ][ +  - ]
     130         [ +  - ]:         22 :         && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN
     131         [ +  - ]:         22 :         && !m_pListBoxHelper->IsInDropDown() )
     132                 :            :     {
     133         [ +  - ]:         22 :         rStateSet.RemoveState (AccessibleStateType::VISIBLE);
     134         [ +  - ]:         22 :         rStateSet.RemoveState (AccessibleStateType::SHOWING);
     135                 :         22 :         m_bVisible = false;
     136                 :            :     }
     137                 :            : 
     138                 :            :     // Both the combo box and list box are handled identical in the
     139                 :            :     // following but for some reason they don't have a common interface for
     140                 :            :     // the methods used.
     141         [ +  - ]:         22 :     if ( m_pListBoxHelper )
     142                 :            :     {
     143 [ +  - ][ -  + ]:         22 :         if ( m_pListBoxHelper->IsMultiSelectionEnabled() )
     144         [ #  # ]:          0 :             rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE);
     145         [ +  - ]:         22 :         rStateSet.AddState (AccessibleStateType::FOCUSABLE);
     146                 :            :         // All children are transient.
     147         [ +  - ]:         22 :         rStateSet.AddState (AccessibleStateType::MANAGES_DESCENDANTS);
     148         [ +  - ]:         22 :     }
     149                 :         22 : }
     150                 :            : // -----------------------------------------------------------------------------
     151                 :         12 : void VCLXAccessibleList::notifyVisibleStates(sal_Bool _bSetNew )
     152                 :            : {
     153                 :         12 :     m_bVisible = _bSetNew ? true : false;
     154                 :         12 :     Any aOldValue, aNewValue;
     155 [ +  - ][ +  + ]:         12 :     (_bSetNew ? aNewValue : aOldValue ) <<= AccessibleStateType::VISIBLE;
     156         [ +  - ]:         12 :     NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
     157 [ +  + ][ +  - ]:         12 :     (_bSetNew ? aNewValue : aOldValue ) <<= AccessibleStateType::SHOWING;
     158         [ +  - ]:         12 :     NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
     159                 :            : 
     160                 :         12 :     ListItems::iterator aIter = m_aAccessibleChildren.begin();
     161                 :         12 :     ListItems::iterator aEnd = m_aAccessibleChildren.end();
     162         [ +  - ]:         12 :     UpdateVisibleLineCount();
     163                 :            :     // adjust the index inside the VCLXAccessibleListItem
     164 [ +  - ][ -  + ]:         12 :     for (;aIter != aEnd ; ++aIter)
     165                 :            :     {
     166         [ #  # ]:          0 :         Reference< XAccessible > xHold = *aIter;
     167 [ #  # ][ #  # ]:          0 :         VCLXAccessibleListItem* pItem = static_cast<VCLXAccessibleListItem*>(xHold.get());
     168         [ #  # ]:          0 :         if ( pItem )
     169                 :            :         {
     170                 :          0 :             sal_uInt16 nTopEntry = 0;
     171         [ #  # ]:          0 :             if ( m_pListBoxHelper )
     172         [ #  # ]:          0 :                 nTopEntry = m_pListBoxHelper->GetTopEntry();
     173         [ #  # ]:          0 :             sal_uInt16 nPos = (sal_uInt16)(aIter - m_aAccessibleChildren.begin());
     174 [ #  # ][ #  # ]:          0 :             sal_Bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) );
     175 [ #  # ][ #  # ]:          0 :             pItem->SetVisible( m_bVisible && bVisible );
                 [ #  # ]
     176                 :            :         }
     177                 :            : 
     178                 :         12 :     }
     179                 :         12 : }
     180                 :            : // -----------------------------------------------------------------------------
     181                 :         62 : void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
     182                 :            : {
     183                 :            :     // Create a reference to this object to prevent an early release of the
     184                 :            :     // listbox (VCLEVENT_OBJECT_DYING).
     185         [ +  - ]:         62 :     Reference< XAccessible > xTemp = this;
     186                 :            : 
     187   [ +  +  -  -  :         62 :     switch ( rVclWindowEvent.GetId() )
             +  -  -  -  
                      + ]
     188                 :            :     {
     189                 :            :         case VCLEVENT_DROPDOWN_OPEN:
     190         [ +  - ]:          8 :             notifyVisibleStates(sal_True);
     191                 :          8 :             break;
     192                 :            :         case VCLEVENT_DROPDOWN_CLOSE:
     193         [ +  - ]:          4 :             notifyVisibleStates(sal_False);
     194                 :          4 :             break;
     195                 :            :         case VCLEVENT_LISTBOX_SCROLLED:
     196                 :            :         case VCLEVENT_COMBOBOX_SCROLLED:
     197         [ #  # ]:          0 :             UpdateEntryRange_Impl();
     198                 :          0 :             break;
     199                 :            : 
     200                 :            :         case VCLEVENT_LISTBOX_SELECT:
     201         [ #  # ]:          0 :             if ( !m_bDisableProcessEvent )
     202         [ #  # ]:          0 :                 UpdateSelection_Impl();
     203                 :          0 :             break;
     204                 :            :         // The selection events VCLEVENT_COMBOBOX_SELECT and
     205                 :            :         // VCLEVENT_COMBOBOX_DESELECT are not handled here because here we
     206                 :            :         // have no access to the edit field.  Its text is necessary to
     207                 :            :         // identify the currently selected item.
     208                 :            : 
     209                 :            :         case VCLEVENT_OBJECT_DYING:
     210                 :            :         {
     211         [ +  - ]:         16 :             dispose();
     212                 :            : 
     213         [ +  - ]:         16 :             VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
     214                 :         16 :             break;
     215                 :            :         }
     216                 :            : 
     217                 :            :         case VCLEVENT_LISTBOX_ITEMREMOVED:
     218                 :            :         case VCLEVENT_COMBOBOX_ITEMREMOVED:
     219                 :            :             HandleChangedItemList (false, reinterpret_cast<sal_IntPtr>(
     220         [ #  # ]:          0 :                 rVclWindowEvent.GetData()));
     221                 :          0 :             break;
     222                 :            : 
     223                 :            :         case VCLEVENT_LISTBOX_ITEMADDED:
     224                 :            :         case VCLEVENT_COMBOBOX_ITEMADDED:
     225                 :            :             HandleChangedItemList (true, reinterpret_cast<sal_IntPtr>(
     226         [ #  # ]:          0 :                 rVclWindowEvent.GetData()));
     227                 :          0 :             break;
     228                 :            :         case VCLEVENT_CONTROL_GETFOCUS:
     229         [ #  # ]:          0 :             VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
     230         [ #  # ]:          0 :             if ( m_pListBoxHelper )
     231                 :            :             {
     232                 :          0 :                 uno::Any    aOldValue,
     233                 :          0 :                             aNewValue;
     234         [ #  # ]:          0 :                 sal_uInt16 nPos = m_pListBoxHelper->GetSelectEntryPos();
     235         [ #  # ]:          0 :                 if ( nPos == LISTBOX_ENTRY_NOTFOUND )
     236         [ #  # ]:          0 :                     nPos = m_pListBoxHelper->GetTopEntry();
     237         [ #  # ]:          0 :                 if ( nPos != LISTBOX_ENTRY_NOTFOUND )
     238 [ #  # ][ #  # ]:          0 :                     aNewValue <<= CreateChild(nPos);
     239                 :            : 
     240                 :            :                 NotifyAccessibleEvent(  AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
     241                 :            :                                         aOldValue,
     242         [ #  # ]:          0 :                                         aNewValue );
     243                 :            :             }
     244                 :          0 :             break;
     245                 :            : 
     246                 :            :         default:
     247         [ +  - ]:         34 :             VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
     248                 :         62 :     }
     249                 :         62 : }
     250                 :            : // -----------------------------------------------------------------------------
     251                 :            : 
     252                 :            : /** To find out which item is currently selected and to update the SELECTED
     253                 :            :     state of the associated accessibility objects accordingly we exploit the
     254                 :            :     fact that the
     255                 :            : */
     256                 :          0 : void VCLXAccessibleList::UpdateSelection (::rtl::OUString sTextOfSelectedItem)
     257                 :            : {
     258         [ #  # ]:          0 :     if ( m_aBoxType == COMBOBOX )
     259                 :            :     {
     260                 :          0 :         ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
     261         [ #  # ]:          0 :         if ( pBox != NULL )
     262                 :            :         {
     263                 :            :             // Find the index of the selected item inside the VCL control...
     264         [ #  # ]:          0 :             sal_uInt16 nIndex = pBox->GetEntryPos(sTextOfSelectedItem);
     265                 :            :             // ...and then find the associated accessibility object.
     266         [ #  # ]:          0 :             if ( nIndex == LISTBOX_ENTRY_NOTFOUND )
     267                 :          0 :                 nIndex = 0;
     268                 :          0 :             UpdateSelection_Impl(nIndex);
     269                 :            :         }
     270                 :            :     }
     271                 :          0 : }
     272                 :            : // -----------------------------------------------------------------------------
     273                 :            : 
     274                 :          0 : void VCLXAccessibleList::adjustEntriesIndexInParent(ListItems::iterator& _aBegin,::std::mem_fun_t<bool,VCLXAccessibleListItem>& _rMemFun)
     275                 :            : {
     276                 :          0 :     ListItems::iterator aIter = _aBegin;
     277                 :          0 :     ListItems::iterator aEnd = m_aAccessibleChildren.end();
     278                 :            :     // adjust the index inside the VCLXAccessibleListItem
     279 [ #  # ][ #  # ]:          0 :     for (;aIter != aEnd ; ++aIter)
     280                 :            :     {
     281         [ #  # ]:          0 :         Reference< XAccessible > xHold = *aIter;
     282 [ #  # ][ #  # ]:          0 :         VCLXAccessibleListItem* pItem = static_cast<VCLXAccessibleListItem*>(xHold.get());
     283         [ #  # ]:          0 :         if ( pItem )
     284         [ #  # ]:          0 :             _rMemFun(pItem);
     285                 :          0 :     }
     286                 :          0 : }
     287                 :            : // -----------------------------------------------------------------------------
     288                 :            : 
     289                 :        214 : Reference<XAccessible> VCLXAccessibleList::CreateChild (sal_Int32 i)
     290                 :            : {
     291                 :        214 :     Reference<XAccessible> xChild;
     292                 :            : 
     293                 :        214 :     sal_uInt16 nPos = static_cast<sal_uInt16>(i);
     294         [ +  - ]:        214 :     if ( nPos >= m_aAccessibleChildren.size() )
     295                 :            :     {
     296         [ +  - ]:        214 :         m_aAccessibleChildren.resize(nPos + 1);
     297                 :            : 
     298                 :            :         // insert into the container
     299 [ +  - ][ +  - ]:        214 :         xChild = new VCLXAccessibleListItem(m_pListBoxHelper, i, this);
         [ +  - ][ +  - ]
     300         [ +  - ]:        214 :         m_aAccessibleChildren[nPos] = xChild;
     301                 :            :     }
     302                 :            :     else
     303                 :            :     {
     304 [ #  # ][ #  # ]:          0 :         xChild = m_aAccessibleChildren[nPos];
     305                 :            :         // check if position is empty and can be used else we have to adjust all entries behind this
     306         [ #  # ]:          0 :         if ( xChild.is() )
     307                 :            :         {
     308         [ #  # ]:          0 :             ListItems::iterator aIter = m_aAccessibleChildren.begin() + nPos;
     309                 :          0 :             ::std::mem_fun_t<bool, VCLXAccessibleListItem> aTemp(&VCLXAccessibleListItem::IncrementIndexInParent);
     310         [ #  # ]:          0 :             adjustEntriesIndexInParent( aIter, aTemp);
     311                 :            :         }
     312                 :            :         else
     313                 :            :         {
     314 [ #  # ][ #  # ]:          0 :             xChild = new VCLXAccessibleListItem(m_pListBoxHelper, i, this);
         [ #  # ][ #  # ]
     315         [ #  # ]:          0 :             m_aAccessibleChildren[nPos] = xChild;
     316                 :            :         }
     317                 :            :     }
     318                 :            : 
     319         [ +  - ]:        214 :     if ( xChild.is() )
     320                 :            :     {
     321                 :            :         // Just add the SELECTED state.
     322                 :        214 :         sal_Bool bNowSelected = sal_False;
     323         [ +  - ]:        214 :         if ( m_pListBoxHelper )
     324         [ +  - ]:        214 :             bNowSelected = m_pListBoxHelper->IsEntryPosSelected ((sal_uInt16)i);
     325 [ +  - ][ +  - ]:        214 :         VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >(xChild.get());
     326         [ +  - ]:        214 :         pItem->SetSelected( bNowSelected );
     327                 :            : 
     328                 :            :         // Set the child's VISIBLE state.
     329         [ +  - ]:        214 :         UpdateVisibleLineCount();
     330                 :        214 :         sal_uInt16 nTopEntry = 0;
     331         [ +  - ]:        214 :         if ( m_pListBoxHelper )
     332         [ +  - ]:        214 :             nTopEntry = m_pListBoxHelper->GetTopEntry();
     333 [ +  + ][ +  + ]:        214 :         sal_Bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) );
     334 [ -  + ][ #  # ]:        214 :         pItem->SetVisible( m_bVisible && bVisible );
                 [ +  - ]
     335                 :            :     }
     336                 :            : 
     337                 :        214 :     return xChild;
     338                 :            : }
     339                 :            : // -----------------------------------------------------------------------------
     340                 :            : 
     341                 :          0 : void VCLXAccessibleList::HandleChangedItemList (bool bItemInserted, sal_Int32 nIndex)
     342                 :            : {
     343         [ #  # ]:          0 :     if ( !bItemInserted )
     344                 :            :     {
     345         [ #  # ]:          0 :         if ( nIndex == -1 ) // special handling here
     346                 :            :         {
     347                 :          0 :             clearItems();
     348                 :            :         }
     349                 :            :         else
     350                 :            :         {
     351 [ #  # ][ #  # ]:          0 :             if ( nIndex >= 0 && static_cast<sal_uInt16>(nIndex) < m_aAccessibleChildren.size() )
                 [ #  # ]
     352                 :            :             {
     353 [ #  # ][ #  # ]:          0 :                 ListItems::iterator aIter = m_aAccessibleChildren.erase(m_aAccessibleChildren.begin()+nIndex);
     354                 :          0 :             ::std::mem_fun_t<bool, VCLXAccessibleListItem> aTemp(&VCLXAccessibleListItem::DecrementIndexInParent);
     355         [ #  # ]:          0 :                 adjustEntriesIndexInParent( aIter, aTemp );
     356                 :            :             }
     357                 :            :         }
     358                 :            :     }
     359                 :            :     else
     360                 :          0 :         getAccessibleChild(nIndex);
     361                 :            : 
     362                 :            :     NotifyAccessibleEvent (
     363                 :            :         AccessibleEventId::INVALIDATE_ALL_CHILDREN,
     364         [ #  # ]:          0 :         Any(), Any());
     365                 :          0 : }
     366                 :            : // -----------------------------------------------------------------------------
     367                 :            : 
     368 [ +  + ][ +  - ]:       3192 : IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleList, VCLXAccessibleComponent, VCLXAccessibleList_BASE)
     369 [ #  # ][ #  # ]:          0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleList, VCLXAccessibleComponent, VCLXAccessibleList_BASE)
                 [ #  # ]
     370                 :            : 
     371                 :            : //=====  XAccessible  =========================================================
     372                 :            : 
     373                 :            : Reference<XAccessibleContext> SAL_CALL
     374                 :        236 :     VCLXAccessibleList::getAccessibleContext (void)
     375                 :            :     throw (RuntimeException)
     376                 :            : {
     377                 :        236 :     return this;
     378                 :            : }
     379                 :            : // -----------------------------------------------------------------------------
     380                 :            : 
     381                 :            : //=====  XAccessibleContext  ==================================================
     382                 :            : 
     383                 :        246 : sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleChildCount (void)
     384                 :            :     throw (RuntimeException)
     385                 :            : {
     386         [ +  - ]:        246 :     SolarMutexGuard aSolarGuard;
     387         [ +  - ]:        246 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     388                 :            : 
     389                 :        246 :     sal_Int32 nCount = 0;
     390         [ +  - ]:        246 :     if ( m_pListBoxHelper )
     391         [ +  - ]:        246 :         nCount = m_pListBoxHelper->GetEntryCount();
     392                 :            : 
     393 [ +  - ][ +  - ]:        246 :     return nCount;
     394                 :            : }
     395                 :            : // -----------------------------------------------------------------------------
     396                 :            : 
     397                 :        214 : Reference<XAccessible> SAL_CALL VCLXAccessibleList::getAccessibleChild (sal_Int32 i)
     398                 :            :     throw (IndexOutOfBoundsException, RuntimeException)
     399                 :            : {
     400         [ +  - ]:        214 :     SolarMutexGuard aSolarGuard;
     401         [ +  - ]:        214 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     402                 :            : 
     403 [ +  - ][ +  - ]:        214 :     if ( i < 0 || i >= getAccessibleChildCount() )
         [ -  + ][ -  + ]
     404         [ #  # ]:          0 :         throw IndexOutOfBoundsException();
     405                 :            : 
     406                 :        214 :     Reference< XAccessible > xChild;
     407                 :            :     // search for the child
     408         [ +  - ]:        214 :     if ( static_cast<sal_uInt16>(i) >= m_aAccessibleChildren.size() )
     409 [ +  - ][ +  - ]:        214 :         xChild = CreateChild (i);
     410                 :            :     else
     411                 :            :     {
     412 [ #  # ][ #  # ]:          0 :         xChild = m_aAccessibleChildren[i];
     413         [ #  # ]:          0 :         if ( !xChild.is() )
     414 [ #  # ][ #  # ]:          0 :             xChild = CreateChild (i);
     415                 :            :     }
     416                 :            :     OSL_ENSURE( xChild.is(), "VCLXAccessibleList::getAccessibleChild: returning empty child!" );
     417 [ +  - ][ +  - ]:        214 :     return xChild;
     418                 :            : }
     419                 :            : // -----------------------------------------------------------------------------
     420                 :            : 
     421                 :          2 : Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleParent(  )
     422                 :            :     throw (RuntimeException)
     423                 :            : {
     424         [ +  - ]:          2 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     425                 :            : 
     426         [ +  - ]:          2 :     return m_xParent;
     427                 :            : }
     428                 :            : // -----------------------------------------------------------------------------
     429                 :            : 
     430                 :          4 : sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleIndexInParent (void)
     431                 :            :     throw (::com::sun::star::uno::RuntimeException)
     432                 :            : {
     433         [ +  - ]:          4 :     if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT)
     434                 :          4 :         return m_nIndexInParent;
     435                 :            :     else
     436                 :          4 :         return VCLXAccessibleComponent::getAccessibleIndexInParent();
     437                 :            : }
     438                 :            : // -----------------------------------------------------------------------------
     439                 :            : 
     440                 :         40 : sal_Int16 SAL_CALL VCLXAccessibleList::getAccessibleRole (void)
     441                 :            :     throw (RuntimeException)
     442                 :            : {
     443                 :         40 :     return AccessibleRole::LIST;
     444                 :            : }
     445                 :            : // -----------------------------------------------------------------------------
     446                 :            : 
     447                 :            : //=====  XAccessibleComponent  ================================================
     448                 :            : 
     449                 :          0 : sal_Bool SAL_CALL VCLXAccessibleList::contains( const awt::Point& rPoint ) throw (RuntimeException)
     450                 :            : {
     451         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     452         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     453                 :            : 
     454                 :          0 :     sal_Bool bInside = sal_False;
     455                 :            : 
     456         [ #  # ]:          0 :     Window* pListBox = GetWindow();
     457         [ #  # ]:          0 :     if ( pListBox )
     458                 :            :     {
     459 [ #  # ][ #  # ]:          0 :         Rectangle aRect( Point(0,0), pListBox->GetSizePixel() );
     460         [ #  # ]:          0 :         bInside = aRect.IsInside( VCLPoint( rPoint ) );
     461                 :            :     }
     462                 :            : 
     463 [ #  # ][ #  # ]:          0 :     return bInside;
     464                 :            : }
     465                 :            : // -----------------------------------------------------------------------------
     466                 :            : 
     467                 :          0 : Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleAt( const awt::Point& rPoint )
     468                 :            :     throw (RuntimeException)
     469                 :            : {
     470         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     471         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     472                 :            : 
     473                 :          0 :     Reference< XAccessible > xChild;
     474         [ #  # ]:          0 :     if ( m_pListBoxHelper )
     475                 :            :     {
     476         [ #  # ]:          0 :         UpdateVisibleLineCount();
     477 [ #  # ][ #  # ]:          0 :         if ( contains( rPoint ) && m_nVisibleLineCount > 0 )
         [ #  # ][ #  # ]
     478                 :            :         {
     479                 :          0 :             Point aPos = VCLPoint( rPoint );
     480         [ #  # ]:          0 :             sal_uInt16 nEndPos = m_pListBoxHelper->GetTopEntry() + (sal_uInt16)m_nVisibleLineCount;
     481 [ #  # ][ #  # ]:          0 :             for ( sal_uInt16 i = m_pListBoxHelper->GetTopEntry(); i < nEndPos; ++i )
     482                 :            :             {
     483 [ #  # ][ #  # ]:          0 :                 if ( m_pListBoxHelper->GetBoundingRectangle(i).IsInside( aPos ) )
                 [ #  # ]
     484                 :            :                 {
     485 [ #  # ][ #  # ]:          0 :                     xChild = getAccessibleChild(i);
     486                 :          0 :                     break;
     487                 :            :                 }
     488                 :            :             }
     489                 :            :         }
     490                 :            :     }
     491                 :            : 
     492 [ #  # ][ #  # ]:          0 :     return xChild;
     493                 :            : }
     494                 :            : // -----------------------------------------------------------------------------
     495                 :            : 
     496                 :            : //===== XServiceInfo ==========================================================
     497                 :            : 
     498                 :          4 : ::rtl::OUString VCLXAccessibleList::getImplementationName (void)
     499                 :            :     throw (RuntimeException)
     500                 :            : {
     501                 :          4 :     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleList"));
     502                 :            : }
     503                 :            : // -----------------------------------------------------------------------------
     504                 :            : 
     505                 :          0 : Sequence< ::rtl::OUString > VCLXAccessibleList::getSupportedServiceNames (void)
     506                 :            :     throw (RuntimeException)
     507                 :            : {
     508                 :          0 :     Sequence< ::rtl::OUString > aNames = VCLXAccessibleComponent::getSupportedServiceNames();
     509                 :          0 :     sal_Int32 nLength = aNames.getLength();
     510         [ #  # ]:          0 :     aNames.realloc( nLength + 1 );
     511 [ #  # ][ #  # ]:          0 :     aNames[nLength] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleList"));
     512                 :          0 :     return aNames;
     513                 :            : }
     514                 :            : // -----------------------------------------------------------------------------
     515                 :            : 
     516                 :        242 : void VCLXAccessibleList::UpdateVisibleLineCount()
     517                 :            : {
     518         [ +  - ]:        242 :     if ( m_pListBoxHelper )
     519                 :            :     {
     520         [ +  - ]:        242 :         if ( (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN )
     521                 :        242 :             m_nVisibleLineCount = m_pListBoxHelper->GetDisplayLineCount();
     522                 :            :         else
     523                 :            :         {
     524                 :          0 :             sal_uInt16 nCols = 0,
     525                 :          0 :                 nLines = 0;
     526         [ #  # ]:          0 :             m_pListBoxHelper->GetMaxVisColumnsAndLines (nCols, nLines);
     527                 :          0 :             m_nVisibleLineCount = nLines;
     528                 :            :         }
     529                 :            :     }
     530                 :        242 : }
     531                 :            : 
     532                 :            : // -----------------------------------------------------------------------------
     533                 :          0 : void VCLXAccessibleList::UpdateEntryRange_Impl()
     534                 :            : {
     535         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     536         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     537                 :            : 
     538                 :          0 :     sal_Int32 nTop = m_nLastTopEntry;
     539                 :            : 
     540         [ #  # ]:          0 :     if ( m_pListBoxHelper )
     541         [ #  # ]:          0 :         nTop = m_pListBoxHelper->GetTopEntry();
     542         [ #  # ]:          0 :     if ( nTop != m_nLastTopEntry )
     543                 :            :     {
     544         [ #  # ]:          0 :         UpdateVisibleLineCount();
     545                 :          0 :         sal_Int32 nBegin = Min( m_nLastTopEntry, nTop );
     546                 :          0 :         sal_Int32 nEnd = Max( m_nLastTopEntry + m_nVisibleLineCount, nTop + m_nVisibleLineCount );
     547         [ #  # ]:          0 :         for (sal_uInt16 i = static_cast<sal_uInt16>(nBegin); (i <= static_cast<sal_uInt16>(nEnd)); ++i)
     548                 :            :         {
     549 [ #  # ][ #  # ]:          0 :             sal_Bool bVisible = ( i >= nTop && i < ( nTop + m_nVisibleLineCount ) );
     550                 :          0 :             Reference< XAccessible > xHold;
     551         [ #  # ]:          0 :             if ( i < m_aAccessibleChildren.size() )
     552 [ #  # ][ #  # ]:          0 :                 xHold = m_aAccessibleChildren[i];
     553         [ #  # ]:          0 :             else if ( bVisible )
     554 [ #  # ][ #  # ]:          0 :                 xHold = CreateChild(i);
     555                 :            : 
     556         [ #  # ]:          0 :             if ( xHold.is() )
     557 [ #  # ][ #  # ]:          0 :                 static_cast< VCLXAccessibleListItem* >( xHold.get() )->SetVisible( m_bVisible && bVisible );
         [ #  # ][ #  # ]
                 [ #  # ]
     558                 :          0 :         }
     559                 :            :     }
     560                 :            : 
     561 [ #  # ][ #  # ]:          0 :     m_nLastTopEntry = nTop;
     562                 :          0 : }
     563                 :            : // -----------------------------------------------------------------------------
     564                 :          0 : sal_Bool VCLXAccessibleList::checkEntrySelected(sal_uInt16 _nPos,Any& _rNewValue,Reference< XAccessible >& _rxNewAcc)
     565                 :            : {
     566                 :            :     OSL_ENSURE(m_pListBoxHelper,"Helper is not valid!");
     567                 :          0 :     sal_Bool bNowSelected = sal_False;
     568         [ #  # ]:          0 :     if ( m_pListBoxHelper )
     569                 :            :     {
     570                 :          0 :         bNowSelected = m_pListBoxHelper->IsEntryPosSelected (_nPos);
     571         [ #  # ]:          0 :         if ( bNowSelected )
     572                 :            :         {
     573         [ #  # ]:          0 :             _rxNewAcc = CreateChild(_nPos);
     574                 :          0 :             _rNewValue <<= _rxNewAcc;
     575                 :            :         }
     576                 :            :     }
     577                 :          0 :     return bNowSelected;
     578                 :            : }
     579                 :            : // -----------------------------------------------------------------------------
     580                 :            : 
     581                 :          0 : void VCLXAccessibleList::UpdateSelection_Impl(sal_uInt16)
     582                 :            : {
     583                 :          0 :     uno::Any aOldValue, aNewValue;
     584                 :            : 
     585                 :            :     {
     586         [ #  # ]:          0 :         SolarMutexGuard aSolarGuard;
     587         [ #  # ]:          0 :         ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     588                 :          0 :         Reference< XAccessible > xNewAcc;
     589                 :            : 
     590         [ #  # ]:          0 :         if ( m_pListBoxHelper )
     591                 :            :         {
     592                 :          0 :             sal_uInt16 i=0;
     593 [ #  # ][ #  # ]:          0 :             for ( ListItems::iterator aIter = m_aAccessibleChildren.begin();
     594                 :          0 :                   aIter != m_aAccessibleChildren.end(); ++aIter,++i)
     595                 :            :             {
     596         [ #  # ]:          0 :                 Reference< XAccessible > xHold = *aIter;
     597         [ #  # ]:          0 :                 if ( xHold.is() )
     598                 :            :                 {
     599 [ #  # ][ #  # ]:          0 :                     VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >( xHold.get() );
     600                 :            :                     // Retrieve the item's index from the list entry.
     601         [ #  # ]:          0 :                     sal_Bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i);
     602                 :            : 
     603 [ #  # ][ #  # ]:          0 :                     if ( bNowSelected && !pItem->IsSelected() )
                 [ #  # ]
     604                 :            :                     {
     605 [ #  # ][ #  # ]:          0 :                         xNewAcc = *aIter;
     606         [ #  # ]:          0 :                         aNewValue <<= xNewAcc;
     607                 :            :                     }
     608         [ #  # ]:          0 :                     else if ( pItem->IsSelected() )
     609                 :          0 :                         m_nLastSelectedPos = i;
     610                 :            : 
     611         [ #  # ]:          0 :                     pItem->SetSelected( bNowSelected );
     612                 :            :                 }
     613                 :            :                 else
     614                 :            :                 { // it could happen that a child was not created before
     615         [ #  # ]:          0 :                     checkEntrySelected(i,aNewValue,xNewAcc);
     616                 :            :                 }
     617                 :          0 :             }
     618         [ #  # ]:          0 :             sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount();
     619         [ #  # ]:          0 :             if ( i < nCount ) // here we have to check the if any other listbox entry is selected
     620                 :            :             {
     621 [ #  # ][ #  # ]:          0 :                 for (; i < nCount && !checkEntrySelected(i,aNewValue,xNewAcc) ;++i )
         [ #  # ][ #  # ]
     622                 :            :                     ;
     623                 :            :             }
     624 [ #  # ][ #  # ]:          0 :             if ( xNewAcc.is() && GetWindow()->HasFocus() )
         [ #  # ][ #  # ]
                 [ #  # ]
     625                 :            :             {
     626         [ #  # ]:          0 :                 if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND )
     627 [ #  # ][ #  # ]:          0 :                     aOldValue <<= getAccessibleChild( (sal_Int32)m_nLastSelectedPos );
     628         [ #  # ]:          0 :                 aNewValue <<= xNewAcc;
     629                 :            :             }
     630 [ #  # ][ #  # ]:          0 :         }
     631                 :            :     }
     632                 :            : 
     633 [ #  # ][ #  # ]:          0 :     if ( aNewValue.hasValue() || aOldValue.hasValue() )
                 [ #  # ]
     634                 :            :         NotifyAccessibleEvent(
     635                 :            :             AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
     636                 :            :             aOldValue,
     637         [ #  # ]:          0 :             aNewValue );
     638                 :            : 
     639         [ #  # ]:          0 :     NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
     640                 :          0 : }
     641                 :            : 
     642                 :            : // -----------------------------------------------------------------------------
     643                 :            : // XAccessibleSelection
     644                 :            : // -----------------------------------------------------------------------------
     645                 :          0 : void SAL_CALL VCLXAccessibleList::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     646                 :            : {
     647                 :          0 :     sal_Bool bNotify = sal_False;
     648                 :            : 
     649                 :            :     {
     650         [ #  # ]:          0 :         SolarMutexGuard aSolarGuard;
     651         [ #  # ]:          0 :         ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     652                 :            : 
     653         [ #  # ]:          0 :         if ( m_pListBoxHelper )
     654                 :            :         {
     655         [ #  # ]:          0 :             checkSelection_Impl(nChildIndex,*m_pListBoxHelper,sal_False);
     656                 :            : 
     657         [ #  # ]:          0 :             m_pListBoxHelper->SelectEntryPos( (sal_uInt16)nChildIndex, sal_True );
     658                 :            :             // call the select handler, don't handle events in this time
     659                 :          0 :             m_bDisableProcessEvent = true;
     660         [ #  # ]:          0 :             m_pListBoxHelper->Select();
     661                 :          0 :             m_bDisableProcessEvent = false;
     662                 :          0 :             bNotify = sal_True;
     663 [ #  # ][ #  # ]:          0 :         }
     664                 :            :     }
     665                 :            : 
     666         [ #  # ]:          0 :     if ( bNotify )
     667                 :          0 :         UpdateSelection_Impl();
     668                 :          0 : }
     669                 :            : // -----------------------------------------------------------------------------
     670                 :          0 : sal_Bool SAL_CALL VCLXAccessibleList::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     671                 :            : {
     672         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     673         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     674                 :            : 
     675                 :          0 :     sal_Bool bRet = sal_False;
     676         [ #  # ]:          0 :     if ( m_pListBoxHelper )
     677                 :            :     {
     678         [ #  # ]:          0 :         checkSelection_Impl(nChildIndex,*m_pListBoxHelper,sal_False);
     679                 :            : 
     680         [ #  # ]:          0 :         bRet = m_pListBoxHelper->IsEntryPosSelected( (sal_uInt16)nChildIndex );
     681                 :            :     }
     682 [ #  # ][ #  # ]:          0 :     return bRet;
     683                 :            : }
     684                 :            : // -----------------------------------------------------------------------------
     685                 :          0 : void SAL_CALL VCLXAccessibleList::clearAccessibleSelection(  ) throw (RuntimeException)
     686                 :            : {
     687                 :          0 :     sal_Bool bNotify = sal_False;
     688                 :            : 
     689                 :            :     {
     690         [ #  # ]:          0 :         SolarMutexGuard aSolarGuard;
     691         [ #  # ]:          0 :         ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     692                 :            : 
     693         [ #  # ]:          0 :         if ( m_pListBoxHelper )
     694                 :            :         {
     695         [ #  # ]:          0 :             m_pListBoxHelper->SetNoSelection();
     696                 :          0 :             bNotify = sal_True;
     697 [ #  # ][ #  # ]:          0 :         }
     698                 :            :     }
     699                 :            : 
     700         [ #  # ]:          0 :     if ( bNotify )
     701                 :          0 :         UpdateSelection_Impl();
     702                 :          0 : }
     703                 :            : // -----------------------------------------------------------------------------
     704                 :          0 : void SAL_CALL VCLXAccessibleList::selectAllAccessibleChildren(  ) throw (RuntimeException)
     705                 :            : {
     706                 :          0 :     sal_Bool bNotify = sal_False;
     707                 :            : 
     708                 :            :     {
     709         [ #  # ]:          0 :         SolarMutexGuard aSolarGuard;
     710         [ #  # ]:          0 :         ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     711                 :            : 
     712         [ #  # ]:          0 :         if ( m_pListBoxHelper )
     713                 :            :         {
     714         [ #  # ]:          0 :             sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount();
     715         [ #  # ]:          0 :             for ( sal_uInt16 i = 0; i < nCount; ++i )
     716         [ #  # ]:          0 :                 m_pListBoxHelper->SelectEntryPos( i, sal_True );
     717                 :            :             // call the select handler, don't handle events in this time
     718                 :          0 :             m_bDisableProcessEvent = true;
     719         [ #  # ]:          0 :             m_pListBoxHelper->Select();
     720                 :          0 :             m_bDisableProcessEvent = false;
     721                 :          0 :             bNotify = sal_True;
     722 [ #  # ][ #  # ]:          0 :         }
     723                 :            :     }
     724                 :            : 
     725         [ #  # ]:          0 :     if ( bNotify )
     726                 :          0 :         UpdateSelection_Impl();
     727                 :          0 : }
     728                 :            : // -----------------------------------------------------------------------------
     729                 :          0 : sal_Int32 SAL_CALL VCLXAccessibleList::getSelectedAccessibleChildCount(  ) throw (RuntimeException)
     730                 :            : {
     731         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     732         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     733                 :            : 
     734                 :          0 :     sal_Int32 nCount = 0;
     735         [ #  # ]:          0 :     if ( m_pListBoxHelper )
     736         [ #  # ]:          0 :            nCount = m_pListBoxHelper->GetSelectEntryCount();
     737 [ #  # ][ #  # ]:          0 :     return nCount;
     738                 :            : }
     739                 :            : // -----------------------------------------------------------------------------
     740                 :          0 : Reference< XAccessible > SAL_CALL VCLXAccessibleList::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     741                 :            : {
     742         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     743         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     744                 :            : 
     745         [ #  # ]:          0 :     if ( m_pListBoxHelper )
     746                 :            :     {
     747         [ #  # ]:          0 :         checkSelection_Impl(nSelectedChildIndex,*m_pListBoxHelper,sal_True);
     748 [ #  # ][ #  # ]:          0 :         return getAccessibleChild( (sal_Int32)m_pListBoxHelper->GetSelectEntryPos( (sal_uInt16)nSelectedChildIndex ) );
     749                 :            :     }
     750                 :            : 
     751 [ #  # ][ #  # ]:          0 :     return NULL;
                 [ #  # ]
     752                 :            : }
     753                 :            : // -----------------------------------------------------------------------------
     754                 :          0 : void SAL_CALL VCLXAccessibleList::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     755                 :            : {
     756                 :          0 :     sal_Bool bNotify = sal_False;
     757                 :            : 
     758                 :            :     {
     759         [ #  # ]:          0 :         SolarMutexGuard aSolarGuard;
     760         [ #  # ]:          0 :         ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     761                 :            : 
     762         [ #  # ]:          0 :         if ( m_pListBoxHelper )
     763                 :            :         {
     764         [ #  # ]:          0 :             checkSelection_Impl(nSelectedChildIndex,*m_pListBoxHelper,sal_False);
     765                 :            : 
     766         [ #  # ]:          0 :             m_pListBoxHelper->SelectEntryPos( (sal_uInt16)nSelectedChildIndex, sal_False );
     767                 :            :             // call the select handler, don't handle events in this time
     768                 :          0 :             m_bDisableProcessEvent = true;
     769         [ #  # ]:          0 :             m_pListBoxHelper->Select();
     770                 :          0 :             m_bDisableProcessEvent = false;
     771                 :          0 :             bNotify = sal_True;
     772 [ #  # ][ #  # ]:          0 :         }
     773                 :            :     }
     774                 :            : 
     775         [ #  # ]:          0 :     if ( bNotify )
     776                 :          0 :         UpdateSelection_Impl();
     777                 :          0 : }
     778                 :            : // -----------------------------------------------------------------------------
     779                 :          8 : awt::Rectangle VCLXAccessibleList::implGetBounds() throw (uno::RuntimeException)
     780                 :            : {
     781                 :          8 :     awt::Rectangle aBounds ( 0, 0, 0, 0 );
     782         [ +  - ]:         16 :     if ( m_pListBoxHelper
           [ +  -  +  - ]
     783                 :          8 :         && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN )
     784                 :            :     {
     785         [ -  + ]:          8 :         if ( m_pListBoxHelper->IsInDropDown() )
     786         [ #  # ]:          0 :             aBounds = AWTRectangle(m_pListBoxHelper->GetDropDownPosSizePixel());
     787                 :            :     }
     788                 :            :     else
     789                 :            :     {
     790                 :            :         // a list has the same bounds as his parent but starts at (0,0)
     791                 :          0 :         aBounds = VCLXAccessibleComponent::implGetBounds();
     792                 :          0 :         aBounds.X = 0;
     793                 :          0 :         aBounds.Y = 0;
     794         [ #  # ]:          0 :         if ( m_aBoxType == COMBOBOX )
     795                 :            :         {
     796                 :          0 :             ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
     797         [ #  # ]:          0 :             if ( pBox )
     798                 :            :             {
     799         [ #  # ]:          0 :                 Size aSize = pBox->GetSubEdit()->GetSizePixel();
     800                 :          0 :                 aBounds.X += aSize.Height();
     801                 :          0 :                 aBounds.Y += aSize.Width();
     802                 :          0 :                 aBounds.Height -= aSize.Height();
     803                 :          0 :                 aBounds.Width  -= aSize.Width();
     804                 :            :             }
     805                 :            :         }
     806                 :            :     }
     807                 :          8 :     return aBounds;
     808                 :            : }
     809                 :            : // -----------------------------------------------------------------------------
     810                 :            : 
     811                 :          0 : awt::Point VCLXAccessibleList::getLocationOnScreen(  ) throw (uno::RuntimeException)
     812                 :            : {
     813         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     814         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     815                 :            : 
     816                 :          0 :     awt::Point aPos;
     817 [ #  # ][ #  # ]:          0 :     if ( m_pListBoxHelper
                 [ #  # ]
     818         [ #  # ]:          0 :         && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN )
     819                 :            :     {
     820 [ #  # ][ #  # ]:          0 :         if ( m_pListBoxHelper->IsInDropDown() )
     821         [ #  # ]:          0 :             aPos = AWTPoint(m_pListBoxHelper->GetDropDownPosSizePixel().TopLeft());
     822                 :            :     }
     823                 :            :     else
     824                 :            :     {
     825         [ #  # ]:          0 :         aPos = VCLXAccessibleComponent::getLocationOnScreen();
     826         [ #  # ]:          0 :         if ( m_aBoxType == COMBOBOX )
     827                 :            :         {
     828         [ #  # ]:          0 :             ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
     829         [ #  # ]:          0 :             if ( pBox )
     830                 :            :             {
     831         [ #  # ]:          0 :                 aPos.X += pBox->GetSubEdit()->GetSizePixel().Height();
     832         [ #  # ]:          0 :                 aPos.Y += pBox->GetSubEdit()->GetSizePixel().Width();
     833                 :            :             }
     834                 :            :         }
     835                 :            :     }
     836 [ #  # ][ #  # ]:          0 :     return aPos;
     837                 :            : }
     838                 :            : // -----------------------------------------------------------------------------
     839                 :            : 
     840                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10