LCOV - code coverage report
Current view: top level - svtools/source/brwbox - brwbox3.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 223 2.2 %
Date: 2012-08-25 Functions: 2 45 4.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 167 1.2 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <svtools/brwbox.hxx>
      30                 :            : #include <svtools/AccessibleBrowseBoxObjType.hxx>
      31                 :            : #include <tools/debug.hxx>
      32                 :            : #include <tools/multisel.hxx>
      33                 :            : #include "datwin.hxx"
      34                 :            : #include "brwimpl.hxx"
      35                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      36                 :            : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      37                 :            : #include <toolkit/helper/vclunohelper.hxx>
      38                 :            : 
      39                 :            : // Accessibility ==============================================================
      40                 :            : 
      41                 :            : using ::rtl::OUString;
      42                 :            : using namespace ::com::sun::star::uno;
      43                 :            : using ::com::sun::star::accessibility::XAccessible;
      44                 :            : using namespace ::com::sun::star::accessibility;
      45                 :            : 
      46                 :            : // ============================================================================
      47                 :            : namespace svt
      48                 :            : {
      49                 :            :     using namespace ::com::sun::star::lang;
      50                 :            :     using namespace utl;
      51                 :            : 
      52                 :          0 :     Reference< XAccessible > getHeaderCell( BrowseBoxImpl::THeaderCellMap& _raHeaderCells,
      53                 :            :                                             sal_Int32 _nPos,
      54                 :            :                                             AccessibleBrowseBoxObjType _eType,
      55                 :            :                                             const Reference< XAccessible >& _rParent,
      56                 :            :                                             BrowseBox& _rBrowseBox,
      57                 :            :                                             IAccessibleFactory& rFactory
      58                 :            :                                           )
      59                 :            :     {
      60                 :          0 :         Reference< XAccessible > xRet;
      61         [ #  # ]:          0 :         BrowseBoxImpl::THeaderCellMap::iterator aFind = _raHeaderCells.find( _nPos );
      62         [ #  # ]:          0 :         if ( aFind == _raHeaderCells.end() )
      63                 :            :         {
      64                 :            :             Reference< XAccessible > xAccessible = rFactory.createAccessibleBrowseBoxHeaderCell(
      65                 :            :                 _nPos,
      66                 :            :                 _rParent,
      67                 :            :                 _rBrowseBox,
      68                 :            :                 NULL,
      69                 :            :                 _eType
      70 [ #  # ][ #  # ]:          0 :             );
      71 [ #  # ][ #  # ]:          0 :             aFind = _raHeaderCells.insert( BrowseBoxImpl::THeaderCellMap::value_type( _nPos, xAccessible ) ).first;
                 [ #  # ]
      72                 :            :         }
      73         [ #  # ]:          0 :         if ( aFind != _raHeaderCells.end() )
      74         [ #  # ]:          0 :             xRet = aFind->second;
      75                 :          0 :         return xRet;
      76                 :            :     }
      77                 :            : 
      78                 :            :     // ============================================================================
      79                 :            :     // ----------------------------------------------------------------------------
      80                 :          0 :     Reference< XAccessible > BrowseBoxImpl::getAccessibleHeaderBar( AccessibleBrowseBoxObjType _eObjType )
      81                 :            :     {
      82 [ #  # ][ #  # ]:          0 :         if ( m_pAccessible && m_pAccessible->isAlive() )
                 [ #  # ]
      83                 :          0 :             return m_pAccessible->getHeaderBar( _eObjType );
      84                 :          0 :         return NULL;
      85                 :            :     }
      86                 :            : 
      87                 :            :     // ----------------------------------------------------------------------------
      88                 :          0 :     Reference< XAccessible > BrowseBoxImpl::getAccessibleTable( )
      89                 :            :     {
      90 [ #  # ][ #  # ]:          0 :         if ( m_pAccessible && m_pAccessible->isAlive() )
                 [ #  # ]
      91                 :          0 :             return m_pAccessible->getTable( );
      92                 :          0 :         return NULL;
      93                 :            :     }
      94                 :            : }
      95                 :            : 
      96                 :            : // ============================================================================
      97                 :            : 
      98                 :          0 : Reference< XAccessible > BrowseBox::CreateAccessible()
      99                 :            : {
     100                 :          0 :     Window* pParent = GetAccessibleParentWindow();
     101                 :            :     DBG_ASSERT( pParent, "BrowseBox::CreateAccessible - parent not found" );
     102                 :            : 
     103 [ #  # ][ #  # ]:          0 :     if( pParent && !m_pImpl->m_pAccessible)
                 [ #  # ]
     104                 :            :     {
     105         [ #  # ]:          0 :         Reference< XAccessible > xAccParent = pParent->GetAccessible();
     106         [ #  # ]:          0 :         if( xAccParent.is() )
     107                 :            :         {
     108         [ #  # ]:          0 :             m_pImpl->m_pAccessible = getAccessibleFactory().createAccessibleBrowseBox(
     109                 :            :                 xAccParent, *this
     110         [ #  # ]:          0 :             );
     111                 :          0 :         }
     112                 :            :     }
     113                 :            : 
     114                 :          0 :     Reference< XAccessible > xAccessible;
     115         [ #  # ]:          0 :     if ( m_pImpl->m_pAccessible )
     116 [ #  # ][ #  # ]:          0 :         xAccessible = m_pImpl->m_pAccessible->getMyself();
     117                 :            : 
     118                 :          0 :     return xAccessible;
     119                 :            : }
     120                 :            : // -----------------------------------------------------------------------------
     121                 :            : 
     122                 :            : // Children -------------------------------------------------------------------
     123                 :            : 
     124                 :          0 : Reference< XAccessible > BrowseBox::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos )
     125                 :            : {
     126                 :            :     // BBINDEX_TABLE must be the table
     127                 :            :     OSL_ENSURE(m_pImpl->m_pAccessible,"Invalid call: Accessible is null");
     128                 :            : 
     129                 :          0 :     return m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxTableCell(
     130                 :            :         m_pImpl->getAccessibleTable(),
     131                 :            :         *this,
     132                 :            :         NULL,
     133                 :            :         _nRow,
     134                 :            :         _nColumnPos,
     135                 :            :         OFFSET_DEFAULT
     136 [ #  # ][ #  # ]:          0 :     );
     137                 :            : }
     138                 :            : // -----------------------------------------------------------------------------
     139                 :            : 
     140                 :          0 : Reference< XAccessible > BrowseBox::CreateAccessibleRowHeader( sal_Int32 _nRow )
     141                 :            : {
     142                 :            :     return svt::getHeaderCell(
     143                 :          0 :         m_pImpl->m_aRowHeaderCellMap,
     144                 :            :         _nRow,
     145                 :            :         svt::BBTYPE_ROWHEADERCELL,
     146                 :            :         m_pImpl->getAccessibleHeaderBar(svt::BBTYPE_ROWHEADERBAR),
     147                 :            :         *this,
     148                 :          0 :         m_pImpl->m_aFactoryAccess.getFactory()
     149         [ #  # ]:          0 :     );
     150                 :            : }
     151                 :            : // -----------------------------------------------------------------------------
     152                 :            : 
     153                 :          0 : Reference< XAccessible > BrowseBox::CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos )
     154                 :            : {
     155                 :            :     return svt::getHeaderCell(
     156                 :          0 :             m_pImpl->m_aColHeaderCellMap,
     157                 :            :             _nColumnPos,
     158                 :            :             svt::BBTYPE_COLUMNHEADERCELL,
     159                 :            :             m_pImpl->getAccessibleHeaderBar(svt::BBTYPE_COLUMNHEADERBAR),
     160                 :            :             *this,
     161                 :          0 :             m_pImpl->m_aFactoryAccess.getFactory()
     162         [ #  # ]:          0 :     );
     163                 :            : }
     164                 :            : // -----------------------------------------------------------------------------
     165                 :            : 
     166                 :          0 : sal_Int32 BrowseBox::GetAccessibleControlCount() const
     167                 :            : {
     168                 :          0 :     return 0;
     169                 :            : }
     170                 :            : // -----------------------------------------------------------------------------
     171                 :            : 
     172                 :          0 : Reference< XAccessible > BrowseBox::CreateAccessibleControl( sal_Int32 )
     173                 :            : {
     174                 :            :     DBG_ASSERT( sal_False, "BrowseBox::CreateAccessibleControl: to be overwritten!" );
     175                 :          0 :     return NULL;
     176                 :            : }
     177                 :            : // -----------------------------------------------------------------------------
     178                 :            : 
     179                 :            : // Conversions ----------------------------------------------------------------
     180                 :            : 
     181                 :          0 : sal_Bool BrowseBox::ConvertPointToCellAddress(
     182                 :            :         sal_Int32& rnRow, sal_uInt16& rnColumnPos, const Point& rPoint )
     183                 :            : {
     184                 :            :     //! TODO has to be checked
     185                 :          0 :     rnRow = GetRowAtYPosPixel(rPoint.Y());
     186                 :          0 :     rnColumnPos = GetColumnAtXPosPixel(rPoint.X());
     187 [ #  # ][ #  # ]:          0 :     return rnRow != BROWSER_INVALIDID && rnColumnPos != BROWSER_INVALIDID;
     188                 :            : }
     189                 :            : // -----------------------------------------------------------------------------
     190                 :            : 
     191                 :          0 : sal_Bool BrowseBox::ConvertPointToRowHeader( sal_Int32& rnRow, const Point& rPoint )
     192                 :            : {
     193                 :          0 :     rnRow = GetRowAtYPosPixel(rPoint.Y());
     194                 :            :     //  sal_uInt16 nColumnId = GetColumnAtXPosPixel(rPoint.X());
     195                 :          0 :     return rnRow != BROWSER_INVALIDID;// && nColumnId == 0;
     196                 :            : }
     197                 :            : // -----------------------------------------------------------------------------
     198                 :            : 
     199                 :          0 : sal_Bool BrowseBox::ConvertPointToColumnHeader( sal_uInt16& _rnColumnPos, const Point& _rPoint )
     200                 :            : {
     201                 :          0 :     _rnColumnPos = GetColumnAtXPosPixel(_rPoint.X());
     202                 :          0 :     return _rnColumnPos != BROWSER_INVALIDID;
     203                 :            : }
     204                 :            : // -----------------------------------------------------------------------------
     205                 :            : 
     206                 :          0 : sal_Bool BrowseBox::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )
     207                 :            : {
     208                 :            :     //! TODO has to be checked
     209                 :          0 :     sal_Int32 nRow = 0;
     210                 :          0 :     sal_uInt16 nColumn = 0;
     211         [ #  # ]:          0 :     sal_Bool bRet = ConvertPointToCellAddress(nRow,nColumn,_rPoint);
     212         [ #  # ]:          0 :     if ( bRet )
     213         [ #  # ]:          0 :         _rnIndex = nRow * ColCount() + nColumn;
     214                 :            : 
     215                 :          0 :     return bRet;
     216                 :            : }
     217                 :            : // -----------------------------------------------------------------------------
     218                 :            : 
     219                 :            : // Object data and state ------------------------------------------------------
     220                 :            : 
     221                 :          0 : OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 ) const
     222                 :            : {
     223                 :          0 :     OUString aRetText;
     224   [ #  #  #  #  :          0 :     switch( eObjType )
             #  #  #  # ]
     225                 :            :     {
     226                 :            :         case ::svt::BBTYPE_BROWSEBOX:
     227         [ #  # ]:          0 :             aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "BrowseBox" ) );
     228                 :          0 :             break;
     229                 :            :         case ::svt::BBTYPE_TABLE:
     230         [ #  # ]:          0 :             aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "Table" ) );
     231                 :          0 :             break;
     232                 :            :         case ::svt::BBTYPE_ROWHEADERBAR:
     233         [ #  # ]:          0 :             aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderBar" ) );
     234                 :          0 :             break;
     235                 :            :         case ::svt::BBTYPE_COLUMNHEADERBAR:
     236         [ #  # ]:          0 :             aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) );
     237                 :          0 :             break;
     238                 :            :         case ::svt::BBTYPE_TABLECELL:
     239         [ #  # ]:          0 :             aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "TableCell" ) );
     240                 :            : #if OSL_DEBUG_LEVEL > 1
     241                 :            :             aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
     242                 :            :             aRetText += OUString::valueOf(sal_Int32(GetCurRow()));
     243                 :            :             aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "," ) );
     244                 :            :             aRetText += OUString::valueOf(sal_Int32(GetCurColumnId()));
     245                 :            :             aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "]" ) );
     246                 :            : #endif
     247                 :          0 :             break;
     248                 :            :         case ::svt::BBTYPE_ROWHEADERCELL:
     249         [ #  # ]:          0 :             aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderCell" ) );
     250                 :            : #if OSL_DEBUG_LEVEL > 1
     251                 :            :             aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
     252                 :            :             aRetText += OUString::valueOf(sal_Int32(GetCurRow()));
     253                 :            :             aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "," ) );
     254                 :            :             aRetText += OUString::valueOf(sal_Int32(GetCurColumnId()));
     255                 :            :             aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "]" ) );
     256                 :            : #endif
     257                 :          0 :             break;
     258                 :            :         case ::svt::BBTYPE_COLUMNHEADERCELL:
     259         [ #  # ]:          0 :             aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderCell" ) );
     260                 :            : #if OSL_DEBUG_LEVEL > 1
     261                 :            :             aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
     262                 :            :             aRetText += OUString::valueOf(sal_Int32(GetCurRow()));
     263                 :            :             aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "," ) );
     264                 :            :             aRetText += OUString::valueOf(sal_Int32(GetCurColumnId()));
     265                 :            :             aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( "]" ) );
     266                 :            : #endif
     267                 :          0 :             break;
     268                 :            :         default:
     269                 :            :             OSL_FAIL("BrowseBox::GetAccessibleName: invalid enum!");
     270                 :            :     }
     271                 :          0 :     return aRetText;
     272                 :            : }
     273                 :            : // -----------------------------------------------------------------------------
     274                 :            : 
     275                 :          0 : OUString BrowseBox::GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 ) const
     276                 :            : {
     277                 :          0 :     OUString aRetText;
     278   [ #  #  #  #  :          0 :     switch( eObjType )
             #  #  #  #  
                      # ]
     279                 :            :     {
     280                 :            :         case ::svt::BBTYPE_BROWSEBOX:
     281         [ #  # ]:          0 :             aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "BrowseBox description" ) );
     282                 :          0 :             break;
     283                 :            :         case ::svt::BBTYPE_TABLE:
     284                 :            :             //  aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLE description" ) );
     285                 :          0 :             break;
     286                 :            :         case ::svt::BBTYPE_ROWHEADERBAR:
     287                 :            :             //  aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERBAR description" ) );
     288                 :          0 :             break;
     289                 :            :         case ::svt::BBTYPE_COLUMNHEADERBAR:
     290                 :            :             //  aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERBAR description" ) );
     291                 :          0 :             break;
     292                 :            :         case ::svt::BBTYPE_TABLECELL:
     293                 :            :             //  aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLECELL description" ) );
     294                 :          0 :             break;
     295                 :            :         case ::svt::BBTYPE_ROWHEADERCELL:
     296                 :            :             //  aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERCELL description" ) );
     297                 :          0 :             break;
     298                 :            :         case ::svt::BBTYPE_COLUMNHEADERCELL:
     299                 :            :             //  aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERCELL description" ) );
     300                 :          0 :             break;
     301                 :            :         case ::svt::BBTYPE_CHECKBOXCELL:
     302                 :          0 :             break;
     303                 :            :     }
     304                 :          0 :     return aRetText;
     305                 :            : }
     306                 :            : // -----------------------------------------------------------------------------
     307                 :            : 
     308                 :          0 : OUString BrowseBox::GetRowDescription( sal_Int32 ) const
     309                 :            : {
     310                 :          0 :     return OUString();
     311                 :            : }
     312                 :            : // -----------------------------------------------------------------------------
     313                 :            : 
     314                 :          0 : OUString BrowseBox::GetColumnDescription( sal_uInt16 _nColumn ) const
     315                 :            : {
     316         [ #  # ]:          0 :     return OUString( GetColumnTitle( GetColumnId( _nColumn ) ) );
     317                 :            : }
     318                 :            : 
     319                 :            : // -----------------------------------------------------------------------------
     320                 :            : 
     321                 :          0 : void BrowseBox::FillAccessibleStateSet(
     322                 :            :         ::utl::AccessibleStateSetHelper& rStateSet,
     323                 :            :         ::svt::AccessibleBrowseBoxObjType eObjType ) const
     324                 :            : {
     325   [ #  #  #  #  :          0 :     switch( eObjType )
                   #  # ]
     326                 :            :     {
     327                 :            :         case ::svt::BBTYPE_BROWSEBOX:
     328                 :            :         case ::svt::BBTYPE_TABLE:
     329                 :            : 
     330                 :          0 :             rStateSet.AddState( AccessibleStateType::FOCUSABLE );
     331         [ #  # ]:          0 :             if ( HasFocus() )
     332                 :          0 :                 rStateSet.AddState( AccessibleStateType::FOCUSED );
     333         [ #  # ]:          0 :             if ( IsActive() )
     334                 :          0 :                 rStateSet.AddState( AccessibleStateType::ACTIVE );
     335         [ #  # ]:          0 :             if ( GetUpdateMode() )
     336                 :          0 :                 rStateSet.AddState( AccessibleStateType::EDITABLE );
     337         [ #  # ]:          0 :             if ( IsEnabled() )
     338                 :            :             {
     339                 :          0 :                 rStateSet.AddState( AccessibleStateType::ENABLED );
     340                 :          0 :                 rStateSet.AddState( AccessibleStateType::SENSITIVE );
     341                 :            :             }
     342         [ #  # ]:          0 :             if ( IsReallyVisible() )
     343                 :          0 :                 rStateSet.AddState( AccessibleStateType::VISIBLE );
     344         [ #  # ]:          0 :             if ( eObjType == ::svt::BBTYPE_TABLE )
     345                 :          0 :                 rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
     346                 :            : 
     347                 :          0 :             break;
     348                 :            :         case ::svt::BBTYPE_ROWHEADERBAR:
     349                 :          0 :             rStateSet.AddState( AccessibleStateType::FOCUSABLE );
     350                 :          0 :             rStateSet.AddState( AccessibleStateType::VISIBLE );
     351         [ #  # ]:          0 :             if ( GetSelectRowCount() )
     352                 :          0 :                 rStateSet.AddState( AccessibleStateType::FOCUSED );
     353                 :          0 :             rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
     354                 :          0 :             break;
     355                 :            :         case ::svt::BBTYPE_COLUMNHEADERBAR:
     356                 :          0 :             rStateSet.AddState( AccessibleStateType::FOCUSABLE );
     357                 :          0 :             rStateSet.AddState( AccessibleStateType::VISIBLE );
     358         [ #  # ]:          0 :             if ( GetSelectColumnCount() )
     359                 :          0 :                 rStateSet.AddState( AccessibleStateType::FOCUSED );
     360                 :          0 :             rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
     361                 :          0 :             break;
     362                 :            :         case ::svt::BBTYPE_TABLECELL:
     363                 :            :             {
     364                 :          0 :                 sal_Int32 nRow = GetCurRow();
     365                 :          0 :                 sal_uInt16 nColumn = GetCurColumnId();
     366         [ #  # ]:          0 :                 if ( IsFieldVisible(nRow,nColumn) )
     367                 :          0 :                     rStateSet.AddState( AccessibleStateType::VISIBLE );
     368         [ #  # ]:          0 :                 if ( !IsFrozen( nColumn ) )
     369                 :          0 :                     rStateSet.AddState( AccessibleStateType::FOCUSABLE );
     370                 :          0 :                 rStateSet.AddState( AccessibleStateType::TRANSIENT );
     371                 :            :             }
     372                 :          0 :             break;
     373                 :            :         case ::svt::BBTYPE_ROWHEADERCELL:
     374                 :            :         case ::svt::BBTYPE_COLUMNHEADERCELL:
     375                 :            :         case ::svt::BBTYPE_CHECKBOXCELL:
     376                 :            :             OSL_FAIL("Illegal call here!");
     377                 :          0 :             break;
     378                 :            :     }
     379                 :          0 : }
     380                 :            : // -----------------------------------------------------------------------
     381                 :          0 : void BrowseBox::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet,
     382                 :            :                                                sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
     383                 :            : {
     384                 :            :     //! TODO check if the state is valid for table cells
     385         [ #  # ]:          0 :     if ( IsCellVisible( _nRow, _nColumnPos ) )
     386                 :          0 :         _rStateSet.AddState( AccessibleStateType::VISIBLE );
     387 [ #  # ][ #  # ]:          0 :     if ( GetCurrRow() == _nRow && GetCurrColumn() == _nColumnPos )
                 [ #  # ]
     388                 :          0 :         _rStateSet.AddState( AccessibleStateType::FOCUSED );
     389                 :            :     else // only transient when column is not focused
     390                 :          0 :         _rStateSet.AddState( AccessibleStateType::TRANSIENT );
     391                 :          0 : }
     392                 :            : // -----------------------------------------------------------------------------
     393                 :            : 
     394                 :          0 : void BrowseBox::GrabTableFocus()
     395                 :            : {
     396                 :          0 :     GrabFocus();
     397                 :          0 : }
     398                 :            : // -----------------------------------------------------------------------------
     399                 :          0 : String BrowseBox::GetCellText(long, sal_uInt16 ) const
     400                 :            : {
     401                 :            :     DBG_ASSERT(0,"This method has to be implemented by the derived classes! BUG!!");
     402                 :          0 :     return String();
     403                 :            : }
     404                 :            : 
     405                 :            : // -----------------------------------------------------------------------------
     406                 :          0 : void BrowseBox::commitHeaderBarEvent(sal_Int16 nEventId,
     407                 :            :         const Any& rNewValue, const Any& rOldValue, sal_Bool _bColumnHeaderBar )
     408                 :            : {
     409         [ #  # ]:          0 :     if ( isAccessibleAlive() )
     410                 :          0 :         m_pImpl->m_pAccessible->commitHeaderBarEvent( nEventId,
     411                 :          0 :             rNewValue, rOldValue, _bColumnHeaderBar );
     412                 :          0 : }
     413                 :            : 
     414                 :            : // -----------------------------------------------------------------------------
     415                 :          0 : void BrowseBox::commitTableEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
     416                 :            : {
     417         [ #  # ]:          0 :     if ( isAccessibleAlive() )
     418                 :          0 :         m_pImpl->m_pAccessible->commitTableEvent( _nEventId, _rNewValue, _rOldValue );
     419                 :          0 : }
     420                 :            : // -----------------------------------------------------------------------------
     421                 :          0 : void BrowseBox::commitBrowseBoxEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
     422                 :            : {
     423         [ #  # ]:          0 :     if ( isAccessibleAlive() )
     424                 :          0 :         m_pImpl->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue);
     425                 :          0 : }
     426                 :            : 
     427                 :            : // -----------------------------------------------------------------------------
     428                 :          0 : ::svt::IAccessibleFactory& BrowseBox::getAccessibleFactory()
     429                 :            : {
     430                 :          0 :     return m_pImpl->m_aFactoryAccess.getFactory();
     431                 :            : }
     432                 :            : 
     433                 :            : // -----------------------------------------------------------------------------
     434                 :         92 : sal_Bool BrowseBox::isAccessibleAlive( ) const
     435                 :            : {
     436 [ -  + ][ #  # ]:         92 :     return ( NULL != m_pImpl->m_pAccessible ) && m_pImpl->m_pAccessible->isAlive();
     437                 :            : }
     438                 :            : // -----------------------------------------------------------------------------
     439                 :            : // IAccessibleTableProvider
     440                 :            : // -----------------------------------------------------------------------------
     441                 :          0 : sal_Int32 BrowseBox::GetCurrRow() const
     442                 :            : {
     443                 :          0 :     return GetCurRow();
     444                 :            : }
     445                 :            : // -----------------------------------------------------------------------------
     446                 :          0 : sal_uInt16 BrowseBox::GetCurrColumn() const
     447                 :            : {
     448                 :          0 :     return GetColumnPos( GetCurColumnId() );
     449                 :            : }
     450                 :            : // -----------------------------------------------------------------------------
     451                 :          0 : sal_Bool BrowseBox::HasRowHeader() const
     452                 :            : {
     453                 :          0 :     return ( GetColumnId( 0 ) == HandleColumnId ); // HandleColumn == RowHeader
     454                 :            : }
     455                 :            : // -----------------------------------------------------------------------------
     456                 :          0 : sal_Bool BrowseBox::IsCellFocusable() const
     457                 :            : {
     458                 :          0 :     return sal_True;
     459                 :            : }
     460                 :            : // -----------------------------------------------------------------------------
     461                 :          0 : sal_Bool BrowseBox::GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn )
     462                 :            : {
     463                 :          0 :     return GoToRowColumnId( _nRow, GetColumnId( _nColumn ) );
     464                 :            : }
     465                 :            : // -----------------------------------------------------------------------------
     466                 :          0 : void BrowseBox::SelectColumn( sal_uInt16 _nColumn, sal_Bool _bSelect )
     467                 :            : {
     468                 :          0 :     SelectColumnPos( _nColumn, _bSelect );
     469                 :          0 : }
     470                 :            : // -----------------------------------------------------------------------------
     471                 :          0 : sal_Bool BrowseBox::IsColumnSelected( long _nColumn ) const
     472                 :            : {
     473                 :            :     return ( pColSel && (0 <= _nColumn) && (_nColumn <= 0xFFF) ) ?
     474                 :          0 :         pColSel->IsSelected( static_cast< sal_uInt16 >( _nColumn ) ) :
     475 [ #  # ][ #  # ]:          0 :         sal_False;
                 [ #  # ]
     476                 :            : }
     477                 :            : // -----------------------------------------------------------------------------
     478                 :          0 : sal_Int32 BrowseBox::GetSelectedRowCount() const
     479                 :            : {
     480                 :          0 :     return GetSelectRowCount();
     481                 :            : }
     482                 :            : // -----------------------------------------------------------------------------
     483                 :         45 : sal_Int32 BrowseBox::GetSelectedColumnCount() const
     484                 :            : {
     485                 :         45 :     const MultiSelection* pColumnSel = GetColumnSelection();
     486         [ +  - ]:         45 :     return pColumnSel ? pColumnSel->GetSelectCount() : 0;
     487                 :            : }
     488                 :            : // -----------------------------------------------------------------------------
     489                 :          0 : void BrowseBox::GetAllSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& _rRows ) const
     490                 :            : {
     491                 :          0 :     sal_Int32 nCount = GetSelectRowCount();
     492         [ #  # ]:          0 :     if( nCount )
     493                 :            :     {
     494                 :          0 :         _rRows.realloc( nCount );
     495                 :          0 :         _rRows[ 0 ] = const_cast< BrowseBox* >( this )->FirstSelectedRow();
     496         [ #  # ]:          0 :         for( sal_Int32 nIndex = 1; nIndex < nCount; ++nIndex )
     497                 :          0 :             _rRows[ nIndex ] = const_cast< BrowseBox* >( this )->NextSelectedRow();
     498                 :            :         DBG_ASSERT( const_cast< BrowseBox* >( this )->NextSelectedRow() == BROWSER_ENDOFSELECTION,
     499                 :            :                     "BrowseBox::GetAllSelectedRows - too many selected rows found" );
     500                 :            :     }
     501                 :          0 : }
     502                 :            : // -----------------------------------------------------------------------------
     503                 :          0 : void BrowseBox::GetAllSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& _rColumns ) const
     504                 :            : {
     505                 :          0 :     const MultiSelection* pColumnSel = GetColumnSelection();
     506                 :          0 :     sal_Int32 nCount = GetSelectedColumnCount();
     507 [ #  # ][ #  # ]:          0 :     if( pColumnSel && nCount )
     508                 :            :     {
     509                 :          0 :         _rColumns.realloc( nCount );
     510                 :            : 
     511                 :          0 :         sal_Int32 nIndex = 0;
     512                 :          0 :         sal_uInt32 nRangeCount = pColumnSel->GetRangeCount();
     513         [ #  # ]:          0 :         for( sal_uInt32 nRange = 0; nRange < nRangeCount; ++nRange )
     514                 :            :         {
     515                 :          0 :             const Range& rRange = pColumnSel->GetRange( nRange );
     516                 :            :             // loop has to include aRange.Max()
     517         [ #  # ]:          0 :             for( sal_Int32 nCol = rRange.Min(); nCol <= rRange.Max(); ++nCol )
     518                 :            :             {
     519                 :            :                 DBG_ASSERT( nIndex < nCount,
     520                 :            :                     "GetAllSelectedColumns - range overflow" );
     521                 :          0 :                 _rColumns[ nIndex ] = nCol;
     522                 :          0 :                 ++nIndex;
     523                 :            :             }
     524                 :            :         }
     525                 :            :     }
     526                 :          0 : }
     527                 :            : // -----------------------------------------------------------------------------
     528                 :          0 : sal_Bool BrowseBox::IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
     529                 :            : {
     530                 :          0 :     return IsFieldVisible( _nRow, GetColumnId( _nColumnPos ) );
     531                 :            : }
     532                 :            : // -----------------------------------------------------------------------------
     533                 :          0 : String BrowseBox::GetAccessibleCellText(long _nRow, sal_uInt16 _nColPos) const
     534                 :            : {
     535                 :          0 :     return GetCellText( _nRow, GetColumnId( _nColPos ) );
     536                 :            : }
     537                 :            : 
     538                 :            : // -----------------------------------------------------------------------------
     539                 :          0 : sal_Bool BrowseBox::GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector )
     540                 :            : {
     541                 :          0 :     return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, nBase, rVector );
     542                 :            : }
     543                 :            : // -----------------------------------------------------------------------------
     544                 :          0 : Rectangle BrowseBox::GetWindowExtentsRelative( Window *pRelativeWindow ) const
     545                 :            : {
     546                 :          0 :     return Control::GetWindowExtentsRelative( pRelativeWindow );
     547                 :            : }
     548                 :            : // -----------------------------------------------------------------------------
     549                 :          0 : void BrowseBox::GrabFocus()
     550                 :            : {
     551                 :          0 :     Control::GrabFocus();
     552                 :          0 : }
     553                 :            : // -----------------------------------------------------------------------------
     554                 :          0 : Reference< XAccessible > BrowseBox::GetAccessible( sal_Bool bCreate )
     555                 :            : {
     556                 :          0 :     return Control::GetAccessible( bCreate );
     557                 :            : }
     558                 :            : // -----------------------------------------------------------------------------
     559                 :          0 : Window* BrowseBox::GetAccessibleParentWindow() const
     560                 :            : {
     561                 :          0 :     return Control::GetAccessibleParentWindow();
     562                 :            : }
     563                 :            : // -----------------------------------------------------------------------------
     564                 :          0 : Window* BrowseBox::GetWindowInstance()
     565                 :            : {
     566                 :          0 :     return this;
     567                 :            : }
     568                 :            : 
     569                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10