LCOV - code coverage report
Current view: top level - accessibility/source/extended - AccessibleGridControlHeader.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 96 1.0 %
Date: 2014-11-03 Functions: 2 26 7.7 %
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 :     bool bConverted = m_aTable.ConvertPointToCellAddress(nRow, nColumnPos, VCLPoint(rPoint));
     108           0 :     return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >();
     109             : }
     110             : 
     111           0 : void SAL_CALL AccessibleGridControlHeader::grabFocus()
     112             :     throw ( uno::RuntimeException, std::exception )
     113             : {
     114           0 :     ensureIsAlive();
     115             :     // focus on header not supported
     116           0 : }
     117             : 
     118             : // XAccessibleTable -----------------------------------------------------------
     119             : 
     120           0 : OUString SAL_CALL AccessibleGridControlHeader::getAccessibleRowDescription( sal_Int32 nRow )
     121             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     122             : {
     123           0 :     SolarMutexGuard aSolarGuard;
     124             : 
     125           0 :     ensureIsAlive();
     126           0 :     ensureIsValidRow( nRow );
     127           0 :     return OUString();  // no headers in headers
     128             : }
     129             : 
     130           0 : OUString SAL_CALL AccessibleGridControlHeader::getAccessibleColumnDescription( sal_Int32 nColumn )
     131             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     132             : {
     133           0 :     SolarMutexGuard aSolarGuard;
     134             : 
     135           0 :     ensureIsAlive();
     136           0 :     ensureIsValidColumn( nColumn );
     137           0 :     return OUString();  // no headers in headers
     138             : }
     139             : 
     140           0 : Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleRowHeaders()
     141             :     throw ( uno::RuntimeException, std::exception )
     142             : {
     143           0 :     SolarMutexGuard g;
     144             : 
     145           0 :     ensureIsAlive();
     146           0 :     return NULL;        // no headers in headers
     147             : }
     148             : 
     149           0 : Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleColumnHeaders()
     150             :     throw ( uno::RuntimeException, std::exception )
     151             : {
     152           0 :     SolarMutexGuard g;
     153             : 
     154           0 :     ensureIsAlive();
     155           0 :     return NULL;        // no headers in headers
     156             : }
     157             : //not selectable
     158           0 : Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleRows()
     159             :     throw ( uno::RuntimeException, std::exception )
     160             : {
     161           0 :     Sequence< sal_Int32 > aSelSeq(0);
     162           0 :     return aSelSeq;
     163             : }
     164             : //columns aren't selectable
     165           0 : Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleColumns()
     166             :     throw ( uno::RuntimeException, std::exception )
     167             : {
     168           0 :     Sequence< sal_Int32 > aSelSeq(0);
     169           0 :     return aSelSeq;
     170             : }
     171             : //row headers not selectable
     172           0 : sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleRowSelected( sal_Int32 /*nRow*/ )
     173             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     174             : {
     175           0 :     return false;
     176             : }
     177             : //columns aren't selectable
     178           0 : sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleColumnSelected( sal_Int32 nColumn )
     179             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     180             : {
     181             :     (void)nColumn;
     182           0 :     return false;
     183             : }
     184             : //not implemented
     185           0 : Reference< XAccessible > SAL_CALL AccessibleGridControlHeader::getAccessibleCellAt(
     186             :         sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ )
     187             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     188             : {
     189           0 :     return NULL;
     190             : }
     191             : // not selectable
     192           0 : sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleSelected(
     193             :         sal_Int32 /*nRow*/, sal_Int32 /*nColumn */)
     194             :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception )
     195             : {
     196           0 :     return false;
     197             : }
     198             : 
     199             : // XServiceInfo ---------------------------------------------------------------
     200             : 
     201           0 : OUString SAL_CALL AccessibleGridControlHeader::getImplementationName()
     202             :     throw ( uno::RuntimeException, std::exception )
     203             : {
     204           0 :     return OUString( "com.sun.star.accessibility.AccessibleGridControlHeader" );
     205             : }
     206             : 
     207           0 : Sequence< sal_Int8 > SAL_CALL AccessibleGridControlHeader::getImplementationId()
     208             :     throw ( uno::RuntimeException, std::exception )
     209             : {
     210           0 :     return css::uno::Sequence<sal_Int8>();
     211             : }
     212             : 
     213             : // internal virtual methods ---------------------------------------------------
     214             : 
     215           0 : Rectangle AccessibleGridControlHeader::implGetBoundingBox()
     216             : {
     217           0 :     vcl::Window* pParent = m_aTable.GetAccessibleParentWindow();
     218           0 :     Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent ) );
     219           0 :     Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar()));
     220           0 :     if(isColumnBar())
     221           0 :         return Rectangle(aGridRect.TopLeft(), Size(aGridRect.getWidth(),aHeaderRect.getHeight()));
     222             :     else
     223           0 :         return Rectangle(aGridRect.TopLeft(), Size(aHeaderRect.getWidth(),aGridRect.getHeight()));
     224             : 
     225             : }
     226             : 
     227           0 : Rectangle AccessibleGridControlHeader::implGetBoundingBoxOnScreen()
     228             : {
     229           0 :     Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( NULL ) );
     230           0 :     Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar()));
     231           0 :     if(isColumnBar())
     232           0 :         return Rectangle(aGridRect.TopLeft(), Size(aGridRect.getWidth(),aHeaderRect.getHeight()));
     233             :     else
     234           0 :         return Rectangle(aGridRect.TopLeft(), Size(aHeaderRect.getWidth(),aGridRect.getHeight()));
     235             : }
     236             : 
     237           0 : sal_Int32 AccessibleGridControlHeader::implGetRowCount() const
     238             : {
     239           0 :     return 1;
     240             : }
     241             : 
     242           0 : sal_Int32 AccessibleGridControlHeader::implGetColumnCount() const
     243             : {
     244           0 :     return 1;
     245             : }
     246             : 
     247             : // internal helper methods ----------------------------------------------------
     248             : 
     249           0 : Reference< XAccessible > AccessibleGridControlHeader::implGetChild(
     250             :         sal_Int32 nRow, sal_uInt32 nColumnPos )
     251             : {
     252           0 :     Reference< XAccessible > xChild;
     253           0 :     if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR)
     254             :     {
     255           0 :         AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nColumnPos, this, m_aTable, svt::table::TCTYPE_COLUMNHEADERCELL);
     256           0 :         xChild = pColHeaderCell;
     257             :     }
     258           0 :     else if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR)
     259             :     {
     260           0 :         AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nRow, this, m_aTable, svt::table::TCTYPE_ROWHEADERCELL);
     261           0 :         xChild = pRowHeaderCell;
     262             :     }
     263           0 :     return xChild;
     264             : }
     265             : 
     266             : 
     267             : 
     268          60 : } // namespace accessibility
     269             : 
     270             : 
     271             : 
     272             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10