LCOV - code coverage report
Current view: top level - accessibility/source/extended - AccessibleBrowseBoxHeaderCell.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 55 0.0 %
Date: 2014-04-14 Functions: 0 10 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             : 
      21             : #include "accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx"
      22             : #include <svtools/accessibletableprovider.hxx>
      23             : #include "accessibility/extended/AccessibleBrowseBox.hxx"
      24             : 
      25             : namespace accessibility
      26             : {
      27             :     using namespace ::com::sun::star::accessibility;
      28             :     using namespace ::com::sun::star::lang;
      29             :     using namespace ::com::sun::star::uno;
      30             :     using namespace ::svt;
      31             : 
      32           0 : AccessibleBrowseBoxHeaderCell::AccessibleBrowseBoxHeaderCell(sal_Int32 _nColumnRowId,
      33             :                                   const Reference< XAccessible >& rxParent,
      34             :                                   IAccessibleTableProvider&                  rBrowseBox,
      35             :                                   const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
      36             :                                   AccessibleBrowseBoxObjType  eObjType)
      37             : : BrowseBoxAccessibleElement(rxParent,
      38             :                           rBrowseBox,
      39             :                           _xFocusWindow,
      40             :                           eObjType,
      41           0 :                           rBrowseBox.GetAccessibleObjectName( eObjType ,_nColumnRowId),
      42           0 :                           rBrowseBox.GetAccessibleObjectDescription( eObjType ,_nColumnRowId))
      43           0 : , m_nColumnRowId(_nColumnRowId)
      44             : {
      45           0 : }
      46             : /** Creates a new AccessibleStateSetHelper and fills it with states of the
      47             :     current object.
      48             :     @return
      49             :         A filled AccessibleStateSetHelper.
      50             : */
      51           0 : ::utl::AccessibleStateSetHelper* AccessibleBrowseBoxHeaderCell::implCreateStateSetHelper()
      52             : {
      53           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
      54             :     ::utl::AccessibleStateSetHelper*
      55           0 :         pStateSetHelper = new ::utl::AccessibleStateSetHelper;
      56             : 
      57           0 :     if( isAlive() )
      58             :     {
      59             :         // SHOWING done with mxParent
      60           0 :         if( implIsShowing() )
      61           0 :             pStateSetHelper->AddState( AccessibleStateType::SHOWING );
      62             : 
      63           0 :         SolarMutexGuard aSolarGuard;
      64           0 :         mpBrowseBox->FillAccessibleStateSet( *pStateSetHelper, getType() );
      65           0 :         pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
      66           0 :         pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
      67           0 :         pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
      68           0 :         pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
      69             : 
      70           0 :         sal_Bool bSelected = isRowBarCell() ? mpBrowseBox->IsRowSelected(m_nColumnRowId) : mpBrowseBox->IsColumnSelected(m_nColumnRowId);
      71           0 :         if ( bSelected )
      72           0 :             pStateSetHelper->AddState( AccessibleStateType::SELECTED );
      73             :     }
      74             :     else
      75           0 :         pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
      76             : 
      77           0 :     return pStateSetHelper;
      78             : }
      79             : 
      80             : /** @return
      81             :         The count of visible children.
      82             : */
      83           0 : sal_Int32 SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleChildCount()
      84             :     throw ( RuntimeException, std::exception )
      85             : {
      86           0 :     return 0;
      87             : }
      88             : 
      89             : 
      90             : /** @return
      91             :         The XAccessible interface of the specified child.
      92             : */
      93           0 : Reference<XAccessible > SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleChild( sal_Int32 )
      94             :     throw ( IndexOutOfBoundsException,RuntimeException, std::exception )
      95             : {
      96           0 :     throw IndexOutOfBoundsException();
      97             : }
      98             : 
      99             : 
     100             : /** Grabs the focus to the column header. */
     101           0 : void SAL_CALL AccessibleBrowseBoxHeaderCell::grabFocus()
     102             :     throw ( ::com::sun::star::uno::RuntimeException, std::exception )
     103             : {
     104           0 :     SolarMutexGuard aSolarGuard;
     105           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     106           0 :     ensureIsAlive();
     107           0 :     if ( isRowBarCell() )
     108           0 :         mpBrowseBox->SelectRow(m_nColumnRowId);
     109             :     else
     110           0 :         mpBrowseBox->SelectColumn(static_cast<sal_uInt16>(m_nColumnRowId)); //!!!
     111           0 : }
     112             : 
     113             : /** @return
     114             :         The name of this class.
     115             : */
     116           0 : OUString SAL_CALL AccessibleBrowseBoxHeaderCell::getImplementationName()
     117             :     throw ( ::com::sun::star::uno::RuntimeException, std::exception )
     118             : {
     119           0 :     return OUString( "com.sun.star.comp.svtools.AccessibleBrowseBoxHeaderCell" );
     120             : }
     121             : 
     122             : namespace
     123             : {
     124           0 :     Rectangle getRectangle(IAccessibleTableProvider* _pBrowseBox,sal_Int32 _nRowColIndex, sal_Bool _bOnScreen,sal_Bool _bRowBar)
     125             :     {
     126           0 :         sal_Int32 nRow  = 0;
     127           0 :         sal_uInt16 nCol =  (sal_uInt16)_nRowColIndex;
     128           0 :         if ( _bRowBar )
     129             :         {
     130           0 :             nRow = _nRowColIndex + 1;
     131           0 :             nCol = 0;
     132             :         }
     133             : 
     134           0 :         Rectangle aRet(_pBrowseBox->GetFieldRectPixelAbs( nRow , nCol, true, _bOnScreen));
     135           0 :         return Rectangle(aRet.TopLeft() - Point(0,aRet.GetHeight()),aRet.GetSize());
     136             :     }
     137             : }
     138             : 
     139           0 : Rectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBox()
     140             : {
     141           0 :     return getRectangle(mpBrowseBox,m_nColumnRowId,sal_False,isRowBarCell());
     142             : }
     143             : 
     144             : 
     145           0 : Rectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBoxOnScreen()
     146             : {
     147           0 :     return getRectangle(mpBrowseBox,m_nColumnRowId,sal_True,isRowBarCell());
     148             : }
     149             : 
     150           0 : sal_Int32 SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleIndexInParent()
     151             :     throw ( RuntimeException, std::exception )
     152             : {
     153           0 :     ::osl::MutexGuard aGuard( getOslMutex() );
     154           0 :     ensureIsAlive();
     155           0 :     sal_Int32 nIndex = m_nColumnRowId;
     156           0 :     if ( mpBrowseBox->HasRowHeader() )
     157           0 :         --nIndex;
     158           0 :     return nIndex;
     159             : }
     160             : 
     161             : } // namespace accessibility
     162             : 
     163             : 
     164             : 
     165             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10