LCOV - code coverage report
Current view: top level - accessibility/source/extended - AccessibleGridControlHeader.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 97 0.0 %
Date: 2014-04-14 Functions: 0 24 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/AccessibleGridControlHeader.hxx"
      21             : #include "accessibility/extended/AccessibleGridControlHeaderCell.hxx"
      22             : #include "accessibility/extended/AccessibleGridControlTableCell.hxx"
      23             : #include <svtools/accessibletable.hxx>
      24             : #include <comphelper/servicehelper.hxx>
      25             : 
      26             : 
      27             : 
      28             : 
      29             : using ::com::sun::star::uno::Reference;
      30             : using ::com::sun::star::uno::Sequence;
      31             : using ::com::sun::star::uno::Any;
      32             : 
      33             : using namespace ::com::sun::star::uno;
      34             : using namespace ::com::sun::star;
      35             : using namespace ::com::sun::star::lang;
      36             : using namespace ::com::sun::star::accessibility;
      37             : using namespace ::svt;
      38             : using namespace ::svt::table;
      39             : 
      40             : 
      41             : 
      42             : namespace accessibility {
      43             : 
      44             : 
      45             : 
      46           0 : AccessibleGridControlHeader::AccessibleGridControlHeader(
      47             :         const Reference< XAccessible >& rxParent,
      48             :         ::svt::table::IAccessibleTable&                      rTable,
      49             :         ::svt::table::AccessibleTableControlObjType      eObjType):
      50           0 :         AccessibleGridControlTableBase( rxParent, rTable, eObjType )
      51             : {
      52             :     OSL_ENSURE( isRowBar() || isColumnBar(),
      53             :         "accessibility/extended/AccessibleGridControlHeaderBar - invalid object type" );
      54           0 : }
      55             : 
      56           0 : AccessibleGridControlHeader::~AccessibleGridControlHeader()
      57             : {
      58           0 : }
      59             : 
      60             : // XAccessibleContext ---------------------------------------------------------
      61             : 
      62             : Reference< XAccessible > SAL_CALL
      63           0 : AccessibleGridControlHeader::getAccessibleChild( sal_Int32 nChildIndex )
      64             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
      65             : {
      66           0 :     SolarMutexGuard aSolarGuard;
      67             : 
      68           0 :     if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount())
      69           0 :         throw IndexOutOfBoundsException();
      70           0 :     ensureIsAlive();
      71           0 :     Reference< XAccessible > xChild;
      72           0 :     if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR)
      73             :     {
      74           0 :         AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, svt::table::TCTYPE_COLUMNHEADERCELL);
      75           0 :         xChild = pColHeaderCell;
      76             :     }
      77           0 :     else if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR)
      78             :     {
      79           0 :         AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, svt::table::TCTYPE_ROWHEADERCELL);
      80           0 :         xChild = pRowHeaderCell;
      81             :     }
      82           0 :     return xChild;
      83             : }
      84             : 
      85           0 : sal_Int32 SAL_CALL AccessibleGridControlHeader::getAccessibleIndexInParent()
      86             :     throw ( uno::RuntimeException, std::exception )
      87             : {
      88           0 :      ensureIsAlive();
      89           0 :      if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR && m_aTable.HasColHeader())
      90           0 :          return 1;
      91             :      else
      92           0 :          return 0;
      93             : }
      94             : 
      95             : // XAccessibleComponent -------------------------------------------------------
      96             : 
      97             : Reference< XAccessible > SAL_CALL
      98           0 : AccessibleGridControlHeader::getAccessibleAtPoint( const awt::Point& rPoint )
      99             :     throw ( uno::RuntimeException, std::exception )
     100             : {
     101           0 :     SolarMutexGuard aSolarGuard;
     102             : 
     103           0 :     ensureIsAlive();
     104             : 
     105           0 :     sal_Int32 nRow = 0;
     106           0 :     sal_Int32 nColumnPos = 0;
     107           0 :     sal_Bool bConverted = isRowBar() ?
     108           0 :     m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) :
     109           0 :     m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) );
     110             : 
     111           0 :     return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >();
     112             : }
     113             : 
     114           0 : void SAL_CALL AccessibleGridControlHeader::grabFocus()
     115             :     throw ( uno::RuntimeException, std::exception )
     116             : {
     117           0 :     ensureIsAlive();
     118             :     // focus on header not supported
     119           0 : }
     120             : 
     121             : // XAccessibleTable -----------------------------------------------------------
     122             : 
     123           0 : OUString SAL_CALL AccessibleGridControlHeader::getAccessibleRowDescription( sal_Int32 nRow )
     124             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     125             : {
     126           0 :     SolarMutexGuard aSolarGuard;
     127             : 
     128           0 :     ensureIsAlive();
     129           0 :     ensureIsValidRow( nRow );
     130           0 :     return OUString();  // no headers in headers
     131             : }
     132             : 
     133           0 : OUString SAL_CALL AccessibleGridControlHeader::getAccessibleColumnDescription( sal_Int32 nColumn )
     134             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     135             : {
     136           0 :     SolarMutexGuard aSolarGuard;
     137             : 
     138           0 :     ensureIsAlive();
     139           0 :     ensureIsValidColumn( nColumn );
     140           0 :     return OUString();  // no headers in headers
     141             : }
     142             : 
     143           0 : Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleRowHeaders()
     144             :     throw ( uno::RuntimeException, std::exception )
     145             : {
     146           0 :     SolarMutexGuard g;
     147             : 
     148           0 :     ensureIsAlive();
     149           0 :     return NULL;        // no headers in headers
     150             : }
     151             : 
     152           0 : Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleColumnHeaders()
     153             :     throw ( uno::RuntimeException, std::exception )
     154             : {
     155           0 :     SolarMutexGuard g;
     156             : 
     157           0 :     ensureIsAlive();
     158           0 :     return NULL;        // no headers in headers
     159             : }
     160             : //not selectable
     161           0 : Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleRows()
     162             :     throw ( uno::RuntimeException, std::exception )
     163             : {
     164           0 :     Sequence< sal_Int32 > aSelSeq(0);
     165           0 :     return aSelSeq;
     166             : }
     167             : //columns aren't selectable
     168           0 : Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleColumns()
     169             :     throw ( uno::RuntimeException, std::exception )
     170             : {
     171           0 :     Sequence< sal_Int32 > aSelSeq(0);
     172           0 :     return aSelSeq;
     173             : }
     174             : //row headers not selectable
     175           0 : sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleRowSelected( sal_Int32 /*nRow*/ )
     176             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     177             : {
     178           0 :     return sal_False;
     179             : }
     180             : //columns aren't selectable
     181           0 : sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleColumnSelected( sal_Int32 nColumn )
     182             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     183             : {
     184             :     (void)nColumn;
     185           0 :     return sal_False;
     186             : }
     187             : //not implemented
     188           0 : Reference< XAccessible > SAL_CALL AccessibleGridControlHeader::getAccessibleCellAt(
     189             :         sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ )
     190             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     191             : {
     192           0 :     return NULL;
     193             : }
     194             : // not selectable
     195           0 : sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleSelected(
     196             :         sal_Int32 /*nRow*/, sal_Int32 /*nColumn */)
     197             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     198             : {
     199           0 :     return sal_False;
     200             : }
     201             : 
     202             : // XServiceInfo ---------------------------------------------------------------
     203             : 
     204           0 : OUString SAL_CALL AccessibleGridControlHeader::getImplementationName()
     205             :     throw ( uno::RuntimeException, std::exception )
     206             : {
     207           0 :     return OUString( "com.sun.star.accessibility.AccessibleGridControlHeader" );
     208             : }
     209             : 
     210           0 : Sequence< sal_Int8 > SAL_CALL AccessibleGridControlHeader::getImplementationId()
     211             :     throw ( uno::RuntimeException, std::exception )
     212             : {
     213           0 :     return css::uno::Sequence<sal_Int8>();
     214             : }
     215             : 
     216             : // internal virtual methods ---------------------------------------------------
     217             : 
     218           0 : Rectangle AccessibleGridControlHeader::implGetBoundingBox()
     219             : {
     220           0 :     Window* pParent = m_aTable.GetAccessibleParentWindow();
     221           0 :     Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent ) );
     222           0 :     Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar()));
     223           0 :     if(isColumnBar())
     224           0 :         return Rectangle(aGridRect.TopLeft(), Size(aGridRect.getWidth(),aHeaderRect.getHeight()));
     225             :     else
     226           0 :         return Rectangle(aGridRect.TopLeft(), Size(aHeaderRect.getWidth(),aGridRect.getHeight()));
     227             : 
     228             : }
     229             : 
     230           0 : Rectangle AccessibleGridControlHeader::implGetBoundingBoxOnScreen()
     231             : {
     232           0 :     Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( NULL ) );
     233           0 :     Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar()));
     234           0 :     if(isColumnBar())
     235           0 :         return Rectangle(aGridRect.TopLeft(), Size(aGridRect.getWidth(),aHeaderRect.getHeight()));
     236             :     else
     237           0 :         return Rectangle(aGridRect.TopLeft(), Size(aHeaderRect.getWidth(),aGridRect.getHeight()));
     238             : }
     239             : 
     240           0 : sal_Int32 AccessibleGridControlHeader::implGetRowCount() const
     241             : {
     242           0 :     return 1;
     243             : }
     244             : 
     245           0 : sal_Int32 AccessibleGridControlHeader::implGetColumnCount() const
     246             : {
     247           0 :     return 1;
     248             : }
     249             : 
     250             : // internal helper methods ----------------------------------------------------
     251             : 
     252           0 : Reference< XAccessible > AccessibleGridControlHeader::implGetChild(
     253             :         sal_Int32 nRow, sal_uInt32 nColumnPos )
     254             : {
     255           0 :     Reference< XAccessible > xChild;
     256           0 :     if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR)
     257             :     {
     258           0 :         AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nColumnPos, this, m_aTable, svt::table::TCTYPE_COLUMNHEADERCELL);
     259           0 :         xChild = pColHeaderCell;
     260             :     }
     261           0 :     else if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR)
     262             :     {
     263           0 :         AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nRow, this, m_aTable, svt::table::TCTYPE_ROWHEADERCELL);
     264           0 :         xChild = pRowHeaderCell;
     265             :     }
     266           0 :     return xChild;
     267             : }
     268             : 
     269             : 
     270             : 
     271             : } // namespace accessibility
     272             : 
     273             : 
     274             : 
     275             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10