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

Generated by: LCOV version 1.10