LCOV - code coverage report
Current view: top level - accessibility/source/extended - AccessibleBrowseBoxTable.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 101 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 21 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/extended/AccessibleBrowseBoxTable.hxx"
      21             : #include <svtools/accessibletableprovider.hxx>
      22             : 
      23             : 
      24             : 
      25             : using ::com::sun::star::uno::Reference;
      26             : using ::com::sun::star::uno::Sequence;
      27             : using ::com::sun::star::uno::Any;
      28             : 
      29             : using namespace ::com::sun::star;
      30             : using namespace ::com::sun::star::accessibility;
      31             : using namespace ::svt;
      32             : 
      33             : 
      34             : 
      35             : namespace accessibility {
      36             : 
      37             : 
      38             : 
      39             : // Ctor/Dtor/disposing --------------------------------------------------------
      40             : 
      41           0 : AccessibleBrowseBoxTable::AccessibleBrowseBoxTable(
      42             :         const Reference< XAccessible >& rxParent,
      43             :         IAccessibleTableProvider&                      rBrowseBox ) :
      44           0 :     AccessibleBrowseBoxTableBase( rxParent, rBrowseBox, BBTYPE_TABLE )
      45             : {
      46           0 : }
      47             : 
      48           0 : AccessibleBrowseBoxTable::~AccessibleBrowseBoxTable()
      49             : {
      50           0 : }
      51             : 
      52             : // XAccessibleContext ---------------------------------------------------------
      53             : 
      54             : Reference< XAccessible > SAL_CALL
      55           0 : AccessibleBrowseBoxTable::getAccessibleChild( sal_Int32 nChildIndex )
      56             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
      57             : {
      58           0 :     SolarMutexGuard aSolarGuard;
      59           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
      60           0 :     ensureIsAlive();
      61           0 :     ensureIsValidIndex( nChildIndex );
      62             :     return mpBrowseBox->CreateAccessibleCell(
      63           0 :         implGetRow( nChildIndex ), (sal_Int16)implGetColumn( nChildIndex ) );
      64             : }
      65             : 
      66           0 : sal_Int32 SAL_CALL AccessibleBrowseBoxTable::getAccessibleIndexInParent()
      67             :     throw ( uno::RuntimeException, std::exception )
      68             : {
      69           0 :     ensureIsAlive();
      70           0 :     return BBINDEX_TABLE;
      71             : }
      72             : 
      73             : // XAccessibleComponent -------------------------------------------------------
      74             : 
      75             : Reference< XAccessible > SAL_CALL
      76           0 : AccessibleBrowseBoxTable::getAccessibleAtPoint( const awt::Point& rPoint )
      77             :     throw ( uno::RuntimeException, std::exception )
      78             : {
      79           0 :     SolarMutexGuard aSolarGuard;
      80           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
      81           0 :     ensureIsAlive();
      82             : 
      83           0 :     Reference< XAccessible > xChild;
      84           0 :     sal_Int32 nRow = 0;
      85           0 :     sal_uInt16 nColumnPos = 0;
      86           0 :     if( mpBrowseBox->ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) )
      87           0 :         xChild = mpBrowseBox->CreateAccessibleCell( nRow, nColumnPos );
      88             : 
      89           0 :     return xChild;
      90             : }
      91             : 
      92           0 : void SAL_CALL AccessibleBrowseBoxTable::grabFocus()
      93             :     throw ( uno::RuntimeException, std::exception )
      94             : {
      95           0 :     SolarMutexGuard aSolarGuard;
      96           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
      97           0 :     ensureIsAlive();
      98           0 :     mpBrowseBox->GrabTableFocus();
      99           0 : }
     100             : 
     101             : // XAccessibleTable -----------------------------------------------------------
     102             : 
     103           0 : OUString SAL_CALL AccessibleBrowseBoxTable::getAccessibleRowDescription( sal_Int32 nRow )
     104             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     105             : {
     106           0 :     SolarMutexGuard aSolarGuard;
     107           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     108           0 :     ensureIsAlive();
     109           0 :     ensureIsValidRow( nRow );
     110           0 :     return mpBrowseBox->GetRowDescription( nRow );
     111             : }
     112             : 
     113           0 : OUString SAL_CALL AccessibleBrowseBoxTable::getAccessibleColumnDescription( sal_Int32 nColumn )
     114             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     115             : {
     116           0 :     SolarMutexGuard aSolarGuard;
     117           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     118           0 :     ensureIsAlive();
     119           0 :     ensureIsValidColumn( nColumn );
     120           0 :     return mpBrowseBox->GetColumnDescription( (sal_uInt16)nColumn );
     121             : }
     122             : 
     123           0 : Reference< XAccessibleTable > SAL_CALL AccessibleBrowseBoxTable::getAccessibleRowHeaders()
     124             :     throw ( uno::RuntimeException, std::exception )
     125             : {
     126           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     127           0 :     ensureIsAlive();
     128           0 :     return implGetHeaderBar( BBINDEX_ROWHEADERBAR );
     129             : }
     130             : 
     131           0 : Reference< XAccessibleTable > SAL_CALL AccessibleBrowseBoxTable::getAccessibleColumnHeaders()
     132             :     throw ( uno::RuntimeException, std::exception )
     133             : {
     134           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     135           0 :     ensureIsAlive();
     136           0 :     return implGetHeaderBar( BBINDEX_COLUMNHEADERBAR );
     137             : }
     138             : 
     139           0 : Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxTable::getSelectedAccessibleRows()
     140             :     throw ( uno::RuntimeException, std::exception )
     141             : {
     142           0 :     SolarMutexGuard aSolarGuard;
     143           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     144           0 :     ensureIsAlive();
     145             : 
     146           0 :     Sequence< sal_Int32 > aSelSeq;
     147           0 :     implGetSelectedRows( aSelSeq );
     148           0 :     return aSelSeq;
     149             : }
     150             : 
     151           0 : Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxTable::getSelectedAccessibleColumns()
     152             :     throw ( uno::RuntimeException, std::exception )
     153             : {
     154           0 :     SolarMutexGuard aSolarGuard;
     155           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     156           0 :     ensureIsAlive();
     157             : 
     158           0 :     Sequence< sal_Int32 > aSelSeq;
     159           0 :     implGetSelectedColumns( aSelSeq );
     160           0 :     return aSelSeq;
     161             : }
     162             : 
     163           0 : sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleRowSelected( sal_Int32 nRow )
     164             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     165             : {
     166           0 :     SolarMutexGuard aSolarGuard;
     167           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     168           0 :     ensureIsAlive();
     169           0 :     ensureIsValidRow( nRow );
     170           0 :     return implIsRowSelected( nRow );
     171             : }
     172             : 
     173           0 : sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleColumnSelected( sal_Int32 nColumn )
     174             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     175             : {
     176           0 :     SolarMutexGuard aSolarGuard;
     177           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     178           0 :     ensureIsAlive();
     179           0 :     ensureIsValidColumn( nColumn );
     180           0 :     return implIsColumnSelected( nColumn );
     181             : }
     182             : 
     183           0 : Reference< XAccessible > SAL_CALL AccessibleBrowseBoxTable::getAccessibleCellAt(
     184             :         sal_Int32 nRow, sal_Int32 nColumn )
     185             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     186             : {
     187           0 :     SolarMutexGuard aSolarGuard;
     188           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     189           0 :     ensureIsAlive();
     190           0 :     ensureIsValidAddress( nRow, nColumn );
     191           0 :     return mpBrowseBox->CreateAccessibleCell( nRow, (sal_Int16)nColumn );
     192             : }
     193             : 
     194           0 : sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleSelected(
     195             :         sal_Int32 nRow, sal_Int32 nColumn )
     196             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     197             : {
     198           0 :     SolarMutexGuard aSolarGuard;
     199           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     200           0 :     ensureIsAlive();
     201           0 :     ensureIsValidAddress( nRow, nColumn );
     202           0 :     return implIsRowSelected( nRow ) || implIsColumnSelected( nColumn );
     203             : }
     204             : 
     205             : // XServiceInfo ---------------------------------------------------------------
     206             : 
     207           0 : OUString SAL_CALL AccessibleBrowseBoxTable::getImplementationName()
     208             :     throw ( uno::RuntimeException, std::exception )
     209             : {
     210           0 :     return OUString( "com.sun.star.comp.svtools.AccessibleBrowseBoxTable" );
     211             : }
     212             : 
     213             : // internal virtual methods ---------------------------------------------------
     214             : 
     215           0 : Rectangle AccessibleBrowseBoxTable::implGetBoundingBox()
     216             : {
     217           0 :     return mpBrowseBox->calcTableRect(false);
     218             : }
     219             : 
     220           0 : Rectangle AccessibleBrowseBoxTable::implGetBoundingBoxOnScreen()
     221             : {
     222           0 :     return mpBrowseBox->calcTableRect();
     223             : }
     224             : 
     225             : // internal helper methods ----------------------------------------------------
     226             : 
     227           0 : Reference< XAccessibleTable > AccessibleBrowseBoxTable::implGetHeaderBar(
     228             :         sal_Int32 nChildIndex )
     229             :     throw ( uno::RuntimeException )
     230             : {
     231           0 :     Reference< XAccessible > xRet;
     232           0 :     Reference< XAccessibleContext > xContext( mxParent, uno::UNO_QUERY );
     233           0 :     if( xContext.is() )
     234             :     {
     235             :         try
     236             :         {
     237           0 :             xRet = xContext->getAccessibleChild( nChildIndex );
     238             :         }
     239           0 :         catch (const lang::IndexOutOfBoundsException&)
     240             :         {
     241             :             OSL_FAIL( "implGetHeaderBar - wrong child index" );
     242             :         }
     243             :         // RuntimeException goes to caller
     244             :     }
     245           0 :     return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY );
     246             : }
     247             : 
     248             : 
     249             : 
     250             : } // namespace accessibility
     251             : 
     252             : 
     253             : 
     254             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11