LCOV - code coverage report
Current view: top level - accessibility/source/standard - vclxaccessiblebox.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 146 248 58.9 %
Date: 2014-04-11 Functions: 17 25 68.0 %
Legend: Lines: hit not hit

          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/vclxaccessiblebox.hxx>
      21             : #include <accessibility/standard/vclxaccessibletextfield.hxx>
      22             : #include <accessibility/standard/vclxaccessibleedit.hxx>
      23             : #include <accessibility/standard/vclxaccessiblelist.hxx>
      24             : #include <accessibility/helper/listboxhelper.hxx>
      25             : 
      26             : #include <unotools/accessiblestatesethelper.hxx>
      27             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      28             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      29             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      30             : #include <vcl/svapp.hxx>
      31             : #include <vcl/combobox.hxx>
      32             : #include <vcl/lstbox.hxx>
      33             : #include <accessibility/helper/accresmgr.hxx>
      34             : #include <accessibility/helper/accessiblestrings.hrc>
      35             : 
      36             : using namespace ::com::sun::star;
      37             : using namespace ::com::sun::star::uno;
      38             : using namespace ::com::sun::star::lang;
      39             : using namespace ::com::sun::star::beans;
      40             : using namespace ::com::sun::star::accessibility;
      41             : 
      42          10 : VCLXAccessibleBox::VCLXAccessibleBox (VCLXWindow* pVCLWindow, BoxType aType, bool bIsDropDownBox)
      43             :     : VCLXAccessibleComponent (pVCLWindow),
      44             :       m_aBoxType (aType),
      45             :       m_bIsDropDownBox (bIsDropDownBox),
      46          10 :       m_nIndexInParent (DEFAULT_INDEX_IN_PARENT)
      47             : {
      48             :     // Set up the flags that indicate which children this object has.
      49          10 :     m_bHasListChild = true;
      50             : 
      51             :     // A text field is not present for non drop down list boxes.
      52          10 :     if ((m_aBoxType==LISTBOX) && ! m_bIsDropDownBox)
      53           0 :         m_bHasTextChild = false;
      54             :     else
      55          10 :         m_bHasTextChild = true;
      56          10 : }
      57             : 
      58           0 : VCLXAccessibleBox::~VCLXAccessibleBox (void)
      59             : {
      60           0 : }
      61             : 
      62         149 : void VCLXAccessibleBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent )
      63             : {
      64         298 :        uno::Any aOldValue, aNewValue;
      65         298 :     uno::Reference<XAccessible> xAcc;
      66             : 
      67         149 :     switch ( rVclWindowEvent.GetId() )
      68             :     {
      69             :         case VCLEVENT_WINDOW_SHOW:
      70             :         case VCLEVENT_WINDOW_HIDE:
      71             :         {
      72          46 :             Window* pChildWindow = (Window *) rVclWindowEvent.GetData();
      73             :             // Just compare to the combo box text field.  All other children
      74             :             // are identical to this object in which case this object will
      75             :             // be removed in a short time.
      76          46 :             if (m_aBoxType==COMBOBOX)
      77             :             {
      78          26 :                 ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
      79          26 :                 if ( ( pComboBox != NULL ) && ( pChildWindow != NULL ) )
      80          15 :                     if (pChildWindow == pComboBox->GetSubEdit())
      81             :                     {
      82           0 :                         if (rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW)
      83             :                         {
      84             :                             // Instantiate text field.
      85           0 :                             getAccessibleChild (0);
      86           0 :                             aNewValue <<= m_xText;
      87             :                         }
      88             :                         else
      89             :                         {
      90             :                             // Release text field.
      91           0 :                             aOldValue <<= m_xText;
      92           0 :                             m_xText = NULL;
      93             :                         }
      94             :                         // Tell the listeners about the new/removed child.
      95             :                         NotifyAccessibleEvent (
      96             :                             AccessibleEventId::CHILD,
      97           0 :                             aOldValue, aNewValue);
      98             :                     }
      99             : 
     100             :             }
     101             :         }
     102          46 :         break;
     103             : 
     104             :         default:
     105         103 :             VCLXAccessibleComponent::ProcessWindowChildEvent (rVclWindowEvent);
     106         149 :     }
     107         149 : }
     108             : 
     109          42 : void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
     110             : {
     111          42 :     switch ( rVclWindowEvent.GetId() )
     112             :     {
     113             :         case VCLEVENT_DROPDOWN_SELECT:
     114             :         case VCLEVENT_LISTBOX_SELECT:
     115             :         case VCLEVENT_LISTBOX_FOCUSITEMCHANGED:
     116             : 
     117             :         {
     118             :                 // Forward the call to the list child.
     119           0 :                 VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     120           0 :                 if ( pList == NULL )
     121             :             {
     122           0 :                 getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
     123           0 :                 pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     124             :             }
     125           0 :             if ( pList != NULL )
     126             :             {
     127           0 :                 pList->ProcessWindowEvent (rVclWindowEvent, m_bIsDropDownBox);
     128           0 :                 if(m_bIsDropDownBox)
     129             :                 {
     130           0 :                     NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED, Any(), Any());
     131           0 :                     Any aOldValue;
     132           0 :                     Any aNewValue;
     133           0 :                     aOldValue <<= AccessibleStateType::INDETERMINATE;
     134           0 :                     NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue);
     135             : 
     136             :                 }
     137             :             }
     138           0 :             break;
     139             :         }
     140             :         case VCLEVENT_DROPDOWN_OPEN:
     141             :         {
     142           2 :                  VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     143           2 :                  if ( pList == NULL )
     144             :             {
     145           1 :                 getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
     146           1 :                 pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     147             :             }
     148           2 :             if ( pList != NULL )
     149             :             {
     150           2 :                 pList->ProcessWindowEvent (rVclWindowEvent);
     151           2 :                 pList->HandleDropOpen();
     152             :             }
     153           2 :             break;
     154             :         }
     155             :         case VCLEVENT_DROPDOWN_CLOSE:
     156             :         {
     157           1 :                  VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     158           1 :                  if ( pList == NULL )
     159             :             {
     160           0 :                 getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
     161           0 :                 pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     162             :             }
     163           1 :             if ( pList != NULL )
     164             :             {
     165           1 :                 pList->ProcessWindowEvent (rVclWindowEvent);
     166             :             }
     167           1 :             Window* pWindow = GetWindow();
     168           1 :             if( pWindow && (pWindow->HasFocus() || pWindow->HasChildPathFocus()) )
     169             :             {
     170           2 :                 Any aOldValue, aNewValue;
     171           1 :                 aNewValue <<= AccessibleStateType::FOCUSED;
     172           2 :                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
     173             :             }
     174           1 :             break;
     175             :         }
     176             :         case VCLEVENT_COMBOBOX_SELECT:
     177             :         {
     178           0 :                  VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     179           0 :                  if (pList != NULL)
     180             :                  {
     181           0 :                         Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
     182           0 :                         if ( xText.is() )
     183             :                 {
     184           0 :                     ::rtl::OUString sText = xText->getSelectedText();
     185           0 :                     if ( sText.isEmpty() )
     186           0 :                         sText = xText->getText();
     187           0 :                             pList->UpdateSelection_Acc (sText, m_bIsDropDownBox);
     188             :                     //if(m_bIsDropDownBox && !pList->IsInDropDown())
     189           0 :                     if (m_bIsDropDownBox || ( !m_bIsDropDownBox && m_aBoxType==COMBOBOX))
     190           0 :                         NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED, Any(), Any());
     191             : 
     192           0 :                     Any aOldValue;
     193           0 :                     Any aNewValue;
     194           0 :                     aOldValue <<= AccessibleStateType::INDETERMINATE;
     195           0 :                     NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue);
     196             : 
     197           0 :                 }
     198             :                     }
     199           0 :             break;
     200             :         }
     201             :         //case VCLEVENT_DROPDOWN_OPEN:
     202             :         //case VCLEVENT_DROPDOWN_CLOSE:
     203             :         case VCLEVENT_LISTBOX_DOUBLECLICK:
     204             :         case VCLEVENT_LISTBOX_SCROLLED:
     205             :         //case VCLEVENT_LISTBOX_SELECT:
     206             :         case VCLEVENT_LISTBOX_ITEMADDED:
     207             :         case VCLEVENT_LISTBOX_ITEMREMOVED:
     208             :         case VCLEVENT_COMBOBOX_ITEMADDED:
     209             :         case VCLEVENT_COMBOBOX_ITEMREMOVED:
     210             :         case VCLEVENT_COMBOBOX_SCROLLED:
     211             :         {
     212             :             // Forward the call to the list child.
     213           0 :             VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     214           0 :             if ( pList == NULL )
     215             :             {
     216           0 :                 getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
     217           0 :                 pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     218             :             }
     219           0 :             if ( pList != NULL )
     220           0 :                 pList->ProcessWindowEvent (rVclWindowEvent);
     221           0 :             break;
     222             :         }
     223             : 
     224             :         //case VCLEVENT_COMBOBOX_SELECT:
     225             :         case VCLEVENT_COMBOBOX_DESELECT:
     226             :         {
     227             :             // Selection is handled by VCLXAccessibleList which operates on
     228             :             // the same VCL object as this box does.  In case of the
     229             :             // combobox, however, we have to help by providing the list with
     230             :             // the text of the currently selected item.
     231           0 :             VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     232           0 :             if (pList != NULL && m_xText.is())
     233             :             {
     234           0 :                 Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
     235           0 :                 if ( xText.is() )
     236             :                 {
     237           0 :                     OUString sText = xText->getSelectedText();
     238           0 :                     if ( sText.isEmpty() )
     239           0 :                         sText = xText->getText();
     240           0 :                     pList->UpdateSelection (sText);
     241           0 :                 }
     242             :             }
     243           0 :             break;
     244             :         }
     245             : 
     246             :         case VCLEVENT_EDIT_MODIFY:
     247             :         case VCLEVENT_EDIT_SELECTIONCHANGED:
     248             :      // case VCLEVENT_EDIT_CARETCHANGED:
     249             :             // Modify/Selection events are handled by the combo box instead of
     250             :             // directly by the edit field (Why?).  Therefore, delegate this
     251             :             // call to the edit field.
     252           1 :             if (m_aBoxType==COMBOBOX)
     253             :             {
     254           1 :                 if (m_xText.is())
     255             :                 {
     256           0 :                     Reference<XAccessibleContext> xContext = m_xText->getAccessibleContext();
     257           0 :                     VCLXAccessibleEdit* pEdit = static_cast<VCLXAccessibleEdit*>(xContext.get());
     258           0 :                     if (pEdit != NULL)
     259           0 :                         pEdit->ProcessWindowEvent (rVclWindowEvent);
     260             :                 }
     261             :             }
     262           1 :             break;
     263             :         /*
     264             :         // MT: Not sending VCLEVENT_LISTBOX_STATEUPDATE, see comment in ListBox::SelectEntryPos
     265             :         case VCLEVENT_LISTBOX_STATEUPDATE:
     266             :         {
     267             :             // Need to update the INDETERMINATE state sometimes
     268             :             if (m_bIsDropDownBox && m_aBoxType==LISTBOX)
     269             :             {
     270             :                 sal_Int32 nSelectedEntryCount = 0;
     271             :                 ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
     272             :                 if (pListBox != NULL && pListBox->GetEntryCount() > 0)
     273             :                 {
     274             :                     nSelectedEntryCount = pListBox->GetSelectEntryCount();
     275             :                     Any aOldValue;
     276             :                     Any aNewValue;
     277             :                     if ( nSelectedEntryCount == 0)
     278             :                         aNewValue <<= AccessibleStateType::INDETERMINATE;
     279             :                     else
     280             :                         aOldValue <<= AccessibleStateType::INDETERMINATE;
     281             :                     NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue);
     282             :                 }
     283             :             }
     284             :             break;
     285             :         }
     286             :         */
     287             :         default:
     288          38 :             VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
     289             :     }
     290          42 : }
     291             : 
     292        1156 : IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleBox, VCLXAccessibleComponent, VCLXAccessibleBox_BASE)
     293           0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleBox, VCLXAccessibleComponent, VCLXAccessibleBox_BASE)
     294             : 
     295             : //=====  XAccessible  =========================================================
     296             : 
     297           8 : Reference< XAccessibleContext > SAL_CALL VCLXAccessibleBox::getAccessibleContext(  )
     298             :     throw (RuntimeException, std::exception)
     299             : {
     300           8 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     301             : 
     302           8 :     return this;
     303             : }
     304             : 
     305             : //=====  XAccessibleContext  ==================================================
     306             : 
     307          67 : sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleChildCount (void)
     308             :     throw (RuntimeException, std::exception)
     309             : {
     310          67 :     SolarMutexGuard aSolarGuard;
     311         134 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     312             : 
     313             :     // Usually a box has a text field and a list of items as its children.
     314             :     // Non drop down list boxes have no text field.  Additionally check
     315             :     // whether the object is valid.
     316          67 :     sal_Int32 nCount = 0;
     317          67 :     if (IsValid())
     318          67 :         nCount += (m_bHasTextChild?1:0) + (m_bHasListChild?1:0);
     319             :     else
     320             :     {
     321             :         // Object not valid anymore.  Release references to children.
     322           0 :         m_bHasTextChild = false;
     323           0 :         m_xText = NULL;
     324           0 :         m_bHasListChild = false;
     325           0 :         m_xList = NULL;
     326             :     }
     327             : 
     328         134 :     return nCount;
     329             : }
     330             : 
     331          31 : Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int32 i)
     332             :     throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     333             : {
     334          31 :     SolarMutexGuard aSolarGuard;
     335          62 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     336             : 
     337          31 :     if (i<0 || i>=getAccessibleChildCount())
     338           0 :         throw IndexOutOfBoundsException();
     339             : 
     340          31 :     Reference< XAccessible > xChild;
     341          31 :     if (IsValid())
     342             :     {
     343          31 :         if (i==1 || ! m_bHasTextChild)
     344             :         {
     345             :             // List.
     346          15 :             if ( ! m_xList.is())
     347             :             {
     348          10 :                 VCLXAccessibleList* pList = new VCLXAccessibleList ( GetVCLXWindow(),
     349          10 :                     (m_aBoxType == LISTBOX ? VCLXAccessibleList::LISTBOX : VCLXAccessibleList::COMBOBOX),
     350          20 :                                                                     this);
     351          10 :                 pList->SetIndexInParent (i);
     352          10 :                 m_xList = pList;
     353             :             }
     354          15 :             xChild = m_xList;
     355             :         }
     356             :         else
     357             :         {
     358             :             // Text Field.
     359          16 :             if ( ! m_xText.is())
     360             :             {
     361          10 :                 if (m_aBoxType==COMBOBOX)
     362             :                 {
     363           5 :                     ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
     364           5 :                     if (pComboBox!=NULL && pComboBox->GetSubEdit()!=NULL)
     365             :                     //Set the edit's acc name the same as parent
     366             :                     {
     367           5 :                         pComboBox->GetSubEdit()->SetAccessibleName(getAccessibleName());
     368           5 :                         m_xText = pComboBox->GetSubEdit()->GetAccessible();
     369             :                     }
     370             :                 }
     371           5 :                 else if (m_bIsDropDownBox)
     372           5 :                     m_xText = new VCLXAccessibleTextField (GetVCLXWindow(),this);
     373             :             }
     374          16 :             xChild = m_xText;
     375             :         }
     376             :     }
     377             : 
     378          62 :     return xChild;
     379             : }
     380             : 
     381          83 : sal_Int16 SAL_CALL VCLXAccessibleBox::getAccessibleRole (void) throw (RuntimeException, std::exception)
     382             : {
     383          83 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     384             : 
     385             :     // Return the role <const>COMBO_BOX</const> for both VCL combo boxes and
     386             :     // VCL list boxes in DropDown-Mode else <const>PANEL</const>.
     387             :     // This way the Java bridge has not to handle both independently.
     388             :     //return m_bIsDropDownBox ? AccessibleRole::COMBO_BOX : AccessibleRole::PANEL;
     389          83 :     if (m_bIsDropDownBox || (!m_bIsDropDownBox && m_aBoxType == COMBOBOX ))
     390          83 :         return AccessibleRole::COMBO_BOX;
     391             :     else
     392           0 :         return AccessibleRole::PANEL;
     393             : }
     394             : 
     395           1 : sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleIndexInParent (void)
     396             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     397             : {
     398           1 :     if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT)
     399           0 :         return m_nIndexInParent;
     400             :     else
     401           1 :         return VCLXAccessibleComponent::getAccessibleIndexInParent();
     402             : }
     403             : 
     404             : //=====  XAccessibleAction  ===================================================
     405             : 
     406          22 : sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleActionCount (void)
     407             :     throw (RuntimeException, std::exception)
     408             : {
     409          22 :     ::osl::Guard< ::osl::Mutex> aGuard (GetMutex());
     410             : 
     411             :     // There is one action for drop down boxes (toggle popup) and none for
     412             :     // the other boxes.
     413          22 :     return m_bIsDropDownBox ? 1 : 0;
     414             : }
     415             : 
     416           8 : sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex)
     417             :     throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     418             : {
     419           8 :     sal_Bool bNotify = sal_False;
     420             : 
     421             :     {
     422           8 :         SolarMutexGuard aSolarGuard;
     423          16 :         ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     424             : 
     425           8 :         if (nIndex<0 || nIndex>=getAccessibleActionCount())
     426             :             throw ::com::sun::star::lang::IndexOutOfBoundsException(
     427             :                 ("VCLXAccessibleBox::doAccessibleAction: index "
     428           4 :                  + OUString::number(nIndex) + " not among 0.."
     429           8 :                  + OUString::number(getAccessibleActionCount())),
     430           6 :                 static_cast<OWeakObject*>(this));
     431             : 
     432           6 :         if (m_aBoxType == COMBOBOX)
     433             :         {
     434           3 :             ComboBox* pComboBox = static_cast< ComboBox* >( GetWindow() );
     435           3 :             if (pComboBox != NULL)
     436             :             {
     437           3 :                 pComboBox->ToggleDropDown();
     438           3 :                 bNotify = sal_True;
     439             :             }
     440             :         }
     441           3 :         else if (m_aBoxType == LISTBOX)
     442             :         {
     443           3 :             ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
     444           3 :             if (pListBox != NULL)
     445             :             {
     446           3 :                 pListBox->ToggleDropDown();
     447           3 :                 bNotify = sal_True;
     448             :             }
     449           8 :         }
     450             :     }
     451             : 
     452           6 :     if (bNotify)
     453           6 :         NotifyAccessibleEvent (AccessibleEventId::ACTION_CHANGED, Any(), Any());
     454             : 
     455           6 :     return bNotify;
     456             : }
     457             : 
     458           6 : OUString SAL_CALL VCLXAccessibleBox::getAccessibleActionDescription (sal_Int32 nIndex)
     459             :     throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     460             : {
     461           6 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     462           6 :     if (nIndex<0 || nIndex>=getAccessibleActionCount())
     463           2 :         throw ::com::sun::star::lang::IndexOutOfBoundsException();
     464             :     //Solution:When combo_box,it should not has action information.
     465             :     //return TK_RES_STRING( RID_STR_ACC_ACTION_TOGGLEPOPUP);
     466           4 :     if (m_aBoxType == LISTBOX)
     467           2 :         return ::rtl::OUString();
     468           4 :     return m_bIsDropDownBox?::rtl::OUString():TK_RES_STRING( RID_STR_ACC_ACTION_TOGGLEPOPUP);
     469             : }
     470             : 
     471           4 : Reference< XAccessibleKeyBinding > VCLXAccessibleBox::getAccessibleActionKeyBinding( sal_Int32 nIndex )
     472             :     throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     473             : {
     474           4 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     475             : 
     476           4 :     Reference< XAccessibleKeyBinding > xRet;
     477             : 
     478           4 :     if (nIndex<0 || nIndex>=getAccessibleActionCount())
     479           2 :         throw ::com::sun::star::lang::IndexOutOfBoundsException();
     480             : 
     481             :     // ... which key?
     482           4 :     return xRet;
     483             : }
     484             : 
     485             : //=====  XComponent  ==========================================================
     486             : 
     487          10 : void SAL_CALL VCLXAccessibleBox::disposing (void)
     488             : {
     489          10 :     VCLXAccessibleComponent::disposing();
     490          10 : }
     491             : 
     492             : // =====  XAccessibleValue  ===============================================
     493           0 : Any VCLXAccessibleBox::getCurrentValue( )
     494             :     throw( RuntimeException, std::exception )
     495             : {
     496           0 :     SolarMutexGuard aSolarGuard;
     497           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     498             : 
     499           0 :     Any aAny;
     500           0 :     if( m_xList.is() && m_xText.is())
     501             :     {
     502             :         // VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     503           0 :         Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
     504           0 :         if ( xText.is() )
     505             :         {
     506           0 :             ::rtl::OUString sText = xText->getText();
     507           0 :             aAny <<= sText;
     508           0 :         }
     509             :     }
     510           0 :     if (m_aBoxType == LISTBOX && m_bIsDropDownBox  && m_xList.is() )
     511             :     {
     512             : 
     513           0 :         VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     514           0 :         if(pList->IsInDropDown())
     515             :         {
     516           0 :             if(pList->getSelectedAccessibleChildCount()>0)
     517             :             {
     518           0 :                 Reference<XAccessibleContext> xName (pList->getSelectedAccessibleChild((sal_Int32)(0)), UNO_QUERY);
     519           0 :                 if(xName.is())
     520             :                 {
     521           0 :                     aAny <<= xName->getAccessibleName();
     522           0 :                 }
     523             :             }
     524             :         }
     525             :     }
     526             : 
     527           0 :     return aAny;
     528             : }
     529             : 
     530           0 : sal_Bool VCLXAccessibleBox::setCurrentValue( const Any& aNumber )
     531             :     throw( RuntimeException, std::exception )
     532             : {
     533           0 :     SolarMutexGuard aSolarGuard;
     534           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     535             : 
     536           0 :     ::rtl::OUString  fValue;
     537           0 :     sal_Bool bValid = (aNumber >>= fValue);
     538             :     if( bValid )
     539             :     {
     540             : 
     541             :     }
     542           0 :     return bValid;
     543             : 
     544             : }
     545             : 
     546           0 : Any VCLXAccessibleBox::getMaximumValue( )
     547             :     throw( RuntimeException, std::exception )
     548             : {
     549           0 :     Any aAny;
     550           0 :     return aAny;
     551             : }
     552             : 
     553           0 : Any VCLXAccessibleBox::getMinimumValue(  )
     554             :     throw( RuntimeException, std::exception )
     555             : {
     556           0 :     Any aAny;
     557           0 :     return aAny;
     558             : }
     559             : 
     560             : // Set the INDETERMINATE state when there is no selected item for combobox
     561          21 : void VCLXAccessibleBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
     562             : {
     563          21 :     VCLXAccessibleComponent::FillAccessibleStateSet(rStateSet);
     564          21 :     if (m_aBoxType == COMBOBOX )
     565             :     {
     566          13 :         ::rtl::OUString sText;
     567          13 :         sal_Int32 nEntryCount = 0;
     568          13 :         ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
     569          13 :         if (pComboBox != NULL)
     570             :         {
     571          13 :             Edit* pSubEdit = pComboBox->GetSubEdit();
     572          13 :             if ( pSubEdit)
     573          13 :                 sText = pSubEdit->GetText();
     574          13 :             nEntryCount = pComboBox->GetEntryCount();
     575             :         }
     576          13 :         if ( sText.isEmpty() && nEntryCount > 0 )
     577           0 :             rStateSet.AddState(AccessibleStateType::INDETERMINATE);
     578             :     }
     579           8 :     else if (m_aBoxType == LISTBOX && m_bIsDropDownBox == true)
     580             :     {
     581           8 :         sal_Int32 nSelectedEntryCount = 0;
     582           8 :         ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
     583           8 :         if (pListBox != NULL && pListBox->GetEntryCount() > 0)
     584             :         {
     585           8 :                 nSelectedEntryCount = pListBox->GetSelectEntryCount();
     586           8 :             if ( nSelectedEntryCount == 0)
     587           0 :                 rStateSet.AddState(AccessibleStateType::INDETERMINATE);
     588             :         }
     589             :     }
     590          21 : }
     591             : 
     592             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10