LCOV - code coverage report
Current view: top level - comphelper/source/misc - accessibleselectionhelper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 9 64 14.1 %
Date: 2012-08-25 Functions: 4 23 17.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 96 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include <comphelper/accessibleselectionhelper.hxx>
      21                 :            : 
      22                 :            : //.........................................................................
      23                 :            : namespace comphelper
      24                 :            : {
      25                 :            : //.........................................................................
      26                 :            : 
      27                 :            :     using namespace ::com::sun::star::uno;
      28                 :            :     using namespace ::com::sun::star::awt;
      29                 :            :     using namespace ::com::sun::star::lang;
      30                 :            :     using namespace ::com::sun::star::accessibility;
      31                 :            : 
      32                 :            :     //=====================================================================
      33                 :            :     //= OCommonAccessibleSelection
      34                 :            :     //=====================================================================
      35                 :            :     //---------------------------------------------------------------------
      36                 :          6 :     OCommonAccessibleSelection::OCommonAccessibleSelection( )
      37                 :            :     {
      38                 :          6 :     }
      39                 :            : 
      40                 :          6 :     OCommonAccessibleSelection::~OCommonAccessibleSelection() {}
      41                 :            : 
      42                 :            :     //--------------------------------------------------------------------
      43                 :          2 :     void SAL_CALL OCommonAccessibleSelection::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
      44                 :            :     {
      45                 :          2 :         implSelect( nChildIndex, sal_True );
      46                 :          2 :     }
      47                 :            : 
      48                 :            :     //--------------------------------------------------------------------
      49                 :          0 :     sal_Bool SAL_CALL OCommonAccessibleSelection::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
      50                 :            :     {
      51                 :          0 :         return( implIsSelected( nChildIndex ) );
      52                 :            :     }
      53                 :            : 
      54                 :            :     //--------------------------------------------------------------------
      55                 :          2 :     void SAL_CALL OCommonAccessibleSelection::clearAccessibleSelection(  ) throw (RuntimeException)
      56                 :            :     {
      57                 :          2 :         implSelect( ACCESSIBLE_SELECTION_CHILD_ALL, sal_False );
      58                 :          2 :     }
      59                 :            : 
      60                 :            :     //--------------------------------------------------------------------
      61                 :          0 :     void SAL_CALL OCommonAccessibleSelection::selectAllAccessibleChildren(  ) throw (RuntimeException)
      62                 :            :     {
      63                 :          0 :         implSelect( ACCESSIBLE_SELECTION_CHILD_ALL, sal_True );
      64                 :          0 :     }
      65                 :            : 
      66                 :            :     //--------------------------------------------------------------------
      67                 :          0 :     sal_Int32 SAL_CALL OCommonAccessibleSelection::getSelectedAccessibleChildCount(  ) throw (RuntimeException)
      68                 :            :     {
      69                 :          0 :         sal_Int32                       nRet = 0;
      70         [ #  # ]:          0 :         Reference< XAccessibleContext > xParentContext( implGetAccessibleContext() );
      71                 :            : 
      72                 :            :         OSL_ENSURE( xParentContext.is(), "OCommonAccessibleSelection::getSelectedAccessibleChildCount: no parent context!" );
      73                 :            : 
      74         [ #  # ]:          0 :         if( xParentContext.is() )
      75                 :            :         {
      76 [ #  # ][ #  # ]:          0 :             for( sal_Int32 i = 0, nChildCount = xParentContext->getAccessibleChildCount(); i < nChildCount; i++ )
                 [ #  # ]
      77 [ #  # ][ #  # ]:          0 :                 if( implIsSelected( i ) )
      78                 :          0 :                     ++nRet;
      79                 :            :         }
      80                 :            : 
      81                 :          0 :         return( nRet );
      82                 :            :     }
      83                 :            : 
      84                 :            :     //--------------------------------------------------------------------
      85                 :          0 :     Reference< XAccessible > SAL_CALL OCommonAccessibleSelection::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
      86                 :            :     {
      87                 :          0 :         Reference< XAccessible >        xRet;
      88         [ #  # ]:          0 :         Reference< XAccessibleContext > xParentContext( implGetAccessibleContext() );
      89                 :            : 
      90                 :            :         OSL_ENSURE( xParentContext.is(), "OCommonAccessibleSelection::getSelectedAccessibleChildCount: no parent context!" );
      91                 :            : 
      92         [ #  # ]:          0 :         if( xParentContext.is() )
      93                 :            :         {
      94 [ #  # ][ #  # ]:          0 :             for( sal_Int32 i = 0, nChildCount = xParentContext->getAccessibleChildCount(), nPos = 0; ( i < nChildCount ) && !xRet.is(); i++ )
         [ #  # ][ #  # ]
                 [ #  # ]
      95 [ #  # ][ #  # ]:          0 :                 if( implIsSelected( i ) && ( nPos++ == nSelectedChildIndex ) )
         [ #  # ][ #  # ]
      96 [ #  # ][ #  # ]:          0 :                     xRet = xParentContext->getAccessibleChild( i );
                 [ #  # ]
      97                 :            :         }
      98                 :            : 
      99                 :          0 :         return( xRet );
     100                 :            :     }
     101                 :            : 
     102                 :            :     //--------------------------------------------------------------------
     103                 :          0 :     void SAL_CALL OCommonAccessibleSelection::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     104                 :            :     {
     105                 :          0 :         implSelect( nSelectedChildIndex, sal_False );
     106                 :          0 :     }
     107                 :            : 
     108                 :            :     //=====================================================================
     109                 :            :     //= OAccessibleSelectionHelper
     110                 :            :     //=====================================================================
     111                 :            :     //--------------------------------------------------------------------
     112         [ #  # ]:          0 :     OAccessibleSelectionHelper::OAccessibleSelectionHelper( IMutex* _pExternalLock ) : OAccessibleComponentHelper(_pExternalLock)
     113                 :            :     {
     114                 :          0 :     }
     115                 :            : 
     116                 :            :     //--------------------------------------------------------------------
     117 [ #  # ][ #  # ]:          0 :     IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleSelectionHelper, OAccessibleComponentHelper, OAccessibleSelectionHelper_Base )
     118 [ #  # ][ #  # ]:          0 :     IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleSelectionHelper, OAccessibleComponentHelper, OAccessibleSelectionHelper_Base )
                 [ #  # ]
     119                 :            :     // (order matters: the first is the class name, the second is the class doing the ref counting)
     120                 :            : 
     121                 :            :     //--------------------------------------------------------------------
     122                 :          0 :     Reference< XAccessibleContext > OAccessibleSelectionHelper::implGetAccessibleContext() throw ( RuntimeException )
     123                 :            :     {
     124                 :          0 :         return( this );
     125                 :            :     }
     126                 :            : 
     127                 :            :     //--------------------------------------------------------------------
     128                 :          0 :     void SAL_CALL OAccessibleSelectionHelper::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     129                 :            :     {
     130         [ #  # ]:          0 :         OExternalLockGuard aGuard( this );
     131 [ #  # ][ #  # ]:          0 :         OCommonAccessibleSelection::selectAccessibleChild( nChildIndex );
     132                 :          0 :     }
     133                 :            : 
     134                 :            :     //--------------------------------------------------------------------
     135                 :          0 :     sal_Bool SAL_CALL OAccessibleSelectionHelper::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     136                 :            :     {
     137         [ #  # ]:          0 :         OExternalLockGuard aGuard( this );
     138 [ #  # ][ #  # ]:          0 :         return( OCommonAccessibleSelection::isAccessibleChildSelected( nChildIndex ) );
     139                 :            :     }
     140                 :            : 
     141                 :            :     //--------------------------------------------------------------------
     142                 :          0 :     void SAL_CALL OAccessibleSelectionHelper::clearAccessibleSelection(  ) throw (RuntimeException)
     143                 :            :     {
     144         [ #  # ]:          0 :         OExternalLockGuard aGuard( this );
     145 [ #  # ][ #  # ]:          0 :         OCommonAccessibleSelection::clearAccessibleSelection();
     146                 :          0 :     }
     147                 :            : 
     148                 :            :     //--------------------------------------------------------------------
     149                 :          0 :     void SAL_CALL OAccessibleSelectionHelper::selectAllAccessibleChildren(  ) throw (RuntimeException)
     150                 :            :     {
     151         [ #  # ]:          0 :         OExternalLockGuard aGuard( this );
     152 [ #  # ][ #  # ]:          0 :         OCommonAccessibleSelection::selectAllAccessibleChildren();
     153                 :          0 :     }
     154                 :            : 
     155                 :            :     //--------------------------------------------------------------------
     156                 :          0 :     sal_Int32 SAL_CALL OAccessibleSelectionHelper::getSelectedAccessibleChildCount(  ) throw (RuntimeException)
     157                 :            :     {
     158         [ #  # ]:          0 :         OExternalLockGuard aGuard( this );
     159 [ #  # ][ #  # ]:          0 :         return( OCommonAccessibleSelection::getSelectedAccessibleChildCount() );
     160                 :            :     }
     161                 :            : 
     162                 :            :     //--------------------------------------------------------------------
     163                 :          0 :     Reference< XAccessible > SAL_CALL OAccessibleSelectionHelper::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     164                 :            :     {
     165         [ #  # ]:          0 :         OExternalLockGuard aGuard( this );
     166 [ #  # ][ #  # ]:          0 :         return( OCommonAccessibleSelection::getSelectedAccessibleChild( nSelectedChildIndex ) );
     167                 :            :     }
     168                 :            : 
     169                 :            :     //--------------------------------------------------------------------
     170                 :          0 :     void SAL_CALL OAccessibleSelectionHelper::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     171                 :            :     {
     172         [ #  # ]:          0 :         OExternalLockGuard aGuard( this );
     173 [ #  # ][ #  # ]:          0 :         OCommonAccessibleSelection::deselectAccessibleChild( nSelectedChildIndex );
     174                 :          0 :     }
     175                 :            : 
     176                 :            : //.........................................................................
     177                 :            : }   // namespace comphelper
     178                 :            : //.........................................................................
     179                 :            : 
     180                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10