Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 : : *
5 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
6 : : *
7 : : * OpenOffice.org - a multi-platform office productivity suite
8 : : *
9 : : * This file is part of OpenOffice.org.
10 : : *
11 : : * OpenOffice.org is free software: you can redistribute it and/or modify
12 : : * it under the terms of the GNU Lesser General Public License version 3
13 : : * only, as published by the Free Software Foundation.
14 : : *
15 : : * OpenOffice.org is distributed in the hope that it will be useful,
16 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 : : * GNU Lesser General Public License version 3 for more details
19 : : * (a copy is included in the LICENSE file that accompanied this code).
20 : : *
21 : : * You should have received a copy of the GNU Lesser General Public License
22 : : * version 3 along with OpenOffice.org. If not, see
23 : : * <http://www.openoffice.org/license.html>
24 : : * for a copy of the LGPLv3 License.
25 : : *
26 : : ************************************************************************/
27 : :
28 : :
29 : : #include "svtools/table/tablecontrol.hxx"
30 : :
31 : : #include "tablegeometry.hxx"
32 : : #include "tablecontrol_impl.hxx"
33 : : #include "tabledatawindow.hxx"
34 : :
35 : : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
36 : : #include <com/sun/star/accessibility/AccessibleRole.hpp>
37 : :
38 : : #include <tools/diagnose_ex.h>
39 : :
40 : : using namespace ::com::sun::star::uno;
41 : : using ::com::sun::star::accessibility::XAccessible;
42 : : using namespace ::com::sun::star::accessibility;
43 : : using namespace ::com::sun::star::lang;
44 : : using namespace utl;
45 : : //......................................................................................................................
46 : : namespace svt { namespace table
47 : : {
48 : : //......................................................................................................................
49 : :
50 : : //==================================================================================================================
51 : : //= TableControl
52 : : //==================================================================================================================
53 : : // -----------------------------------------------------------------------------------------------------------------
54 : 0 : TableControl::TableControl( Window* _pParent, WinBits _nStyle )
55 : : :Control( _pParent, _nStyle )
56 [ # # ][ # # ]: 0 : ,m_pImpl( new TableControl_Impl( *this ) )
[ # # ]
57 : : {
58 [ # # ]: 0 : TableDataWindow& rDataWindow = m_pImpl->getDataWindow();
59 [ # # ]: 0 : rDataWindow.SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) );
60 [ # # ]: 0 : rDataWindow.SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) );
61 [ # # ]: 0 : rDataWindow.SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) );
62 : :
63 : : // by default, use the background as determined by the style settings
64 : 0 : const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() );
65 [ # # ][ # # ]: 0 : SetBackground( Wallpaper( aWindowColor ) );
[ # # ]
66 [ # # ]: 0 : SetFillColor( aWindowColor );
67 : 0 : }
68 : :
69 : : // -----------------------------------------------------------------------------------------------------------------
70 [ # # ]: 0 : TableControl::~TableControl()
71 : : {
72 [ # # ]: 0 : ImplCallEventListeners( VCLEVENT_OBJECT_DYING );
73 : :
74 [ # # ][ # # ]: 0 : m_pImpl->setModel( PTableModel() );
[ # # ]
75 [ # # ]: 0 : m_pImpl->disposeAccessible();
76 [ # # ]: 0 : m_pImpl.reset();
77 [ # # ]: 0 : }
78 : :
79 : : // -----------------------------------------------------------------------------------------------------------------
80 : 0 : void TableControl::GetFocus()
81 : : {
82 [ # # ]: 0 : if ( !m_pImpl->getInputHandler()->GetFocus( *m_pImpl ) )
83 : 0 : Control::GetFocus();
84 : 0 : }
85 : :
86 : : // -----------------------------------------------------------------------------------------------------------------
87 : 0 : void TableControl::LoseFocus()
88 : : {
89 [ # # ]: 0 : if ( !m_pImpl->getInputHandler()->LoseFocus( *m_pImpl ) )
90 : 0 : Control::LoseFocus();
91 : 0 : }
92 : :
93 : : // -----------------------------------------------------------------------------------------------------------------
94 : 0 : void TableControl::KeyInput( const KeyEvent& rKEvt )
95 : : {
96 [ # # ]: 0 : if ( !m_pImpl->getInputHandler()->KeyInput( *m_pImpl, rKEvt ) )
97 : 0 : Control::KeyInput( rKEvt );
98 : 0 : }
99 : :
100 : :
101 : : // -----------------------------------------------------------------------------------------------------------------
102 : 0 : void TableControl::StateChanged( StateChangedType i_nStateChange )
103 : : {
104 : 0 : Control::StateChanged( i_nStateChange );
105 : :
106 : : // forward certain settings to the data window
107 [ # # # # ]: 0 : switch ( i_nStateChange )
108 : : {
109 : : case STATE_CHANGE_CONTROLBACKGROUND:
110 [ # # ]: 0 : if ( IsControlBackground() )
111 [ # # ][ # # ]: 0 : getDataWindow().SetControlBackground( GetControlBackground() );
112 : : else
113 : 0 : getDataWindow().SetControlBackground();
114 : 0 : break;
115 : :
116 : : case STATE_CHANGE_CONTROLFOREGROUND:
117 [ # # ]: 0 : if ( IsControlForeground() )
118 [ # # ][ # # ]: 0 : getDataWindow().SetControlForeground( GetControlForeground() );
119 : : else
120 : 0 : getDataWindow().SetControlForeground();
121 : 0 : break;
122 : :
123 : : case STATE_CHANGE_CONTROLFONT:
124 [ # # ]: 0 : if ( IsControlFont() )
125 [ # # ][ # # ]: 0 : getDataWindow().SetControlFont( GetControlFont() );
126 : : else
127 : 0 : getDataWindow().SetControlFont();
128 : 0 : break;
129 : : }
130 : 0 : }
131 : :
132 : : // -----------------------------------------------------------------------------------------------------------------
133 : 0 : void TableControl::Resize()
134 : : {
135 : 0 : Control::Resize();
136 : 0 : m_pImpl->onResize();
137 : 0 : }
138 : :
139 : : // -----------------------------------------------------------------------------------------------------------------
140 : 0 : void TableControl::SetModel( PTableModel _pModel )
141 : : {
142 [ # # ]: 0 : m_pImpl->setModel( _pModel );
143 : 0 : }
144 : :
145 : : // -----------------------------------------------------------------------------------------------------------------
146 : 0 : PTableModel TableControl::GetModel() const
147 : : {
148 : 0 : return m_pImpl->getModel();
149 : : }
150 : :
151 : : // -----------------------------------------------------------------------------------------------------------------
152 : 0 : sal_Int32 TableControl::GetCurrentRow() const
153 : : {
154 : 0 : return m_pImpl->getCurrentRow();
155 : : }
156 : :
157 : : // -----------------------------------------------------------------------------------------------------------------
158 : 0 : sal_Int32 TableControl::GetCurrentColumn() const
159 : : {
160 : 0 : return m_pImpl->getCurrentColumn();
161 : : }
162 : :
163 : : // -----------------------------------------------------------------------------------------------------------------
164 : 0 : sal_Bool TableControl::GoToCell(sal_Int32 _nColPos, sal_Int32 _nRowPos)
165 : : {
166 : 0 : return m_pImpl->goTo( _nColPos, _nRowPos );
167 : : }
168 : :
169 : : //------------------------------------------------------------------------------------------------------------------
170 : 0 : sal_Int32 TableControl::GetSelectedRowCount() const
171 : : {
172 : 0 : return sal_Int32( m_pImpl->getSelectedRowCount() );
173 : : }
174 : :
175 : : //------------------------------------------------------------------------------------------------------------------
176 : 0 : sal_Int32 TableControl::GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const
177 : : {
178 : 0 : return sal_Int32( m_pImpl->getSelectedRowIndex( i_selectionIndex ) );
179 : : }
180 : :
181 : : //------------------------------------------------------------------------------------------------------------------
182 : 0 : bool TableControl::IsRowSelected( sal_Int32 const i_rowIndex ) const
183 : : {
184 : 0 : return m_pImpl->isRowSelected( i_rowIndex );
185 : : }
186 : :
187 : : // -----------------------------------------------------------------------------------------------------------------
188 : 0 : void TableControl::SelectRow( RowPos const i_rowIndex, bool const i_select )
189 : : {
190 [ # # ][ # # ]: 0 : ENSURE_OR_RETURN_VOID( ( i_rowIndex >= 0 ) && ( i_rowIndex < m_pImpl->getModel()->getRowCount() ),
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
191 : : "TableControl::SelectRow: no control (anymore)!" );
192 : :
193 [ # # ]: 0 : if ( i_select )
194 : : {
195 [ # # ]: 0 : if ( !m_pImpl->markRowAsSelected( i_rowIndex ) )
196 : : // nothing to do
197 : 0 : return;
198 : : }
199 : : else
200 : : {
201 : 0 : m_pImpl->markRowAsDeselected( i_rowIndex );
202 : : }
203 : :
204 : 0 : m_pImpl->invalidateRowRange( i_rowIndex, i_rowIndex );
205 : 0 : Select();
206 : : }
207 : :
208 : : // -----------------------------------------------------------------------------------------------------------------
209 : 0 : void TableControl::SelectAllRows( bool const i_select )
210 : : {
211 [ # # ]: 0 : if ( i_select )
212 : : {
213 [ # # ]: 0 : if ( !m_pImpl->markAllRowsAsSelected() )
214 : : // nothing to do
215 : 0 : return;
216 : : }
217 : : else
218 : : {
219 [ # # ]: 0 : if ( !m_pImpl->markAllRowsAsDeselected() )
220 : : // nothing to do
221 : 0 : return;
222 : : }
223 : :
224 : :
225 : 0 : Invalidate();
226 : : // TODO: can't we do better than this, and invalidate only the rows which changed?
227 : 0 : Select();
228 : : }
229 : :
230 : : // -----------------------------------------------------------------------------------------------------------------
231 : 0 : ITableControl& TableControl::getTableControlInterface()
232 : : {
233 : 0 : return *m_pImpl;
234 : : }
235 : :
236 : : // -----------------------------------------------------------------------------------------------------------------
237 : 0 : SelectionEngine* TableControl::getSelEngine()
238 : : {
239 : 0 : return m_pImpl->getSelEngine();
240 : : }
241 : :
242 : : // -----------------------------------------------------------------------------------------------------------------
243 : 0 : Window& TableControl::getDataWindow()
244 : : {
245 : 0 : return m_pImpl->getDataWindow();
246 : : }
247 : :
248 : : // -----------------------------------------------------------------------------------------------------------------
249 : 0 : Reference< XAccessible > TableControl::CreateAccessible()
250 : : {
251 : 0 : Window* pParent = GetAccessibleParentWindow();
252 [ # # ]: 0 : ENSURE_OR_RETURN( pParent, "TableControl::CreateAccessible - parent not found", NULL );
253 : :
254 : 0 : return m_pImpl->getAccessible( *pParent );
255 : : }
256 : :
257 : : // -----------------------------------------------------------------------------------------------------------------
258 : 0 : Reference<XAccessible> TableControl::CreateAccessibleControl( sal_Int32 _nIndex )
259 : : {
260 : : (void)_nIndex;
261 : : DBG_ASSERT( sal_False, "TableControl::CreateAccessibleControl: to be overwritten!" );
262 : 0 : return NULL;
263 : : }
264 : :
265 : : // -----------------------------------------------------------------------------------------------------------------
266 : 0 : ::rtl::OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const
267 : : {
268 : 0 : ::rtl::OUString aRetText;
269 : : //Window* pWin;
270 [ # # # # : 0 : switch( eObjType )
# # # # ]
271 : : {
272 : : case TCTYPE_GRIDCONTROL:
273 [ # # ]: 0 : aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl" ) );
274 : 0 : break;
275 : : case TCTYPE_TABLE:
276 [ # # ]: 0 : aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Table" ) );
277 : 0 : break;
278 : : case TCTYPE_ROWHEADERBAR:
279 [ # # ]: 0 : aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderBar" ) );
280 : 0 : break;
281 : : case TCTYPE_COLUMNHEADERBAR:
282 [ # # ]: 0 : aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) );
283 : 0 : break;
284 : : case TCTYPE_TABLECELL:
285 [ # # ]: 0 : aRetText = GetAccessibleCellText(_nRow, _nCol);
286 : 0 : break;
287 : : case TCTYPE_ROWHEADERCELL:
288 [ # # ]: 0 : aRetText = GetRowName(_nRow);
289 : 0 : break;
290 : : case TCTYPE_COLUMNHEADERCELL:
291 [ # # ]: 0 : aRetText = GetColumnName(_nCol);
292 : 0 : break;
293 : : default:
294 : : OSL_FAIL("GridControl::GetAccessibleName: invalid enum!");
295 : : }
296 : 0 : return aRetText;
297 : : }
298 : :
299 : : //------------------------------------------------------------------------------------------------------------------
300 : 0 : ::rtl::OUString TableControl::GetAccessibleObjectDescription( AccessibleTableControlObjType eObjType, sal_Int32 ) const
301 : : {
302 : 0 : ::rtl::OUString aRetText;
303 [ # # # # : 0 : switch( eObjType )
# # # # ]
304 : : {
305 : : case TCTYPE_GRIDCONTROL:
306 [ # # ]: 0 : aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl description" ) );
307 : 0 : break;
308 : : case TCTYPE_TABLE:
309 [ # # ]: 0 : aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLE description" ) );
310 : 0 : break;
311 : : case TCTYPE_ROWHEADERBAR:
312 [ # # ]: 0 : aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERBAR description" ) );
313 : 0 : break;
314 : : case TCTYPE_COLUMNHEADERBAR:
315 [ # # ]: 0 : aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERBAR description" ) );
316 : 0 : break;
317 : : case TCTYPE_TABLECELL:
318 [ # # ]: 0 : aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLECELL description" ) );
319 : 0 : break;
320 : : case TCTYPE_ROWHEADERCELL:
321 [ # # ]: 0 : aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERCELL description" ) );
322 : 0 : break;
323 : : case TCTYPE_COLUMNHEADERCELL:
324 [ # # ]: 0 : aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERCELL description" ) );
325 : 0 : break;
326 : : }
327 : 0 : return aRetText;
328 : : }
329 : :
330 : : //------------------------------------------------------------------------------------------------------------------
331 : 0 : ::rtl::OUString TableControl::GetRowDescription( sal_Int32 _nRow) const
332 : : {
333 : : (void)_nRow;
334 : 0 : return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "row description" ) );
335 : : }
336 : :
337 : : //------------------------------------------------------------------------------------------------------------------
338 : 0 : ::rtl::OUString TableControl::GetRowName( sal_Int32 _nIndex) const
339 : : {
340 : 0 : ::rtl::OUString sRowName;
341 [ # # ][ # # ]: 0 : GetModel()->getRowHeading( _nIndex ) >>= sRowName;
[ # # ]
342 : 0 : return sRowName;
343 : : }
344 : :
345 : : //------------------------------------------------------------------------------------------------------------------
346 : 0 : ::rtl::OUString TableControl::GetColumnDescription( sal_uInt16 _nColumn) const
347 : : {
348 : : (void)_nColumn;
349 : 0 : return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "col description" ) );
350 : : }
351 : :
352 : : //------------------------------------------------------------------------------------------------------------------
353 : 0 : ::rtl::OUString TableControl::GetColumnName( sal_Int32 _nIndex) const
354 : : {
355 [ # # ][ # # ]: 0 : return GetModel()->getColumnModel(_nIndex)->getName();
[ # # ][ # # ]
[ # # ]
356 : : }
357 : :
358 : : //------------------------------------------------------------------------------------------------------------------
359 : 0 : ::com::sun::star::uno::Any TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos ) const
360 : : {
361 : 0 : Any aCellContent;
362 [ # # ][ # # ]: 0 : GetModel()->getCellContent( _nColPos, _nRowPos, aCellContent );
[ # # ]
363 : 0 : return aCellContent;
364 : : }
365 : :
366 : : //------------------------------------------------------------------------------------------------------------------
367 : 0 : ::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
368 : : {
369 : 0 : return m_pImpl->getCellContentAsString( _nRowPos, _nColPos );
370 : : }
371 : :
372 : : //------------------------------------------------------------------------------------------------------------------
373 : 0 : void TableControl::FillAccessibleStateSet(
374 : : ::utl::AccessibleStateSetHelper& rStateSet,
375 : : AccessibleTableControlObjType eObjType ) const
376 : : {
377 [ # # # # : 0 : switch( eObjType )
# # # ]
378 : : {
379 : : case TCTYPE_GRIDCONTROL:
380 : : case TCTYPE_TABLE:
381 : :
382 : 0 : rStateSet.AddState( AccessibleStateType::FOCUSABLE );
383 : 0 : rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE);
384 [ # # ]: 0 : if ( HasFocus() )
385 : 0 : rStateSet.AddState( AccessibleStateType::FOCUSED );
386 [ # # ]: 0 : if ( IsActive() )
387 : 0 : rStateSet.AddState( AccessibleStateType::ACTIVE );
388 [ # # ]: 0 : if ( IsEnabled() )
389 : 0 : rStateSet.AddState( AccessibleStateType::ENABLED );
390 [ # # ]: 0 : if ( IsReallyVisible() )
391 : 0 : rStateSet.AddState( AccessibleStateType::VISIBLE );
392 : 0 : rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
393 : :
394 : 0 : break;
395 : : case TCTYPE_ROWHEADERBAR:
396 : 0 : rStateSet.AddState( AccessibleStateType::VISIBLE );
397 : 0 : rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
398 : 0 : break;
399 : : case TCTYPE_COLUMNHEADERBAR:
400 : 0 : rStateSet.AddState( AccessibleStateType::VISIBLE );
401 : 0 : rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
402 : 0 : break;
403 : : case TCTYPE_TABLECELL:
404 : : {
405 : 0 : rStateSet.AddState( AccessibleStateType::TRANSIENT );
406 : 0 : rStateSet.AddState( AccessibleStateType::SELECTABLE);
407 [ # # ]: 0 : if( GetSelectedRowCount()>0)
408 : 0 : rStateSet.AddState( AccessibleStateType::SELECTED);
409 : : }
410 : 0 : break;
411 : : case TCTYPE_ROWHEADERCELL:
412 : 0 : rStateSet.AddState( AccessibleStateType::VISIBLE );
413 : 0 : rStateSet.AddState( AccessibleStateType::TRANSIENT );
414 : 0 : break;
415 : : case TCTYPE_COLUMNHEADERCELL:
416 : 0 : rStateSet.AddState( AccessibleStateType::VISIBLE );
417 : 0 : break;
418 : : }
419 : 0 : }
420 : :
421 : : //------------------------------------------------------------------------------------------------------------------
422 : 0 : Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow ) const
423 : : {
424 : 0 : return Control::GetWindowExtentsRelative( pRelativeWindow );
425 : : }
426 : :
427 : : //------------------------------------------------------------------------------------------------------------------
428 : 0 : void TableControl::GrabFocus()
429 : : {
430 : 0 : Control::GrabFocus();
431 : 0 : }
432 : :
433 : : //------------------------------------------------------------------------------------------------------------------
434 : 0 : Reference< XAccessible > TableControl::GetAccessible( sal_Bool bCreate )
435 : : {
436 : 0 : return Control::GetAccessible( bCreate );
437 : : }
438 : :
439 : : //------------------------------------------------------------------------------------------------------------------
440 : 0 : Window* TableControl::GetAccessibleParentWindow() const
441 : : {
442 : 0 : return Control::GetAccessibleParentWindow();
443 : : }
444 : :
445 : : //------------------------------------------------------------------------------------------------------------------
446 : 0 : Window* TableControl::GetWindowInstance()
447 : : {
448 : 0 : return this;
449 : : }
450 : :
451 : : //------------------------------------------------------------------------------------------------------------------
452 : 0 : sal_Bool TableControl::HasRowHeader()
453 : : {
454 [ # # ]: 0 : return GetModel()->hasRowHeaders();
455 : : }
456 : :
457 : : //------------------------------------------------------------------------------------------------------------------
458 : 0 : sal_Bool TableControl::HasColHeader()
459 : : {
460 [ # # ]: 0 : return GetModel()->hasColumnHeaders();
461 : : }
462 : :
463 : : //------------------------------------------------------------------------------------------------------------------
464 : 0 : sal_Int32 TableControl::GetAccessibleControlCount() const
465 : : {
466 : 0 : sal_Int32 count = 0;
467 [ # # ]: 0 : if(GetRowCount()>0)
468 : 0 : count+=1;
469 [ # # ][ # # ]: 0 : if(GetModel()->hasRowHeaders())
470 : 0 : count+=1;
471 [ # # ][ # # ]: 0 : if(GetModel()->hasColumnHeaders())
472 : 0 : count+=1;
473 : 0 : return count;
474 : : }
475 : :
476 : : //------------------------------------------------------------------------------------------------------------------
477 : 0 : sal_Bool TableControl::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )
478 : : {
479 : 0 : sal_Int32 nRow = m_pImpl->getRowAtPoint( _rPoint );
480 : 0 : sal_Int32 nCol = m_pImpl->getColAtPoint( _rPoint );
481 : 0 : _rnIndex = nRow * GetColumnCount() + nCol;
482 [ # # ]: 0 : return nRow >= 0 ? sal_True : sal_False;
483 : : }
484 : :
485 : : //------------------------------------------------------------------------------------------------------------------
486 : 0 : long TableControl::GetRowCount() const
487 : : {
488 [ # # ]: 0 : return GetModel()->getRowCount();
489 : : }
490 : :
491 : : //------------------------------------------------------------------------------------------------------------------
492 : 0 : long TableControl::GetColumnCount() const
493 : : {
494 [ # # ]: 0 : return GetModel()->getColumnCount();
495 : : }
496 : :
497 : : //------------------------------------------------------------------------------------------------------------------
498 : 0 : sal_Bool TableControl::HasRowHeader() const
499 : : {
500 [ # # ]: 0 : return GetModel()->hasRowHeaders();
501 : : }
502 : :
503 : : //------------------------------------------------------------------------------------------------------------------
504 : 0 : sal_Bool TableControl::ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )
505 : : {
506 : 0 : _rnRow = m_pImpl->getRowAtPoint( _rPoint );
507 : 0 : _rnColPos = m_pImpl->getColAtPoint( _rPoint );
508 [ # # ]: 0 : return _rnRow >= 0 ? sal_True : sal_False;
509 : : }
510 : :
511 : : //------------------------------------------------------------------------------------------------------------------
512 : 0 : void TableControl::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
513 : : {
514 [ # # ][ # # ]: 0 : if ( GetCurrentRow() == _nRow && GetCurrentColumn() == _nColumnPos )
[ # # ]
515 : 0 : _rStateSet.AddState( AccessibleStateType::FOCUSED );
516 : : else // only transient when column is not focused
517 : 0 : _rStateSet.AddState( AccessibleStateType::TRANSIENT );
518 : 0 : }
519 : :
520 : : //------------------------------------------------------------------------------------------------------------------
521 : 0 : Rectangle TableControl::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)
522 : : {
523 : : (void)_nRow;
524 : : (void)_nColumnPos;
525 : 0 : return GetCharacterBounds(nIndex);
526 : : }
527 : :
528 : : //------------------------------------------------------------------------------------------------------------------
529 : 0 : sal_Int32 TableControl::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)
530 : : {
531 : : (void)_nRow;
532 : : (void)_nColumnPos;
533 : 0 : return GetIndexForPoint(_rPoint);
534 : : }
535 : :
536 : : //------------------------------------------------------------------------------------------------------------------
537 : 0 : Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,sal_Bool _bOnScreen)
538 : : {
539 : : (void)_bOnScreen;
540 : 0 : return m_pImpl->calcHeaderRect( _bIsColumnBar ? false : true );
541 : : }
542 : :
543 : : //------------------------------------------------------------------------------------------------------------------
544 : 0 : Rectangle TableControl::calcTableRect(sal_Bool _bOnScreen)
545 : : {
546 : : (void)_bOnScreen;
547 : 0 : return m_pImpl->calcTableRect();
548 : : }
549 : :
550 : : //------------------------------------------------------------------------------------------------------------------
551 : 0 : IMPL_LINK_NOARG(TableControl, ImplSelectHdl)
552 : : {
553 : 0 : Select();
554 : 0 : return 1;
555 : : }
556 : :
557 : : //------------------------------------------------------------------------------------------------------------------
558 : 0 : IMPL_LINK( TableControl, ImplMouseButtonDownHdl, MouseEvent*, pData )
559 : : {
560 : 0 : CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pData );
561 : 0 : return 1;
562 : : }
563 : :
564 : : //------------------------------------------------------------------------------------------------------------------
565 : 0 : IMPL_LINK( TableControl, ImplMouseButtonUpHdl, MouseEvent*, pData )
566 : : {
567 : 0 : CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, pData );
568 : 0 : return 1;
569 : : }
570 : :
571 : : //------------------------------------------------------------------------------------------------------------------
572 : 0 : void TableControl::Select()
573 : : {
574 : 0 : ImplCallEventListenersAndHandler( VCLEVENT_TABLEROW_SELECT, m_pImpl->getSelectHandler(), this );
575 : 0 : }
576 : :
577 : : }} // namespace svt::table
578 : :
579 : : //......................................................................................................................
580 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|