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