LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/svtools/source/table - tablecontrol.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 43 276 15.6 %
Date: 2013-07-09 Functions: 16 60 26.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10