LCOV - code coverage report
Current view: top level - libreoffice/accessibility/source/extended - AccessibleBrowseBoxCheckBoxCell.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 56 0.0 %
Date: 2012-12-27 Functions: 0 17 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/AccessibleBrowseBoxCheckBoxCell.hxx>
      21             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      22             : #include <svtools/accessibletableprovider.hxx>
      23             : 
      24             : namespace accessibility
      25             : {
      26             :     using namespace com::sun::star::accessibility;
      27             :     using namespace com::sun::star::uno;
      28             :     using namespace com::sun::star::accessibility::AccessibleEventId;
      29             :     using namespace ::svt;
      30             : 
      31           0 :     AccessibleCheckBoxCell::AccessibleCheckBoxCell(const Reference<XAccessible >& _rxParent,
      32             :                                 IAccessibleTableProvider& _rBrowseBox,
      33             :                                 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
      34             :                                 sal_Int32 _nRowPos,
      35             :                                 sal_uInt16 _nColPos
      36             :                                 ,const TriState& _eState,
      37             :                                 sal_Bool _bIsTriState)
      38             :         :AccessibleBrowseBoxCell(_rxParent, _rBrowseBox, _xFocusWindow, _nRowPos, _nColPos, BBTYPE_CHECKBOXCELL)
      39             :         ,m_eState(_eState)
      40           0 :         ,m_bIsTriState(_bIsTriState)
      41             :     {
      42           0 :     }
      43             :     // -----------------------------------------------------------------------------
      44           0 :     IMPLEMENT_FORWARD_XINTERFACE2( AccessibleCheckBoxCell, AccessibleBrowseBoxCell, AccessibleCheckBoxCell_BASE )
      45             :         // -----------------------------------------------------------------------------
      46           0 :     IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleCheckBoxCell, AccessibleBrowseBoxCell, AccessibleCheckBoxCell_BASE )
      47             :     //--------------------------------------------------------------------
      48           0 :     Reference< XAccessibleContext > SAL_CALL AccessibleCheckBoxCell::getAccessibleContext(  ) throw (RuntimeException)
      49             :     {
      50           0 :         ensureIsAlive();
      51           0 :         return this;
      52             :     }
      53             :     // -----------------------------------------------------------------------------
      54           0 :     ::utl::AccessibleStateSetHelper* AccessibleCheckBoxCell::implCreateStateSetHelper()
      55             :     {
      56             :         ::utl::AccessibleStateSetHelper* pStateSetHelper =
      57           0 :             AccessibleBrowseBoxCell::implCreateStateSetHelper();
      58           0 :         if( isAlive() )
      59             :         {
      60             :             mpBrowseBox->FillAccessibleStateSetForCell(
      61           0 :                 *pStateSetHelper, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) );
      62           0 :             if ( m_eState == STATE_CHECK )
      63           0 :                 pStateSetHelper->AddState( AccessibleStateType::CHECKED );
      64             :         }
      65           0 :         return pStateSetHelper;
      66             :     }
      67             :     // -----------------------------------------------------------------------------
      68             :     // -----------------------------------------------------------------------------
      69             :     // XAccessibleValue
      70             :     // -----------------------------------------------------------------------------
      71             : 
      72           0 :     Any SAL_CALL AccessibleCheckBoxCell::getCurrentValue(  ) throw (RuntimeException)
      73             :     {
      74           0 :         ::osl::MutexGuard aGuard( getOslMutex() );
      75             : 
      76           0 :         sal_Int32 nValue = 0;
      77           0 :         switch( m_eState )
      78             :         {
      79             :             case STATE_NOCHECK:
      80           0 :                 nValue = 0;
      81           0 :                 break;
      82             :             case STATE_CHECK:
      83           0 :                 nValue = 1;
      84           0 :                 break;
      85             :             case STATE_DONTKNOW:
      86           0 :                 nValue = 2;
      87           0 :                 break;
      88             :         }
      89           0 :         return makeAny(nValue);
      90             :     }
      91             : 
      92             :     // -----------------------------------------------------------------------------
      93             : 
      94           0 :     sal_Bool SAL_CALL AccessibleCheckBoxCell::setCurrentValue( const Any& ) throw (RuntimeException)
      95             :     {
      96           0 :         return sal_False;
      97             :     }
      98             : 
      99             :     // -----------------------------------------------------------------------------
     100             : 
     101           0 :     Any SAL_CALL AccessibleCheckBoxCell::getMaximumValue(  ) throw (RuntimeException)
     102             :     {
     103           0 :         ::osl::MutexGuard aGuard( getOslMutex() );
     104             : 
     105           0 :         Any aValue;
     106             : 
     107           0 :         if ( m_bIsTriState )
     108           0 :             aValue <<= (sal_Int32) 2;
     109             :         else
     110           0 :             aValue <<= (sal_Int32) 1;
     111             : 
     112           0 :         return aValue;
     113             :     }
     114             : 
     115             :     // -----------------------------------------------------------------------------
     116             : 
     117           0 :     Any SAL_CALL AccessibleCheckBoxCell::getMinimumValue(  ) throw (RuntimeException)
     118             :     {
     119           0 :         Any aValue;
     120           0 :         aValue <<= (sal_Int32) 0;
     121             : 
     122           0 :         return aValue;
     123             :     }
     124             :     // -----------------------------------------------------------------------------
     125             :     // XAccessibleContext
     126           0 :     sal_Int32 SAL_CALL AccessibleCheckBoxCell::getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException)
     127             :     {
     128           0 :         return 0;
     129             :     }
     130             :     // -----------------------------------------------------------------------------
     131           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL AccessibleCheckBoxCell::getAccessibleChild( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
     132             :     {
     133           0 :         throw ::com::sun::star::lang::IndexOutOfBoundsException();
     134             :     }
     135             :     // -----------------------------------------------------------------------------
     136           0 :     OUString SAL_CALL AccessibleCheckBoxCell::getImplementationName() throw ( ::com::sun::star::uno::RuntimeException )
     137             :     {
     138           0 :         return OUString( "com.sun.star.comp.svtools.TableCheckBoxCell" );
     139             :     }
     140             :     // -----------------------------------------------------------------------------
     141           0 :     sal_Int32 SAL_CALL AccessibleCheckBoxCell::getAccessibleIndexInParent()
     142             :             throw ( ::com::sun::star::uno::RuntimeException )
     143             :     {
     144           0 :         ::osl::MutexGuard aGuard( getOslMutex() );
     145             : 
     146           0 :         return ( getRowPos() * mpBrowseBox->GetColumnCount() ) + getColumnPos();
     147             :     }
     148             :     // -----------------------------------------------------------------------------
     149           0 :     void AccessibleCheckBoxCell::SetChecked( sal_Bool _bChecked )
     150             :     {
     151           0 :         m_eState = _bChecked ? STATE_CHECK : STATE_NOCHECK;
     152           0 :         Any aOldValue, aNewValue;
     153           0 :         if ( _bChecked )
     154           0 :             aNewValue <<= AccessibleStateType::CHECKED;
     155             :         else
     156           0 :             aOldValue <<= AccessibleStateType::CHECKED;
     157           0 :         commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue );
     158           0 :     }
     159             : }
     160             : 
     161             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10