LCOV - code coverage report
Current view: top level - accessibility/source/extended - AccessibleGridControlTableBase.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 112 0.0 %
Date: 2012-08-25 Functions: 0 28 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 158 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "accessibility/extended/AccessibleGridControlTableBase.hxx"
      30                 :            : #include <svtools/accessibletable.hxx>
      31                 :            : #include <tools/multisel.hxx>
      32                 :            : #include <comphelper/sequence.hxx>
      33                 :            : #include <comphelper/servicehelper.hxx>
      34                 :            : 
      35                 :            : // ============================================================================
      36                 :            : 
      37                 :            : using ::rtl::OUString;
      38                 :            : 
      39                 :            : using ::com::sun::star::uno::Reference;
      40                 :            : using ::com::sun::star::uno::Sequence;
      41                 :            : using ::com::sun::star::uno::Any;
      42                 :            : 
      43                 :            : using namespace ::com::sun::star;
      44                 :            : using namespace ::com::sun::star::accessibility;
      45                 :            : using namespace ::svt;
      46                 :            : using namespace ::svt::table;
      47                 :            : 
      48                 :            : // ============================================================================
      49                 :            : 
      50                 :            : namespace accessibility {
      51                 :            : 
      52                 :            : // ============================================================================
      53                 :            : 
      54                 :          0 : AccessibleGridControlTableBase::AccessibleGridControlTableBase(
      55                 :            :         const Reference< XAccessible >& rxParent,
      56                 :            :         IAccessibleTable& rTable,
      57                 :            :         AccessibleTableControlObjType eObjType ) :
      58                 :          0 :     GridControlAccessibleElement( rxParent, rTable, eObjType )
      59                 :            : {
      60                 :          0 : }
      61                 :            : 
      62                 :          0 : AccessibleGridControlTableBase::~AccessibleGridControlTableBase()
      63                 :            : {
      64         [ #  # ]:          0 : }
      65                 :            : 
      66                 :            : // XAccessibleContext ---------------------------------------------------------
      67                 :            : 
      68                 :          0 : sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleChildCount()
      69                 :            :     throw ( uno::RuntimeException )
      70                 :            : {
      71         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
      72         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
      73         [ #  # ]:          0 :     ensureIsAlive();
      74                 :          0 :     sal_Int32 nChildren = 0;
      75         [ #  # ]:          0 :     if(m_eObjType == TCTYPE_ROWHEADERBAR)
      76         [ #  # ]:          0 :         nChildren = m_aTable.GetRowCount();
      77         [ #  # ]:          0 :     else if(m_eObjType == TCTYPE_TABLE)
      78 [ #  # ][ #  # ]:          0 :         nChildren = m_aTable.GetRowCount()*m_aTable.GetColumnCount();
      79         [ #  # ]:          0 :     else if(m_eObjType == TCTYPE_COLUMNHEADERBAR)
      80         [ #  # ]:          0 :         nChildren = m_aTable.GetColumnCount();
      81 [ #  # ][ #  # ]:          0 :     return nChildren;
      82                 :            : }
      83                 :            : 
      84                 :          0 : sal_Int16 SAL_CALL AccessibleGridControlTableBase::getAccessibleRole()
      85                 :            :     throw ( uno::RuntimeException )
      86                 :            : {
      87                 :          0 :     ensureIsAlive();
      88                 :          0 :     return AccessibleRole::TABLE;
      89                 :            : }
      90                 :            : 
      91                 :            : // XAccessibleTable -----------------------------------------------------------
      92                 :            : 
      93                 :          0 : sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRowCount()
      94                 :            :     throw ( uno::RuntimeException )
      95                 :            : {
      96         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
      97         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
      98         [ #  # ]:          0 :     ensureIsAlive();
      99 [ #  # ][ #  # ]:          0 :     return  m_aTable.GetRowCount();
                 [ #  # ]
     100                 :            : }
     101                 :            : 
     102                 :          0 : sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnCount()
     103                 :            :     throw ( uno::RuntimeException )
     104                 :            : {
     105         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     106         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     107         [ #  # ]:          0 :     ensureIsAlive();
     108 [ #  # ][ #  # ]:          0 :     return m_aTable.GetColumnCount();
                 [ #  # ]
     109                 :            : }
     110                 :            : 
     111                 :          0 : sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRowExtentAt(
     112                 :            :         sal_Int32 nRow, sal_Int32 nColumn )
     113                 :            :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
     114                 :            : {
     115         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     116         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     117         [ #  # ]:          0 :     ensureIsAlive();
     118         [ #  # ]:          0 :     ensureIsValidAddress( nRow, nColumn );
     119 [ #  # ][ #  # ]:          0 :     return 1;   // merged cells not supported
     120                 :            : }
     121                 :            : 
     122                 :          0 : sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnExtentAt(
     123                 :            :         sal_Int32 nRow, sal_Int32 nColumn )
     124                 :            :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
     125                 :            : {
     126         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     127         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     128         [ #  # ]:          0 :     ensureIsAlive();
     129         [ #  # ]:          0 :     ensureIsValidAddress( nRow, nColumn );
     130 [ #  # ][ #  # ]:          0 :     return 1;   // merged cells not supported
     131                 :            : }
     132                 :            : 
     133                 :          0 : Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleCaption()
     134                 :            :     throw ( uno::RuntimeException )
     135                 :            : {
     136                 :          0 :     ensureIsAlive();
     137                 :          0 :     return NULL;    // not supported
     138                 :            : }
     139                 :            : 
     140                 :          0 : Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleSummary()
     141                 :            :     throw ( uno::RuntimeException )
     142                 :            : {
     143                 :          0 :     ensureIsAlive();
     144                 :          0 :     return NULL;    // not supported
     145                 :            : }
     146                 :            : 
     147                 :          0 : sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleIndex(
     148                 :            :         sal_Int32 nRow, sal_Int32 nColumn )
     149                 :            :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
     150                 :            : {
     151         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     152         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     153         [ #  # ]:          0 :     ensureIsAlive();
     154         [ #  # ]:          0 :     ensureIsValidAddress( nRow, nColumn );
     155 [ #  # ][ #  # ]:          0 :     return implGetChildIndex( nRow, nColumn );
                 [ #  # ]
     156                 :            : }
     157                 :            : 
     158                 :          0 : sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRow( sal_Int32 nChildIndex )
     159                 :            :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
     160                 :            : {
     161         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     162         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     163         [ #  # ]:          0 :     ensureIsAlive();
     164         [ #  # ]:          0 :     ensureIsValidIndex( nChildIndex );
     165 [ #  # ][ #  # ]:          0 :     return implGetRow( nChildIndex );
                 [ #  # ]
     166                 :            : }
     167                 :            : 
     168                 :          0 : sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumn( sal_Int32 nChildIndex )
     169                 :            :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
     170                 :            : {
     171         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     172         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     173         [ #  # ]:          0 :     ensureIsAlive();
     174         [ #  # ]:          0 :     ensureIsValidIndex( nChildIndex );
     175 [ #  # ][ #  # ]:          0 :     return implGetColumn( nChildIndex );
                 [ #  # ]
     176                 :            : }
     177                 :            : 
     178                 :            : // XInterface -----------------------------------------------------------------
     179                 :            : 
     180                 :          0 : Any SAL_CALL AccessibleGridControlTableBase::queryInterface( const uno::Type& rType )
     181                 :            :     throw ( uno::RuntimeException )
     182                 :            : {
     183         [ #  # ]:          0 :     Any aAny( GridControlAccessibleElement::queryInterface( rType ) );
     184                 :          0 :     return aAny.hasValue() ?
     185 [ #  # ][ #  # ]:          0 :         aAny : AccessibleGridControlTableImplHelper::queryInterface( rType );
     186                 :            : }
     187                 :            : 
     188                 :          0 : void SAL_CALL AccessibleGridControlTableBase::acquire() throw ()
     189                 :            : {
     190                 :          0 :     GridControlAccessibleElement::acquire();
     191                 :          0 : }
     192                 :            : 
     193                 :          0 : void SAL_CALL AccessibleGridControlTableBase::release() throw ()
     194                 :            : {
     195                 :          0 :     GridControlAccessibleElement::release();
     196                 :          0 : }
     197                 :            : 
     198                 :            : // XTypeProvider --------------------------------------------------------------
     199                 :            : 
     200                 :          0 : Sequence< uno::Type > SAL_CALL AccessibleGridControlTableBase::getTypes()
     201                 :            :     throw ( uno::RuntimeException )
     202                 :            : {
     203                 :            :     return ::comphelper::concatSequences(
     204                 :            :         GridControlAccessibleElement::getTypes(),
     205 [ #  # ][ #  # ]:          0 :         AccessibleGridControlTableImplHelper::getTypes() );
                 [ #  # ]
     206                 :            : }
     207                 :            : 
     208                 :            : namespace
     209                 :            : {
     210                 :            :     class theAccessibleGridControlTableBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleGridControlTableBaseImplementationId > {};
     211                 :            : }
     212                 :            : 
     213                 :          0 : Sequence< sal_Int8 > SAL_CALL AccessibleGridControlTableBase::getImplementationId()
     214                 :            :     throw ( uno::RuntimeException )
     215                 :            : {
     216                 :          0 :     return theAccessibleGridControlTableBaseImplementationId::get().getSeq();
     217                 :            : }
     218                 :            : 
     219                 :            : // internal helper methods ----------------------------------------------------
     220                 :            : 
     221                 :          0 : sal_Int32 AccessibleGridControlTableBase::implGetChildCount() const
     222                 :            : {
     223                 :          0 :     return m_aTable.GetRowCount()*m_aTable.GetColumnCount();
     224                 :            : }
     225                 :            : 
     226                 :          0 : sal_Int32 AccessibleGridControlTableBase::implGetRow( sal_Int32 nChildIndex ) const
     227                 :            : {
     228                 :          0 :     sal_Int32 nColumns = m_aTable.GetColumnCount();
     229         [ #  # ]:          0 :     return nColumns ? (nChildIndex / nColumns) : 0;
     230                 :            : }
     231                 :            : 
     232                 :          0 : sal_Int32 AccessibleGridControlTableBase::implGetColumn( sal_Int32 nChildIndex ) const
     233                 :            : {
     234                 :          0 :     sal_Int32 nColumns = m_aTable.GetColumnCount();
     235         [ #  # ]:          0 :     return nColumns ? (nChildIndex % nColumns) : 0;
     236                 :            : }
     237                 :            : 
     238                 :          0 : sal_Int32 AccessibleGridControlTableBase::implGetChildIndex(
     239                 :            :         sal_Int32 nRow, sal_Int32 nColumn ) const
     240                 :            : {
     241                 :          0 :     return nRow * m_aTable.GetColumnCount() + nColumn;
     242                 :            : }
     243                 :            : 
     244                 :          0 : void AccessibleGridControlTableBase::implGetSelectedRows( Sequence< sal_Int32 >& rSeq )
     245                 :            : {
     246                 :          0 :     sal_Int32 const selectionCount( m_aTable.GetSelectedRowCount() );
     247                 :          0 :     rSeq.realloc( selectionCount );
     248         [ #  # ]:          0 :     for ( sal_Int32 i=0; i<selectionCount; ++i )
     249                 :          0 :         rSeq[i] = m_aTable.GetSelectedRowIndex(i);
     250                 :          0 : }
     251                 :            : 
     252                 :          0 : void AccessibleGridControlTableBase::ensureIsValidRow( sal_Int32 nRow )
     253                 :            :     throw ( lang::IndexOutOfBoundsException )
     254                 :            : {
     255         [ #  # ]:          0 :     if( nRow >= m_aTable.GetRowCount() )
     256                 :            :         throw lang::IndexOutOfBoundsException(
     257 [ #  # ][ #  # ]:          0 :             OUString( RTL_CONSTASCII_USTRINGPARAM( "row index is invalid" ) ), *this );
                 [ #  # ]
     258                 :          0 : }
     259                 :            : 
     260                 :          0 : void AccessibleGridControlTableBase::ensureIsValidColumn( sal_Int32 nColumn )
     261                 :            :     throw ( lang::IndexOutOfBoundsException )
     262                 :            : {
     263         [ #  # ]:          0 :     if( nColumn >= m_aTable.GetColumnCount() )
     264                 :            :         throw lang::IndexOutOfBoundsException(
     265 [ #  # ][ #  # ]:          0 :             OUString( RTL_CONSTASCII_USTRINGPARAM("column index is invalid") ), *this );
                 [ #  # ]
     266                 :          0 : }
     267                 :            : 
     268                 :          0 : void AccessibleGridControlTableBase::ensureIsValidAddress(
     269                 :            :         sal_Int32 nRow, sal_Int32 nColumn )
     270                 :            :     throw ( lang::IndexOutOfBoundsException )
     271                 :            : {
     272                 :          0 :     ensureIsValidRow( nRow );
     273                 :          0 :     ensureIsValidColumn( nColumn );
     274                 :          0 : }
     275                 :            : 
     276                 :          0 : void AccessibleGridControlTableBase::ensureIsValidIndex( sal_Int32 nChildIndex )
     277                 :            :     throw ( lang::IndexOutOfBoundsException )
     278                 :            : {
     279         [ #  # ]:          0 :     if( nChildIndex >= implGetChildCount() )
     280                 :            :         throw lang::IndexOutOfBoundsException(
     281 [ #  # ][ #  # ]:          0 :             OUString( RTL_CONSTASCII_USTRINGPARAM("child index is invalid") ), *this );
                 [ #  # ]
     282                 :          0 : }
     283                 :            : 
     284                 :            : // ============================================================================
     285                 :            : 
     286                 :            : } // namespace accessibility
     287                 :            : 
     288                 :            : // ============================================================================
     289                 :            : 
     290                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10