LCOV - code coverage report
Current view: top level - accessibility/source/standard - vclxaccessiblebox.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 248 0.0 %
Date: 2014-04-14 Functions: 0 25 0.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           0 : VCLXAccessibleBox::VCLXAccessibleBox (VCLXWindow* pVCLWindow, BoxType aType, bool bIsDropDownBox)
      43             :     : VCLXAccessibleComponent (pVCLWindow),
      44             :       m_aBoxType (aType),
      45             :       m_bIsDropDownBox (bIsDropDownBox),
      46           0 :       m_nIndexInParent (DEFAULT_INDEX_IN_PARENT)
      47             : {
      48             :     // Set up the flags that indicate which children this object has.
      49           0 :     m_bHasListChild = true;
      50             : 
      51             :     // A text field is not present for non drop down list boxes.
      52           0 :     if ((m_aBoxType==LISTBOX) && ! m_bIsDropDownBox)
      53           0 :         m_bHasTextChild = false;
      54             :     else
      55           0 :         m_bHasTextChild = true;
      56           0 : }
      57             : 
      58           0 : VCLXAccessibleBox::~VCLXAccessibleBox (void)
      59             : {
      60           0 : }
      61             : 
      62           0 : void VCLXAccessibleBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent )
      63             : {
      64           0 :        uno::Any aOldValue, aNewValue;
      65           0 :     uno::Reference<XAccessible> xAcc;
      66             : 
      67           0 :     switch ( rVclWindowEvent.GetId() )
      68             :     {
      69             :         case VCLEVENT_WINDOW_SHOW:
      70             :         case VCLEVENT_WINDOW_HIDE:
      71             :         {
      72           0 :             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           0 :             if (m_aBoxType==COMBOBOX)
      77             :             {
      78           0 :                 ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
      79           0 :                 if ( ( pComboBox != NULL ) && ( pChildWindow != NULL ) )
      80           0 :                     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           0 :         break;
     103             : 
     104             :         default:
     105           0 :             VCLXAccessibleComponent::ProcessWindowChildEvent (rVclWindowEvent);
     106           0 :     }
     107           0 : }
     108             : 
     109           0 : void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
     110             : {
     111           0 :     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           0 :                  VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     143           0 :                  if ( pList == NULL )
     144             :             {
     145           0 :                 getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
     146           0 :                 pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     147             :             }
     148           0 :             if ( pList != NULL )
     149             :             {
     150           0 :                 pList->ProcessWindowEvent (rVclWindowEvent);
     151           0 :                 pList->HandleDropOpen();
     152             :             }
     153           0 :             break;
     154             :         }
     155             :         case VCLEVENT_DROPDOWN_CLOSE:
     156             :         {
     157           0 :                  VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     158           0 :                  if ( pList == NULL )
     159             :             {
     160           0 :                 getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
     161           0 :                 pList = static_cast<VCLXAccessibleList*>(m_xList.get());
     162             :             }
     163           0 :             if ( pList != NULL )
     164             :             {
     165           0 :                 pList->ProcessWindowEvent (rVclWindowEvent);
     166             :             }
     167           0 :             Window* pWindow = GetWindow();
     168           0 :             if( pWindow && (pWindow->HasFocus() || pWindow->HasChildPathFocus()) )
     169             :             {
     170           0 :                 Any aOldValue, aNewValue;
     171           0 :                 aNewValue <<= AccessibleStateType::FOCUSED;
     172           0 :                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
     173             :             }
     174           0 :             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           0 :             if (m_aBoxType==COMBOBOX)
     253             :             {
     254           0 :                 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           0 :             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           0 :             VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
     289             :     }
     290           0 : }
     291             : 
     292           0 : IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleBox, VCLXAccessibleComponent, VCLXAccessibleBox_BASE)
     293           0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleBox, VCLXAccessibleComponent, VCLXAccessibleBox_BASE)
     294             : 
     295             : //=====  XAccessible  =========================================================
     296             : 
     297           0 : Reference< XAccessibleContext > SAL_CALL VCLXAccessibleBox::getAccessibleContext(  )
     298             :     throw (RuntimeException, std::exception)
     299             : {
     300           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     301             : 
     302           0 :     return this;
     303             : }
     304             : 
     305             : //=====  XAccessibleContext  ==================================================
     306             : 
     307           0 : sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleChildCount (void)
     308             :     throw (RuntimeException, std::exception)
     309             : {
     310           0 :     SolarMutexGuard aSolarGuard;
     311           0 :     ::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           0 :     sal_Int32 nCount = 0;
     317           0 :     if (IsValid())
     318           0 :         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           0 :     return nCount;
     329             : }
     330             : 
     331           0 : Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int32 i)
     332             :     throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     333             : {
     334           0 :     SolarMutexGuard aSolarGuard;
     335           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     336             : 
     337           0 :     if (i<0 || i>=getAccessibleChildCount())
     338           0 :         throw IndexOutOfBoundsException();
     339             : 
     340           0 :     Reference< XAccessible > xChild;
     341           0 :     if (IsValid())
     342             :     {
     343           0 :         if (i==1 || ! m_bHasTextChild)
     344             :         {
     345             :             // List.
     346           0 :             if ( ! m_xList.is())
     347             :             {
     348           0 :                 VCLXAccessibleList* pList = new VCLXAccessibleList ( GetVCLXWindow(),
     349           0 :                     (m_aBoxType == LISTBOX ? VCLXAccessibleList::LISTBOX : VCLXAccessibleList::COMBOBOX),
     350           0 :                                                                     this);
     351           0 :                 pList->SetIndexInParent (i);
     352           0 :                 m_xList = pList;
     353             :             }
     354           0 :             xChild = m_xList;
     355             :         }
     356             :         else
     357             :         {
     358             :             // Text Field.
     359           0 :             if ( ! m_xText.is())
     360             :             {
     361           0 :                 if (m_aBoxType==COMBOBOX)
     362             :                 {
     363           0 :                     ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
     364           0 :                     if (pComboBox!=NULL && pComboBox->GetSubEdit()!=NULL)
     365             :                     //Set the edit's acc name the same as parent
     366             :                     {
     367           0 :                         pComboBox->GetSubEdit()->SetAccessibleName(getAccessibleName());
     368           0 :                         m_xText = pComboBox->GetSubEdit()->GetAccessible();
     369             :                     }
     370             :                 }
     371           0 :                 else if (m_bIsDropDownBox)
     372           0 :                     m_xText = new VCLXAccessibleTextField (GetVCLXWindow(),this);
     373             :             }
     374           0 :             xChild = m_xText;
     375             :         }
     376             :     }
     377             : 
     378           0 :     return xChild;
     379             : }
     380             : 
     381           0 : sal_Int16 SAL_CALL VCLXAccessibleBox::getAccessibleRole (void) throw (RuntimeException, std::exception)
     382             : {
     383           0 :     ::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           0 :     if (m_bIsDropDownBox || (!m_bIsDropDownBox && m_aBoxType == COMBOBOX ))
     390           0 :         return AccessibleRole::COMBO_BOX;
     391             :     else
     392           0 :         return AccessibleRole::PANEL;
     393             : }
     394             : 
     395           0 : sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleIndexInParent (void)
     396             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
     397             : {
     398           0 :     if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT)
     399           0 :         return m_nIndexInParent;
     400             :     else
     401           0 :         return VCLXAccessibleComponent::getAccessibleIndexInParent();
     402             : }
     403             : 
     404             : //=====  XAccessibleAction  ===================================================
     405             : 
     406           0 : sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleActionCount (void)
     407             :     throw (RuntimeException, std::exception)
     408             : {
     409           0 :     ::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           0 :     return m_bIsDropDownBox ? 1 : 0;
     414             : }
     415             : 
     416           0 : sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex)
     417             :     throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     418             : {
     419           0 :     sal_Bool bNotify = sal_False;
     420             : 
     421             :     {
     422           0 :         SolarMutexGuard aSolarGuard;
     423           0 :         ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     424             : 
     425           0 :         if (nIndex<0 || nIndex>=getAccessibleActionCount())
     426             :             throw ::com::sun::star::lang::IndexOutOfBoundsException(
     427             :                 ("VCLXAccessibleBox::doAccessibleAction: index "
     428           0 :                  + OUString::number(nIndex) + " not among 0.."
     429           0 :                  + OUString::number(getAccessibleActionCount())),
     430           0 :                 static_cast<OWeakObject*>(this));
     431             : 
     432           0 :         if (m_aBoxType == COMBOBOX)
     433             :         {
     434           0 :             ComboBox* pComboBox = static_cast< ComboBox* >( GetWindow() );
     435           0 :             if (pComboBox != NULL)
     436             :             {
     437           0 :                 pComboBox->ToggleDropDown();
     438           0 :                 bNotify = sal_True;
     439             :             }
     440             :         }
     441           0 :         else if (m_aBoxType == LISTBOX)
     442             :         {
     443           0 :             ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
     444           0 :             if (pListBox != NULL)
     445             :             {
     446           0 :                 pListBox->ToggleDropDown();
     447           0 :                 bNotify = sal_True;
     448             :             }
     449           0 :         }
     450             :     }
     451             : 
     452           0 :     if (bNotify)
     453           0 :         NotifyAccessibleEvent (AccessibleEventId::ACTION_CHANGED, Any(), Any());
     454             : 
     455           0 :     return bNotify;
     456             : }
     457             : 
     458           0 : OUString SAL_CALL VCLXAccessibleBox::getAccessibleActionDescription (sal_Int32 nIndex)
     459             :     throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     460             : {
     461           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     462           0 :     if (nIndex<0 || nIndex>=getAccessibleActionCount())
     463           0 :         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           0 :     if (m_aBoxType == LISTBOX)
     467           0 :         return ::rtl::OUString();
     468           0 :     return m_bIsDropDownBox?::rtl::OUString():TK_RES_STRING( RID_STR_ACC_ACTION_TOGGLEPOPUP);
     469             : }
     470             : 
     471           0 : Reference< XAccessibleKeyBinding > VCLXAccessibleBox::getAccessibleActionKeyBinding( sal_Int32 nIndex )
     472             :     throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     473             : {
     474           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     475             : 
     476           0 :     Reference< XAccessibleKeyBinding > xRet;
     477             : 
     478           0 :     if (nIndex<0 || nIndex>=getAccessibleActionCount())
     479           0 :         throw ::com::sun::star::lang::IndexOutOfBoundsException();
     480             : 
     481             :     // ... which key?
     482           0 :     return xRet;
     483             : }
     484             : 
     485             : //=====  XComponent  ==========================================================
     486             : 
     487           0 : void SAL_CALL VCLXAccessibleBox::disposing (void)
     488             : {
     489           0 :     VCLXAccessibleComponent::disposing();
     490           0 : }
     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           0 : void VCLXAccessibleBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
     562             : {
     563           0 :     VCLXAccessibleComponent::FillAccessibleStateSet(rStateSet);
     564           0 :     if (m_aBoxType == COMBOBOX )
     565             :     {
     566           0 :         ::rtl::OUString sText;
     567           0 :         sal_Int32 nEntryCount = 0;
     568           0 :         ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
     569           0 :         if (pComboBox != NULL)
     570             :         {
     571           0 :             Edit* pSubEdit = pComboBox->GetSubEdit();
     572           0 :             if ( pSubEdit)
     573           0 :                 sText = pSubEdit->GetText();
     574           0 :             nEntryCount = pComboBox->GetEntryCount();
     575             :         }
     576           0 :         if ( sText.isEmpty() && nEntryCount > 0 )
     577           0 :             rStateSet.AddState(AccessibleStateType::INDETERMINATE);
     578             :     }
     579           0 :     else if (m_aBoxType == LISTBOX && m_bIsDropDownBox == true)
     580             :     {
     581           0 :         sal_Int32 nSelectedEntryCount = 0;
     582           0 :         ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
     583           0 :         if (pListBox != NULL && pListBox->GetEntryCount() > 0)
     584             :         {
     585           0 :                 nSelectedEntryCount = pListBox->GetSelectEntryCount();
     586           0 :             if ( nSelectedEntryCount == 0)
     587           0 :                 rStateSet.AddState(AccessibleStateType::INDETERMINATE);
     588             :         }
     589             :     }
     590           0 : }
     591             : 
     592             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10