LCOV - code coverage report
Current view: top level - svtools/source/table - tablecontrol.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 42 275 15.3 %
Date: 2014-04-11 Functions: 14 58 24.1 %
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 "svtools/table/tablecontrol.hxx"
      21             : 
      22             : #include "tablegeometry.hxx"
      23             : #include "tablecontrol_impl.hxx"
      24             : #include "tabledatawindow.hxx"
      25             : 
      26             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      27             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      28             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      29             : 
      30             : #include <tools/diagnose_ex.h>
      31             : #include <vcl/settings.hxx>
      32             : 
      33             : using namespace ::com::sun::star::uno;
      34             : using ::com::sun::star::accessibility::XAccessible;
      35             : using namespace ::com::sun::star::accessibility;
      36             : using namespace ::com::sun::star::lang;
      37             : using namespace utl;
      38             : 
      39             : namespace svt { namespace table
      40             : {
      41             : 
      42             : 
      43             :     namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
      44             : 
      45             : 
      46             :     //= TableControl
      47             : 
      48             : 
      49           1 :     TableControl::TableControl( Window* _pParent, WinBits _nStyle )
      50             :         :Control( _pParent, _nStyle )
      51           1 :         ,m_pImpl( new TableControl_Impl( *this ) )
      52             :     {
      53           1 :         TableDataWindow& rDataWindow = m_pImpl->getDataWindow();
      54           1 :         rDataWindow.SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) );
      55             : 
      56             :         // by default, use the background as determined by the style settings
      57           1 :         const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
      58           1 :         SetBackground( Wallpaper( aWindowColor ) );
      59           1 :         SetFillColor( aWindowColor );
      60             : 
      61           1 :         SetCompoundControl( true );
      62           1 :     }
      63             : 
      64             : 
      65           3 :     TableControl::~TableControl()
      66             :     {
      67           1 :         ImplCallEventListeners( VCLEVENT_OBJECT_DYING );
      68             : 
      69           1 :         m_pImpl->setModel( PTableModel() );
      70           1 :         m_pImpl->disposeAccessible();
      71           1 :         m_pImpl.reset();
      72           2 :     }
      73             : 
      74             : 
      75           0 :     void TableControl::GetFocus()
      76             :     {
      77           0 :         if ( !m_pImpl->getInputHandler()->GetFocus( *m_pImpl ) )
      78           0 :             Control::GetFocus();
      79           0 :     }
      80             : 
      81             : 
      82           0 :     void TableControl::LoseFocus()
      83             :     {
      84           0 :         if ( !m_pImpl->getInputHandler()->LoseFocus( *m_pImpl ) )
      85           0 :             Control::LoseFocus();
      86           0 :     }
      87             : 
      88             : 
      89           0 :     void TableControl::KeyInput( const KeyEvent& rKEvt )
      90             :     {
      91           0 :         if ( !m_pImpl->getInputHandler()->KeyInput( *m_pImpl, rKEvt ) )
      92           0 :             Control::KeyInput( rKEvt );
      93             :         else
      94             :         {
      95           0 :             if ( m_pImpl->isAccessibleAlive() )
      96             :             {
      97             :                 m_pImpl->commitCellEvent( AccessibleEventId::STATE_CHANGED,
      98             :                                           makeAny( AccessibleStateType::FOCUSED ),
      99             :                                           Any()
     100           0 :                                         );
     101             :                     // Huh? What the heck? Why do we unconditionally notify a STATE_CHANGE/FOCUSED after each and every
     102             :                     // (handled) key stroke?
     103             : 
     104             :                 m_pImpl->commitTableEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
     105             :                                            Any(),
     106             :                                            Any()
     107           0 :                                          );
     108             :                     // ditto: Why do we notify this unconditionally? We should find the right place to notify the
     109             :                     // ACTIVE_DESCENDANT_CHANGED event.
     110             :                     // Also, we should check if STATE_CHANGED/FOCUSED is really necessary: finally, the children are
     111             :                     // transient, aren't they?
     112             :             }
     113             :         }
     114           0 :     }
     115             : 
     116             : 
     117             : 
     118           2 :     void TableControl::StateChanged( StateChangedType i_nStateChange )
     119             :     {
     120           2 :         Control::StateChanged( i_nStateChange );
     121             : 
     122             :         // forward certain settings to the data window
     123           2 :         switch ( i_nStateChange )
     124             :         {
     125             :         case STATE_CHANGE_CONTROL_FOCUS:
     126           0 :             m_pImpl->invalidateSelectedRows();
     127           0 :             break;
     128             : 
     129             :         case STATE_CHANGE_CONTROLBACKGROUND:
     130           0 :             if ( IsControlBackground() )
     131           0 :                 getDataWindow().SetControlBackground( GetControlBackground() );
     132             :             else
     133           0 :                 getDataWindow().SetControlBackground();
     134           0 :             break;
     135             : 
     136             :         case STATE_CHANGE_CONTROLFOREGROUND:
     137           0 :             if ( IsControlForeground() )
     138           0 :                 getDataWindow().SetControlForeground( GetControlForeground() );
     139             :             else
     140           0 :                 getDataWindow().SetControlForeground();
     141           0 :             break;
     142             : 
     143             :         case STATE_CHANGE_CONTROLFONT:
     144           0 :             if ( IsControlFont() )
     145           0 :                 getDataWindow().SetControlFont( GetControlFont() );
     146             :             else
     147           0 :                 getDataWindow().SetControlFont();
     148           0 :             break;
     149             :         }
     150           2 :     }
     151             : 
     152             : 
     153           2 :     void TableControl::Resize()
     154             :     {
     155           2 :         Control::Resize();
     156           2 :         m_pImpl->onResize();
     157           2 :     }
     158             : 
     159             : 
     160           1 :     void TableControl::SetModel( PTableModel _pModel )
     161             :     {
     162           1 :         m_pImpl->setModel( _pModel );
     163           1 :     }
     164             : 
     165             : 
     166           4 :     PTableModel TableControl::GetModel() const
     167             :     {
     168           4 :         return m_pImpl->getModel();
     169             :     }
     170             : 
     171             : 
     172           3 :     sal_Int32 TableControl::GetCurrentRow() const
     173             :     {
     174           3 :         return m_pImpl->getCurrentRow();
     175             :     }
     176             : 
     177             : 
     178           3 :     sal_Int32 TableControl::GetCurrentColumn() const
     179             :     {
     180           3 :         return m_pImpl->getCurrentColumn();
     181             :     }
     182             : 
     183             : 
     184           2 :     bool TableControl::GoTo( ColPos _nColumn, RowPos _nRow )
     185             :     {
     186           2 :         return m_pImpl->goTo( _nColumn, _nRow );
     187             :     }
     188             : 
     189             : 
     190           0 :     bool TableControl::GoToCell(sal_Int32 _nColPos, sal_Int32 _nRowPos)
     191             :     {
     192           0 :         return m_pImpl->goTo( _nColPos, _nRowPos );
     193             :     }
     194             : 
     195             : 
     196           0 :     sal_Int32 TableControl::GetSelectedRowCount() const
     197             :     {
     198           0 :         return sal_Int32( m_pImpl->getSelectedRowCount() );
     199             :     }
     200             : 
     201             : 
     202           0 :     sal_Int32 TableControl::GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const
     203             :     {
     204           0 :         return sal_Int32( m_pImpl->getSelectedRowIndex( i_selectionIndex ) );
     205             :     }
     206             : 
     207             : 
     208           0 :     bool TableControl::IsRowSelected( sal_Int32 const i_rowIndex ) const
     209             :     {
     210           0 :         return m_pImpl->isRowSelected( i_rowIndex );
     211             :     }
     212             : 
     213             : 
     214           0 :     void TableControl::SelectRow( RowPos const i_rowIndex, bool const i_select )
     215             :     {
     216           0 :         ENSURE_OR_RETURN_VOID( ( i_rowIndex >= 0 ) && ( i_rowIndex < m_pImpl->getModel()->getRowCount() ),
     217             :             "TableControl::SelectRow: invalid row index!" );
     218             : 
     219           0 :         if ( i_select )
     220             :         {
     221           0 :             if ( !m_pImpl->markRowAsSelected( i_rowIndex ) )
     222             :                 // nothing to do
     223           0 :                 return;
     224             :         }
     225             :         else
     226             :         {
     227           0 :             m_pImpl->markRowAsDeselected( i_rowIndex );
     228             :         }
     229             : 
     230           0 :         m_pImpl->invalidateRowRange( i_rowIndex, i_rowIndex );
     231           0 :         Select();
     232             :     }
     233             : 
     234             : 
     235           0 :     void TableControl::SelectAllRows( bool const i_select )
     236             :     {
     237           0 :         if ( i_select )
     238             :         {
     239           0 :             if ( !m_pImpl->markAllRowsAsSelected() )
     240             :                 // nothing to do
     241           0 :                 return;
     242             :         }
     243             :         else
     244             :         {
     245           0 :             if ( !m_pImpl->markAllRowsAsDeselected() )
     246             :                 // nothing to do
     247           0 :                 return;
     248             :         }
     249             : 
     250             : 
     251           0 :         Invalidate();
     252             :             // TODO: can't we do better than this, and invalidate only the rows which changed?
     253           0 :         Select();
     254             :     }
     255             : 
     256             : 
     257           0 :     ITableControl& TableControl::getTableControlInterface()
     258             :     {
     259           0 :         return *m_pImpl;
     260             :     }
     261             : 
     262             : 
     263           1 :     SelectionEngine* TableControl::getSelEngine()
     264             :     {
     265           1 :         return m_pImpl->getSelEngine();
     266             :     }
     267             : 
     268             : 
     269           1 :     Window& TableControl::getDataWindow()
     270             :     {
     271           1 :         return m_pImpl->getDataWindow();
     272             :     }
     273             : 
     274             : 
     275           0 :     Reference< XAccessible > TableControl::CreateAccessible()
     276             :     {
     277           0 :         Window* pParent = GetAccessibleParentWindow();
     278           0 :         ENSURE_OR_RETURN( pParent, "TableControl::CreateAccessible - parent not found", NULL );
     279             : 
     280           0 :         return m_pImpl->getAccessible( *pParent );
     281             :     }
     282             : 
     283             : 
     284           0 :     Reference<XAccessible> TableControl::CreateAccessibleControl( sal_Int32 _nIndex )
     285             :     {
     286             :         (void)_nIndex;
     287             :         DBG_ASSERT( false, "TableControl::CreateAccessibleControl: to be overwritten!" );
     288           0 :         return NULL;
     289             :     }
     290             : 
     291             : 
     292           0 :     OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const
     293             :     {
     294           0 :         OUString aRetText;
     295             :         //Window* pWin;
     296           0 :         switch( eObjType )
     297             :         {
     298             :             case TCTYPE_GRIDCONTROL:
     299           0 :                 aRetText = "Grid control";
     300           0 :                 break;
     301             :             case TCTYPE_TABLE:
     302           0 :                 aRetText = "Grid conrol";
     303           0 :                 break;
     304             :             case TCTYPE_ROWHEADERBAR:
     305           0 :                 aRetText = "RowHeaderBar";
     306           0 :                 break;
     307             :             case TCTYPE_COLUMNHEADERBAR:
     308           0 :                 aRetText = "ColumnHeaderBar";
     309           0 :                 break;
     310             :             case TCTYPE_TABLECELL:
     311             :                 //the name of the cell constists of column name and row name if defined
     312             :                 //if the name is equal to cell content, it'll be read twice
     313           0 :                 if(GetModel()->hasColumnHeaders())
     314             :                 {
     315           0 :                     aRetText = GetColumnName(_nCol) + " , ";
     316             :                 }
     317           0 :                 if(GetModel()->hasRowHeaders())
     318             :                 {
     319           0 :                     aRetText += GetRowName(_nRow) + " , ";
     320             :                 }
     321             :                 //aRetText = GetAccessibleCellText(_nRow, _nCol);
     322           0 :                 break;
     323             :             case TCTYPE_ROWHEADERCELL:
     324           0 :                 aRetText = GetRowName(_nRow);
     325           0 :                 break;
     326             :             case TCTYPE_COLUMNHEADERCELL:
     327           0 :                 aRetText = GetColumnName(_nCol);
     328           0 :                 break;
     329             :             default:
     330             :                 OSL_FAIL("GridControl::GetAccessibleName: invalid enum!");
     331             :         }
     332           0 :         return aRetText;
     333             :     }
     334             : 
     335             : 
     336           0 :     OUString TableControl::GetAccessibleObjectDescription( AccessibleTableControlObjType eObjType, sal_Int32 ) const
     337             :     {
     338           0 :         OUString aRetText;
     339           0 :         switch( eObjType )
     340             :         {
     341             :             case TCTYPE_GRIDCONTROL:
     342           0 :                 aRetText = "Grid control description";
     343           0 :                 break;
     344             :             case TCTYPE_TABLE:
     345           0 :                     aRetText = "TABLE description";
     346           0 :                 break;
     347             :             case TCTYPE_ROWHEADERBAR:
     348           0 :                     aRetText = "ROWHEADERBAR description";
     349           0 :                 break;
     350             :             case TCTYPE_COLUMNHEADERBAR:
     351           0 :                     aRetText = "COLUMNHEADERBAR description";
     352           0 :                 break;
     353             :             case TCTYPE_TABLECELL:
     354             :                 // the description of the cell consists of column name and row name if defined
     355             :                 // if the name is equal to cell content, it'll be read twice
     356           0 :                 if ( GetModel()->hasColumnHeaders() )
     357             :                 {
     358           0 :                     aRetText = GetColumnName( GetCurrentColumn() ) + " , ";
     359             :                 }
     360           0 :                 if ( GetModel()->hasRowHeaders() )
     361             :                 {
     362           0 :                     aRetText += GetRowName( GetCurrentRow() );
     363             :                 }
     364           0 :                 break;
     365             :             case TCTYPE_ROWHEADERCELL:
     366           0 :                     aRetText = "ROWHEADERCELL description";
     367           0 :                 break;
     368             :             case TCTYPE_COLUMNHEADERCELL:
     369           0 :                     aRetText = "COLUMNHEADERCELL description";
     370           0 :                 break;
     371             :         }
     372           0 :         return aRetText;
     373             :     }
     374             : 
     375             : 
     376           0 :     OUString TableControl::GetRowDescription( sal_Int32 _nRow) const
     377             :     {
     378             :         (void)_nRow;
     379           0 :         return OUString( "row description" );
     380             :     }
     381             : 
     382             : 
     383           0 :     OUString TableControl::GetRowName( sal_Int32 _nIndex) const
     384             :     {
     385           0 :         OUString sRowName;
     386           0 :         GetModel()->getRowHeading( _nIndex ) >>= sRowName;
     387           0 :         return sRowName;
     388             :     }
     389             : 
     390             : 
     391           0 :     OUString TableControl::GetColumnDescription( sal_uInt16 _nColumn) const
     392             :     {
     393             :         (void)_nColumn;
     394           0 :         return OUString( "col description" );
     395             :     }
     396             : 
     397             : 
     398           0 :     OUString TableControl::GetColumnName( sal_Int32 _nIndex) const
     399             :     {
     400           0 :         return GetModel()->getColumnModel(_nIndex)->getName();
     401             :     }
     402             : 
     403             : 
     404           0 :     ::com::sun::star::uno::Any TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos ) const
     405             :     {
     406           0 :         Any aCellContent;
     407           0 :         GetModel()->getCellContent( _nColPos, _nRowPos, aCellContent );
     408           0 :         return aCellContent;
     409             :     }
     410             : 
     411             : 
     412           0 :     OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
     413             :     {
     414           0 :         return m_pImpl->getCellContentAsString( _nRowPos, _nColPos );
     415             :     }
     416             : 
     417             : 
     418           0 :     void TableControl::FillAccessibleStateSet(
     419             :             ::utl::AccessibleStateSetHelper& rStateSet,
     420             :             AccessibleTableControlObjType eObjType ) const
     421             :     {
     422           0 :         switch( eObjType )
     423             :         {
     424             :             case TCTYPE_GRIDCONTROL:
     425             :             case TCTYPE_TABLE:
     426             : 
     427           0 :                 rStateSet.AddState( AccessibleStateType::FOCUSABLE );
     428             : 
     429           0 :                 if ( m_pImpl->getSelEngine()->GetSelectionMode() == MULTIPLE_SELECTION )
     430           0 :                     rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE);
     431             : 
     432           0 :                 if ( HasChildPathFocus() )
     433           0 :                     rStateSet.AddState( AccessibleStateType::FOCUSED );
     434             : 
     435           0 :                 if ( IsActive() )
     436           0 :                     rStateSet.AddState( AccessibleStateType::ACTIVE );
     437             : 
     438           0 :                 if ( m_pImpl->getDataWindow().IsEnabled() )
     439             :                 {
     440           0 :                     rStateSet.AddState( AccessibleStateType::ENABLED );
     441           0 :                     rStateSet.AddState( AccessibleStateType::SENSITIVE );
     442             :                 }
     443             : 
     444           0 :                 if ( IsReallyVisible() )
     445           0 :                     rStateSet.AddState( AccessibleStateType::VISIBLE );
     446             : 
     447           0 :                 if ( eObjType == TCTYPE_TABLE )
     448           0 :                     rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
     449           0 :                 break;
     450             : 
     451             :             case TCTYPE_ROWHEADERBAR:
     452           0 :                 rStateSet.AddState( AccessibleStateType::VISIBLE );
     453           0 :                 rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
     454           0 :                 break;
     455             : 
     456             :             case TCTYPE_COLUMNHEADERBAR:
     457           0 :                 rStateSet.AddState( AccessibleStateType::VISIBLE );
     458           0 :                 rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
     459           0 :                 break;
     460             : 
     461             :             case TCTYPE_TABLECELL:
     462             :                 {
     463           0 :                     rStateSet.AddState( AccessibleStateType::FOCUSABLE );
     464           0 :                     if ( HasChildPathFocus() )
     465           0 :                         rStateSet.AddState( AccessibleStateType::FOCUSED );
     466           0 :                     rStateSet.AddState( AccessibleStateType::ACTIVE );
     467           0 :                     rStateSet.AddState( AccessibleStateType::TRANSIENT );
     468           0 :                     rStateSet.AddState( AccessibleStateType::SELECTABLE);
     469           0 :                     rStateSet.AddState( AccessibleStateType::VISIBLE );
     470           0 :                     rStateSet.AddState( AccessibleStateType::SHOWING );
     471           0 :                     if ( IsRowSelected( GetCurrentRow() ) )
     472             :                         // Hmm? Wouldn't we expect the affected row to be a parameter to this function?
     473           0 :                         rStateSet.AddState( AccessibleStateType::SELECTED );
     474             :                 }
     475           0 :                 break;
     476             : 
     477             :             case TCTYPE_ROWHEADERCELL:
     478           0 :                 rStateSet.AddState( AccessibleStateType::VISIBLE );
     479           0 :                 rStateSet.AddState( AccessibleStateType::TRANSIENT );
     480           0 :                 break;
     481             : 
     482             :             case TCTYPE_COLUMNHEADERCELL:
     483           0 :                 rStateSet.AddState( AccessibleStateType::VISIBLE );
     484           0 :                 break;
     485             :         }
     486           0 :     }
     487             : 
     488             : 
     489           0 :     void TableControl::commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue )
     490             :     {
     491           0 :         if ( m_pImpl->isAccessibleAlive() )
     492           0 :             m_pImpl->commitCellEvent( i_eventID, i_newValue, i_oldValue );
     493           0 :     }
     494             : 
     495             : 
     496           0 :     void TableControl::commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue )
     497             :     {
     498           0 :         if ( m_pImpl->isAccessibleAlive() )
     499           0 :             m_pImpl->commitTableEvent( i_eventID, i_newValue, i_oldValue );
     500           0 :     }
     501             : 
     502             : 
     503           0 :     Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow ) const
     504             :     {
     505           0 :         return Control::GetWindowExtentsRelative( pRelativeWindow );
     506             :     }
     507             : 
     508             : 
     509           0 :     void TableControl::GrabFocus()
     510             :     {
     511           0 :         Control::GrabFocus();
     512           0 :     }
     513             : 
     514             : 
     515           0 :     Reference< XAccessible > TableControl::GetAccessible( bool bCreate )
     516             :     {
     517           0 :         return Control::GetAccessible( bCreate );
     518             :     }
     519             : 
     520             : 
     521           0 :     Window* TableControl::GetAccessibleParentWindow() const
     522             :     {
     523           0 :         return Control::GetAccessibleParentWindow();
     524             :     }
     525             : 
     526             : 
     527           0 :     Window* TableControl::GetWindowInstance()
     528             :     {
     529           0 :         return this;
     530             :     }
     531             : 
     532             : 
     533           0 :     bool TableControl::HasRowHeader()
     534             :     {
     535           0 :         return GetModel()->hasRowHeaders();
     536             :     }
     537             : 
     538             : 
     539           0 :     bool TableControl::HasColHeader()
     540             :     {
     541           0 :         return GetModel()->hasColumnHeaders();
     542             :     }
     543             : 
     544             : 
     545           0 :     sal_Int32 TableControl::GetAccessibleControlCount() const
     546             :     {
     547             :         // TC_TABLE is always defined, no matter whether empty or not
     548           0 :         sal_Int32 count = 1;
     549           0 :         if ( GetModel()->hasRowHeaders() )
     550           0 :             ++count;
     551           0 :         if ( GetModel()->hasColumnHeaders() )
     552           0 :             ++count;
     553           0 :         return count;
     554             :     }
     555             : 
     556             : 
     557           0 :     bool TableControl::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )
     558             :     {
     559           0 :         sal_Int32 nRow = m_pImpl->getRowAtPoint( _rPoint );
     560           0 :         sal_Int32 nCol = m_pImpl->getColAtPoint( _rPoint );
     561           0 :         _rnIndex = nRow * GetColumnCount() + nCol;
     562           0 :         return nRow >= 0;
     563             :     }
     564             : 
     565             : 
     566           2 :     long TableControl::GetRowCount() const
     567             :     {
     568           2 :         return GetModel()->getRowCount();
     569             :     }
     570             : 
     571             : 
     572           2 :     long TableControl::GetColumnCount() const
     573             :     {
     574           2 :         return GetModel()->getColumnCount();
     575             :     }
     576             : 
     577             : 
     578           0 :     bool TableControl::HasRowHeader() const
     579             :     {
     580           0 :         return GetModel()->hasRowHeaders();
     581             :     }
     582             : 
     583             : 
     584           0 :     bool TableControl::ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )
     585             :     {
     586           0 :         _rnRow = m_pImpl->getRowAtPoint( _rPoint );
     587           0 :         _rnColPos = m_pImpl->getColAtPoint( _rPoint );
     588           0 :         return _rnRow >= 0;
     589             :     }
     590             : 
     591             : 
     592           0 :     void TableControl::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
     593             :     {
     594           0 :         if ( IsRowSelected( _nRow ) )
     595           0 :             _rStateSet.AddState( AccessibleStateType::SELECTED );
     596           0 :         if ( HasChildPathFocus() )
     597           0 :             _rStateSet.AddState( AccessibleStateType::FOCUSED );
     598             :         else // only transient when column is not focused
     599           0 :             _rStateSet.AddState( AccessibleStateType::TRANSIENT );
     600             : 
     601           0 :         _rStateSet.AddState( AccessibleStateType::VISIBLE );
     602           0 :         _rStateSet.AddState( AccessibleStateType::SHOWING );
     603           0 :         _rStateSet.AddState( AccessibleStateType::ENABLED );
     604           0 :         _rStateSet.AddState( AccessibleStateType::SENSITIVE );
     605           0 :         _rStateSet.AddState( AccessibleStateType::ACTIVE );
     606             : 
     607             :         (void)_nColumnPos;
     608           0 :     }
     609             : 
     610             : 
     611           0 :     Rectangle TableControl::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)
     612             :     {
     613             :         (void)_nRow;
     614             :         (void)_nColumnPos;
     615           0 :         return GetCharacterBounds(nIndex);
     616             :     }
     617             : 
     618             : 
     619           0 :     sal_Int32 TableControl::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)
     620             :     {
     621             :         (void)_nRow;
     622             :         (void)_nColumnPos;
     623           0 :         return GetIndexForPoint(_rPoint);
     624             :     }
     625             : 
     626             : 
     627           0 :     Rectangle TableControl::calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen)
     628             :     {
     629             :         (void)_bOnScreen;
     630           0 :         return m_pImpl->calcHeaderRect( _bIsColumnBar ? false : true );
     631             :     }
     632             : 
     633             : 
     634           0 :     Rectangle TableControl::calcHeaderCellRect( bool _bIsColumnBar, sal_Int32 nPos )
     635             :     {
     636           0 :         return m_pImpl->calcHeaderCellRect( _bIsColumnBar, nPos );
     637             :     }
     638             : 
     639             : 
     640           0 :     Rectangle TableControl::calcTableRect(bool _bOnScreen)
     641             :     {
     642             :         (void)_bOnScreen;
     643           0 :         return m_pImpl->calcTableRect();
     644             :     }
     645             : 
     646             : 
     647           0 :     Rectangle TableControl::calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos )
     648             :     {
     649           0 :         return m_pImpl->calcCellRect( _nRowPos, _nColPos );
     650             :     }
     651             : 
     652             : 
     653           0 :     IMPL_LINK_NOARG(TableControl, ImplSelectHdl)
     654             :     {
     655           0 :         Select();
     656           0 :         return 1;
     657             :     }
     658             : 
     659             : 
     660           0 :     void TableControl::Select()
     661             :     {
     662           0 :         ImplCallEventListenersAndHandler( VCLEVENT_TABLEROW_SELECT, m_pImpl->getSelectHandler(), this );
     663             : 
     664           0 :         if ( m_pImpl->isAccessibleAlive() )
     665             :         {
     666           0 :             m_pImpl->commitAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
     667             : 
     668           0 :             m_pImpl->commitTableEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), Any() );
     669             :                 // TODO: why do we notify this when the *selection* changed? Shouldn't we find a better place for this,
     670             :                 // actually, when the active descendant, i.e. the current cell, *really* changed?
     671             :         }
     672           0 :     }
     673             : 
     674             : }} // namespace svt::table
     675             : 
     676             : 
     677             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10