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