LCOV - code coverage report
Current view: top level - libreoffice/svtools/source/table - tablecontrol.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 278 0.0 %
Date: 2012-12-17 Functions: 0 58 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "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           0 :     TableControl::TableControl( Window* _pParent, WinBits _nStyle )
      49             :         :Control( _pParent, _nStyle )
      50           0 :         ,m_pImpl( new TableControl_Impl( *this ) )
      51             :     {
      52           0 :         TableDataWindow& rDataWindow = m_pImpl->getDataWindow();
      53           0 :         rDataWindow.SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) );
      54             : 
      55             :         // by default, use the background as determined by the style settings
      56           0 :         const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
      57           0 :         SetBackground( Wallpaper( aWindowColor ) );
      58           0 :         SetFillColor( aWindowColor );
      59             : 
      60           0 :         SetCompoundControl( true );
      61           0 :     }
      62             : 
      63             :     // -----------------------------------------------------------------------------------------------------------------
      64           0 :     TableControl::~TableControl()
      65             :     {
      66           0 :         ImplCallEventListeners( VCLEVENT_OBJECT_DYING );
      67             : 
      68           0 :         m_pImpl->setModel( PTableModel() );
      69           0 :         m_pImpl->disposeAccessible();
      70           0 :         m_pImpl.reset();
      71           0 :     }
      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           0 :     void TableControl::StateChanged( StateChangedType i_nStateChange )
     118             :     {
     119           0 :         Control::StateChanged( i_nStateChange );
     120             : 
     121             :         // forward certain settings to the data window
     122           0 :         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           0 :     }
     150             : 
     151             :     // -----------------------------------------------------------------------------------------------------------------
     152           0 :     void TableControl::Resize()
     153             :     {
     154           0 :         Control::Resize();
     155           0 :         m_pImpl->onResize();
     156           0 :     }
     157             : 
     158             :     // -----------------------------------------------------------------------------------------------------------------
     159           0 :     void TableControl::SetModel( PTableModel _pModel )
     160             :     {
     161           0 :         m_pImpl->setModel( _pModel );
     162           0 :     }
     163             : 
     164             :     // -----------------------------------------------------------------------------------------------------------------
     165           0 :     PTableModel TableControl::GetModel() const
     166             :     {
     167           0 :         return m_pImpl->getModel();
     168             :     }
     169             : 
     170             :     // -----------------------------------------------------------------------------------------------------------------
     171           0 :     sal_Int32 TableControl::GetCurrentRow() const
     172             :     {
     173           0 :         return m_pImpl->getCurrentRow();
     174             :     }
     175             : 
     176             :     // -----------------------------------------------------------------------------------------------------------------
     177           0 :     sal_Int32 TableControl::GetCurrentColumn() const
     178             :     {
     179           0 :         return m_pImpl->getCurrentColumn();
     180             :     }
     181             : 
     182             :     // -----------------------------------------------------------------------------------------------------------------
     183           0 :     bool TableControl::GoTo( ColPos _nColumn, RowPos _nRow )
     184             :     {
     185           0 :         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           0 :     SelectionEngine* TableControl::getSelEngine()
     263             :     {
     264           0 :         return m_pImpl->getSelEngine();
     265             :     }
     266             : 
     267             :     // -----------------------------------------------------------------------------------------------------------------
     268           0 :     Window& TableControl::getDataWindow()
     269             :     {
     270           0 :         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 :     ::rtl::OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const
     292             :     {
     293           0 :         ::rtl::OUString aRetText;
     294             :         //Window* pWin;
     295           0 :         switch( eObjType )
     296             :         {
     297             :             case TCTYPE_GRIDCONTROL:
     298           0 :                 aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Grid control" ) );
     299           0 :                 break;
     300             :             case TCTYPE_TABLE:
     301           0 :                 aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Grid conrol" ) );
     302           0 :                 break;
     303             :             case TCTYPE_ROWHEADERBAR:
     304           0 :                 aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderBar" ) );
     305           0 :                 break;
     306             :             case TCTYPE_COLUMNHEADERBAR:
     307           0 :                 aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "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           0 :                     aRetText += rtl::OUString::createFromAscii(" , ");
     316             :                 }
     317           0 :                 if(GetModel()->hasRowHeaders())
     318             :                 {
     319           0 :                     aRetText += GetRowName(_nRow);
     320           0 :                     aRetText += rtl::OUString::createFromAscii(" , ");
     321             :                 }
     322             :                 //aRetText = GetAccessibleCellText(_nRow, _nCol);
     323           0 :                 break;
     324             :             case TCTYPE_ROWHEADERCELL:
     325           0 :                 aRetText = GetRowName(_nRow);
     326           0 :                 break;
     327             :             case TCTYPE_COLUMNHEADERCELL:
     328           0 :                 aRetText = GetColumnName(_nCol);
     329           0 :                 break;
     330             :             default:
     331             :                 OSL_FAIL("GridControl::GetAccessibleName: invalid enum!");
     332             :         }
     333           0 :         return aRetText;
     334             :     }
     335             : 
     336             :     //------------------------------------------------------------------------------------------------------------------
     337           0 :     ::rtl::OUString TableControl::GetAccessibleObjectDescription( AccessibleTableControlObjType eObjType, sal_Int32 ) const
     338             :     {
     339           0 :         ::rtl::OUString aRetText;
     340           0 :         switch( eObjType )
     341             :         {
     342             :             case TCTYPE_GRIDCONTROL:
     343           0 :                 aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Grid control description" ) );
     344           0 :                 break;
     345             :             case TCTYPE_TABLE:
     346           0 :                     aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLE description" ) );
     347           0 :                 break;
     348             :             case TCTYPE_ROWHEADERBAR:
     349           0 :                     aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERBAR description" ) );
     350           0 :                 break;
     351             :             case TCTYPE_COLUMNHEADERBAR:
     352           0 :                     aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERBAR description" ) );
     353           0 :                 break;
     354             :             case TCTYPE_TABLECELL:
     355             :                 // the description of the cell consists of column name and row name if defined
     356             :                 // if the name is equal to cell content, it'll be read twice
     357           0 :                 if ( GetModel()->hasColumnHeaders() )
     358             :                 {
     359           0 :                     aRetText = GetColumnName( GetCurrentColumn() );
     360           0 :                     aRetText += rtl::OUString::createFromAscii( " , " );
     361             :                 }
     362           0 :                 if ( GetModel()->hasRowHeaders() )
     363             :                 {
     364           0 :                     aRetText += GetRowName( GetCurrentRow() );
     365             :                 }
     366           0 :                 break;
     367             :             case TCTYPE_ROWHEADERCELL:
     368           0 :                     aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERCELL description" ) );
     369           0 :                 break;
     370             :             case TCTYPE_COLUMNHEADERCELL:
     371           0 :                     aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERCELL description" ) );
     372           0 :                 break;
     373             :         }
     374           0 :         return aRetText;
     375             :     }
     376             : 
     377             :     //------------------------------------------------------------------------------------------------------------------
     378           0 :     ::rtl::OUString TableControl::GetRowDescription( sal_Int32 _nRow) const
     379             :     {
     380             :         (void)_nRow;
     381           0 :         return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "row description" ) );
     382             :     }
     383             : 
     384             :     //------------------------------------------------------------------------------------------------------------------
     385           0 :     ::rtl::OUString TableControl::GetRowName( sal_Int32 _nIndex) const
     386             :     {
     387           0 :         ::rtl::OUString sRowName;
     388           0 :         GetModel()->getRowHeading( _nIndex ) >>= sRowName;
     389           0 :         return sRowName;
     390             :     }
     391             : 
     392             :     //------------------------------------------------------------------------------------------------------------------
     393           0 :     ::rtl::OUString TableControl::GetColumnDescription( sal_uInt16 _nColumn) const
     394             :     {
     395             :         (void)_nColumn;
     396           0 :         return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "col description" ) );
     397             :     }
     398             : 
     399             :     //------------------------------------------------------------------------------------------------------------------
     400           0 :     ::rtl::OUString TableControl::GetColumnName( sal_Int32 _nIndex) const
     401             :     {
     402           0 :         return GetModel()->getColumnModel(_nIndex)->getName();
     403             :     }
     404             : 
     405             :     //------------------------------------------------------------------------------------------------------------------
     406           0 :     ::com::sun::star::uno::Any TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos ) const
     407             :     {
     408           0 :         Any aCellContent;
     409           0 :         GetModel()->getCellContent( _nColPos, _nRowPos, aCellContent );
     410           0 :         return aCellContent;
     411             :     }
     412             : 
     413             :     //------------------------------------------------------------------------------------------------------------------
     414           0 :     ::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
     415             :     {
     416           0 :         return m_pImpl->getCellContentAsString( _nRowPos, _nColPos );
     417             :     }
     418             : 
     419             :     //------------------------------------------------------------------------------------------------------------------
     420           0 :     void TableControl::FillAccessibleStateSet(
     421             :             ::utl::AccessibleStateSetHelper& rStateSet,
     422             :             AccessibleTableControlObjType eObjType ) const
     423             :     {
     424           0 :         switch( eObjType )
     425             :         {
     426             :             case TCTYPE_GRIDCONTROL:
     427             :             case TCTYPE_TABLE:
     428             : 
     429           0 :                 rStateSet.AddState( AccessibleStateType::FOCUSABLE );
     430             : 
     431           0 :                 if ( m_pImpl->getSelEngine()->GetSelectionMode() == MULTIPLE_SELECTION )
     432           0 :                     rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE);
     433             : 
     434           0 :                 if ( HasChildPathFocus() )
     435           0 :                     rStateSet.AddState( AccessibleStateType::FOCUSED );
     436             : 
     437           0 :                 if ( IsActive() )
     438           0 :                     rStateSet.AddState( AccessibleStateType::ACTIVE );
     439             : 
     440           0 :                 if ( m_pImpl->getDataWindow().IsEnabled() )
     441             :                 {
     442           0 :                     rStateSet.AddState( AccessibleStateType::ENABLED );
     443           0 :                     rStateSet.AddState( AccessibleStateType::SENSITIVE );
     444             :                 }
     445             : 
     446           0 :                 if ( IsReallyVisible() )
     447           0 :                     rStateSet.AddState( AccessibleStateType::VISIBLE );
     448             : 
     449           0 :                 if ( eObjType == TCTYPE_TABLE )
     450           0 :                     rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
     451           0 :                 break;
     452             : 
     453             :             case TCTYPE_ROWHEADERBAR:
     454           0 :                 rStateSet.AddState( AccessibleStateType::VISIBLE );
     455           0 :                 rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
     456           0 :                 break;
     457             : 
     458             :             case TCTYPE_COLUMNHEADERBAR:
     459           0 :                 rStateSet.AddState( AccessibleStateType::VISIBLE );
     460           0 :                 rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
     461           0 :                 break;
     462             : 
     463             :             case TCTYPE_TABLECELL:
     464             :                 {
     465           0 :                     rStateSet.AddState( AccessibleStateType::FOCUSABLE );
     466           0 :                     if ( HasChildPathFocus() )
     467           0 :                         rStateSet.AddState( AccessibleStateType::FOCUSED );
     468           0 :                     rStateSet.AddState( AccessibleStateType::ACTIVE );
     469           0 :                     rStateSet.AddState( AccessibleStateType::TRANSIENT );
     470           0 :                     rStateSet.AddState( AccessibleStateType::SELECTABLE);
     471           0 :                     rStateSet.AddState( AccessibleStateType::VISIBLE );
     472           0 :                     rStateSet.AddState( AccessibleStateType::SHOWING );
     473           0 :                     if ( IsRowSelected( GetCurrentRow() ) )
     474             :                         // Hmm? Wouldn't we expect the affected row to be a parameter to this function?
     475           0 :                         rStateSet.AddState( AccessibleStateType::SELECTED );
     476             :                 }
     477           0 :                 break;
     478             : 
     479             :             case TCTYPE_ROWHEADERCELL:
     480           0 :                 rStateSet.AddState( AccessibleStateType::VISIBLE );
     481           0 :                 rStateSet.AddState( AccessibleStateType::TRANSIENT );
     482           0 :                 break;
     483             : 
     484             :             case TCTYPE_COLUMNHEADERCELL:
     485           0 :                 rStateSet.AddState( AccessibleStateType::VISIBLE );
     486           0 :                 break;
     487             :         }
     488           0 :     }
     489             : 
     490             :     //------------------------------------------------------------------------------------------------------------------
     491           0 :     void TableControl::commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue )
     492             :     {
     493           0 :         if ( m_pImpl->isAccessibleAlive() )
     494           0 :             m_pImpl->commitCellEvent( i_eventID, i_newValue, i_oldValue );
     495           0 :     }
     496             : 
     497             :     //------------------------------------------------------------------------------------------------------------------
     498           0 :     void TableControl::commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue )
     499             :     {
     500           0 :         if ( m_pImpl->isAccessibleAlive() )
     501           0 :             m_pImpl->commitTableEvent( i_eventID, i_newValue, i_oldValue );
     502           0 :     }
     503             : 
     504             :     //------------------------------------------------------------------------------------------------------------------
     505           0 :     Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow ) const
     506             :     {
     507           0 :         return Control::GetWindowExtentsRelative( pRelativeWindow );
     508             :     }
     509             : 
     510             :     //------------------------------------------------------------------------------------------------------------------
     511           0 :     void TableControl::GrabFocus()
     512             :     {
     513           0 :         Control::GrabFocus();
     514           0 :     }
     515             : 
     516             :     //------------------------------------------------------------------------------------------------------------------
     517           0 :     Reference< XAccessible > TableControl::GetAccessible( sal_Bool bCreate )
     518             :     {
     519           0 :         return Control::GetAccessible( bCreate );
     520             :     }
     521             : 
     522             :     //------------------------------------------------------------------------------------------------------------------
     523           0 :     Window* TableControl::GetAccessibleParentWindow() const
     524             :     {
     525           0 :         return Control::GetAccessibleParentWindow();
     526             :     }
     527             : 
     528             :     //------------------------------------------------------------------------------------------------------------------
     529           0 :     Window* TableControl::GetWindowInstance()
     530             :     {
     531           0 :         return this;
     532             :     }
     533             : 
     534             :     //------------------------------------------------------------------------------------------------------------------
     535           0 :     sal_Bool TableControl::HasRowHeader()
     536             :     {
     537           0 :         return GetModel()->hasRowHeaders();
     538             :     }
     539             : 
     540             :     //------------------------------------------------------------------------------------------------------------------
     541           0 :     sal_Bool TableControl::HasColHeader()
     542             :     {
     543           0 :         return GetModel()->hasColumnHeaders();
     544             :     }
     545             : 
     546             :     //------------------------------------------------------------------------------------------------------------------
     547           0 :     sal_Int32 TableControl::GetAccessibleControlCount() const
     548             :     {
     549             :         // TC_TABLE is always defined, no matter whether empty or not
     550           0 :         sal_Int32 count = 1;
     551           0 :         if ( GetModel()->hasRowHeaders() )
     552           0 :             ++count;
     553           0 :         if ( GetModel()->hasColumnHeaders() )
     554           0 :             ++count;
     555           0 :         return count;
     556             :     }
     557             : 
     558             :     //------------------------------------------------------------------------------------------------------------------
     559           0 :     sal_Bool TableControl::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )
     560             :     {
     561           0 :         sal_Int32 nRow = m_pImpl->getRowAtPoint( _rPoint );
     562           0 :         sal_Int32 nCol = m_pImpl->getColAtPoint( _rPoint );
     563           0 :         _rnIndex = nRow * GetColumnCount() + nCol;
     564           0 :         return nRow >= 0 ? sal_True : sal_False;
     565             :     }
     566             : 
     567             :     //------------------------------------------------------------------------------------------------------------------
     568           0 :     long TableControl::GetRowCount() const
     569             :     {
     570           0 :         return GetModel()->getRowCount();
     571             :     }
     572             : 
     573             :     //------------------------------------------------------------------------------------------------------------------
     574           0 :     long TableControl::GetColumnCount() const
     575             :     {
     576           0 :         return GetModel()->getColumnCount();
     577             :     }
     578             : 
     579             :     //------------------------------------------------------------------------------------------------------------------
     580           0 :     sal_Bool TableControl::HasRowHeader() const
     581             :     {
     582           0 :         return GetModel()->hasRowHeaders();
     583             :     }
     584             : 
     585             :     //------------------------------------------------------------------------------------------------------------------
     586           0 :     sal_Bool TableControl::ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )
     587             :     {
     588           0 :         _rnRow = m_pImpl->getRowAtPoint( _rPoint );
     589           0 :         _rnColPos = m_pImpl->getColAtPoint( _rPoint );
     590           0 :         return _rnRow >= 0 ? sal_True : sal_False;
     591             :     }
     592             : 
     593             :     //------------------------------------------------------------------------------------------------------------------
     594           0 :     void TableControl::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
     595             :     {
     596           0 :         if ( IsRowSelected( _nRow ) )
     597           0 :             _rStateSet.AddState( AccessibleStateType::SELECTED );
     598           0 :         if ( HasChildPathFocus() )
     599           0 :             _rStateSet.AddState( AccessibleStateType::FOCUSED );
     600             :         else // only transient when column is not focused
     601           0 :             _rStateSet.AddState( AccessibleStateType::TRANSIENT );
     602             : 
     603           0 :         _rStateSet.AddState( AccessibleStateType::VISIBLE );
     604           0 :         _rStateSet.AddState( AccessibleStateType::SHOWING );
     605           0 :         _rStateSet.AddState( AccessibleStateType::ENABLED );
     606           0 :         _rStateSet.AddState( AccessibleStateType::SENSITIVE );
     607           0 :         _rStateSet.AddState( AccessibleStateType::ACTIVE );
     608             : 
     609             :         (void)_nColumnPos;
     610           0 :     }
     611             : 
     612             :     //------------------------------------------------------------------------------------------------------------------
     613           0 :     Rectangle TableControl::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)
     614             :     {
     615             :         (void)_nRow;
     616             :         (void)_nColumnPos;
     617           0 :         return GetCharacterBounds(nIndex);
     618             :     }
     619             : 
     620             :     //------------------------------------------------------------------------------------------------------------------
     621           0 :     sal_Int32 TableControl::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)
     622             :     {
     623             :         (void)_nRow;
     624             :         (void)_nColumnPos;
     625           0 :         return GetIndexForPoint(_rPoint);
     626             :     }
     627             : 
     628             :     //------------------------------------------------------------------------------------------------------------------
     629           0 :     Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,sal_Bool _bOnScreen)
     630             :     {
     631             :         (void)_bOnScreen;
     632           0 :         return m_pImpl->calcHeaderRect( _bIsColumnBar ? false : true );
     633             :     }
     634             : 
     635             :     //------------------------------------------------------------------------------------------------------------------
     636           0 :     Rectangle TableControl::calcHeaderCellRect( sal_Bool _bIsColumnBar, sal_Int32 nPos )
     637             :     {
     638           0 :         return m_pImpl->calcHeaderCellRect( _bIsColumnBar, nPos );
     639             :     }
     640             : 
     641             :     //------------------------------------------------------------------------------------------------------------------
     642           0 :     Rectangle TableControl::calcTableRect(sal_Bool _bOnScreen)
     643             :     {
     644             :         (void)_bOnScreen;
     645           0 :         return m_pImpl->calcTableRect();
     646             :     }
     647             : 
     648             :     //------------------------------------------------------------------------------------------------------------------
     649           0 :     Rectangle TableControl::calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos )
     650             :     {
     651           0 :         return m_pImpl->calcCellRect( _nRowPos, _nColPos );
     652             :     }
     653             : 
     654             :     //------------------------------------------------------------------------------------------------------------------
     655           0 :     IMPL_LINK_NOARG(TableControl, ImplSelectHdl)
     656             :     {
     657           0 :         Select();
     658           0 :         return 1;
     659             :     }
     660             : 
     661             :     //------------------------------------------------------------------------------------------------------------------
     662           0 :     void TableControl::Select()
     663             :     {
     664           0 :         ImplCallEventListenersAndHandler( VCLEVENT_TABLEROW_SELECT, m_pImpl->getSelectHandler(), this );
     665             : 
     666           0 :         if ( m_pImpl->isAccessibleAlive() )
     667             :         {
     668           0 :             m_pImpl->commitAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
     669             : 
     670           0 :             m_pImpl->commitTableEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), Any() );
     671             :                 // TODO: why do we notify this when the *selection* changed? Shouldn't we find a better place for this,
     672             :                 // actually, when the active descendant, i.e. the current cell, *really* changed?
     673             :         }
     674           0 :     }
     675             : 
     676             : }} // namespace svt::table
     677             : 
     678             : //......................................................................................................................
     679             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10