1*0841af79SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*0841af79SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*0841af79SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*0841af79SAndrew Rist * distributed with this work for additional information 6*0841af79SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*0841af79SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*0841af79SAndrew Rist * "License"); you may not use this file except in compliance 9*0841af79SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*0841af79SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*0841af79SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*0841af79SAndrew Rist * software distributed under the License is distributed on an 15*0841af79SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*0841af79SAndrew Rist * KIND, either express or implied. See the License for the 17*0841af79SAndrew Rist * specific language governing permissions and limitations 18*0841af79SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*0841af79SAndrew Rist *************************************************************/ 21*0841af79SAndrew Rist 22*0841af79SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_accessibility.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include "accessibility/extended/AccessibleGridControlTable.hxx" 29cdf0e10cSrcweir #include "accessibility/extended/AccessibleGridControlTableCell.hxx" 30cdf0e10cSrcweir #include <svtools/accessibletable.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir // ============================================================================ 33cdf0e10cSrcweir 34cdf0e10cSrcweir using ::rtl::OUString; 35cdf0e10cSrcweir 36cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 37cdf0e10cSrcweir using ::com::sun::star::uno::Sequence; 38cdf0e10cSrcweir using ::com::sun::star::uno::Any; 39cdf0e10cSrcweir 40cdf0e10cSrcweir using namespace ::com::sun::star; 41cdf0e10cSrcweir using namespace ::com::sun::star::accessibility; 42cdf0e10cSrcweir using namespace ::svt; 43cdf0e10cSrcweir using namespace ::svt::table; 44cdf0e10cSrcweir // ============================================================================ 45cdf0e10cSrcweir 46cdf0e10cSrcweir namespace accessibility { 47cdf0e10cSrcweir 48cdf0e10cSrcweir // ============================================================================ 49cdf0e10cSrcweir 50cdf0e10cSrcweir DBG_NAME( AccessibleGridControlTable ) 51cdf0e10cSrcweir 52cdf0e10cSrcweir AccessibleGridControlTable::AccessibleGridControlTable( 53cdf0e10cSrcweir const Reference< XAccessible >& rxParent, 54cdf0e10cSrcweir IAccessibleTable& rTable, 55cdf0e10cSrcweir AccessibleTableControlObjType _eType) : 56cdf0e10cSrcweir AccessibleGridControlTableBase( rxParent, rTable, _eType ) 57cdf0e10cSrcweir ,m_pCellVector( ) 58cdf0e10cSrcweir ,m_pAccessCellVector( ) 59cdf0e10cSrcweir { 60cdf0e10cSrcweir } 61cdf0e10cSrcweir 62cdf0e10cSrcweir AccessibleGridControlTable::~AccessibleGridControlTable() 63cdf0e10cSrcweir { 64cdf0e10cSrcweir } 65cdf0e10cSrcweir 66cdf0e10cSrcweir // XAccessibleContext --------------------------------------------------------- 67cdf0e10cSrcweir 68cdf0e10cSrcweir Reference< XAccessible > SAL_CALL 69cdf0e10cSrcweir AccessibleGridControlTable::getAccessibleChild( sal_Int32 nChildIndex ) 70cdf0e10cSrcweir throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 71cdf0e10cSrcweir { 72cdf0e10cSrcweir TCSolarGuard aSolarGuard; 73cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 74cdf0e10cSrcweir ensureIsAlive(); 75cdf0e10cSrcweir ensureIsValidIndex( nChildIndex ); 76cdf0e10cSrcweir sal_Int32 nCount = getAccessibleChildCount(); 77cdf0e10cSrcweir if(m_pAccessCellVector.size() == 0 || m_pAccessCellVector.size() != (unsigned)nCount) 78cdf0e10cSrcweir { 79cdf0e10cSrcweir m_pAccessCellVector.resize(nCount); 80cdf0e10cSrcweir m_pCellVector.resize(nCount); 81cdf0e10cSrcweir } 82cdf0e10cSrcweir if(!m_pAccessCellVector[nChildIndex].is()) 83cdf0e10cSrcweir { 84cdf0e10cSrcweir AccessibleGridControlTableCell* pCell = new AccessibleGridControlTableCell(this, m_aTable, nChildIndex/m_aTable.GetColumnCount(), nChildIndex%m_aTable.GetColumnCount(), TCTYPE_TABLECELL); 85cdf0e10cSrcweir m_pCellVector[nChildIndex] = pCell; 86cdf0e10cSrcweir m_pAccessCellVector[nChildIndex] = pCell; 87cdf0e10cSrcweir } 88cdf0e10cSrcweir return m_pAccessCellVector[nChildIndex]; 89cdf0e10cSrcweir } 90cdf0e10cSrcweir 91cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleGridControlTable::getAccessibleIndexInParent() 92cdf0e10cSrcweir throw ( uno::RuntimeException ) 93cdf0e10cSrcweir { 94cdf0e10cSrcweir ensureIsAlive(); 95cdf0e10cSrcweir if(m_aTable.HasRowHeader() && m_aTable.HasColHeader()) 96cdf0e10cSrcweir return 0; 97cdf0e10cSrcweir else if((!m_aTable.HasRowHeader() && m_aTable.HasColHeader()) || (m_aTable.HasRowHeader() && !m_aTable.HasColHeader()) ) 98cdf0e10cSrcweir return 1; 99cdf0e10cSrcweir else 100cdf0e10cSrcweir return 2; 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir // XAccessibleComponent ------------------------------------------------------- 104cdf0e10cSrcweir 105cdf0e10cSrcweir Reference< XAccessible > SAL_CALL 106cdf0e10cSrcweir AccessibleGridControlTable::getAccessibleAtPoint( const awt::Point& rPoint ) 107cdf0e10cSrcweir throw ( uno::RuntimeException ) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir TCSolarGuard aSolarGuard; 110cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 111cdf0e10cSrcweir ensureIsAlive(); 112cdf0e10cSrcweir 113cdf0e10cSrcweir Reference< XAccessible > xChild; 114cdf0e10cSrcweir sal_Int32 nRow = 0; 115cdf0e10cSrcweir sal_Int32 nColumnPos = 0; 116cdf0e10cSrcweir if( m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) ) 117cdf0e10cSrcweir xChild = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumnPos, TCTYPE_TABLECELL); 118cdf0e10cSrcweir return xChild; 119cdf0e10cSrcweir } 120cdf0e10cSrcweir 121cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::grabFocus() 122cdf0e10cSrcweir throw ( uno::RuntimeException ) 123cdf0e10cSrcweir { 124cdf0e10cSrcweir TCSolarGuard aSolarGuard; 125cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 126cdf0e10cSrcweir ensureIsAlive(); 127cdf0e10cSrcweir m_aTable.GrabFocus(); 128cdf0e10cSrcweir } 129cdf0e10cSrcweir 130cdf0e10cSrcweir Any SAL_CALL AccessibleGridControlTable::getAccessibleKeyBinding() 131cdf0e10cSrcweir throw ( uno::RuntimeException ) 132cdf0e10cSrcweir { 133cdf0e10cSrcweir ensureIsAlive(); 134cdf0e10cSrcweir return Any(); // no special key bindings for data table 135cdf0e10cSrcweir } 136cdf0e10cSrcweir 137cdf0e10cSrcweir // XAccessibleTable ----------------------------------------------------------- 138cdf0e10cSrcweir 139cdf0e10cSrcweir OUString SAL_CALL AccessibleGridControlTable::getAccessibleRowDescription( sal_Int32 nRow ) 140cdf0e10cSrcweir throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir TCSolarGuard aSolarGuard; 143cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 144cdf0e10cSrcweir ensureIsAlive(); 145cdf0e10cSrcweir ensureIsValidRow( nRow ); 146cdf0e10cSrcweir return m_aTable.GetRowDescription( nRow ); 147cdf0e10cSrcweir } 148cdf0e10cSrcweir 149cdf0e10cSrcweir OUString SAL_CALL AccessibleGridControlTable::getAccessibleColumnDescription( sal_Int32 nColumn ) 150cdf0e10cSrcweir throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir TCSolarGuard aSolarGuard; 153cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 154cdf0e10cSrcweir ensureIsAlive(); 155cdf0e10cSrcweir ensureIsValidColumn( nColumn ); 156cdf0e10cSrcweir return m_aTable.GetColumnDescription( (sal_uInt16)nColumn ); 157cdf0e10cSrcweir } 158cdf0e10cSrcweir 159cdf0e10cSrcweir Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleRowHeaders() 160cdf0e10cSrcweir throw ( uno::RuntimeException ) 161cdf0e10cSrcweir { 162cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 163cdf0e10cSrcweir ensureIsAlive(); 164cdf0e10cSrcweir if(m_aTable.HasColHeader()) 165cdf0e10cSrcweir return implGetHeaderBar( 1 ); 166cdf0e10cSrcweir else 167cdf0e10cSrcweir return implGetHeaderBar( 0 ); 168cdf0e10cSrcweir } 169cdf0e10cSrcweir 170cdf0e10cSrcweir Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleColumnHeaders() 171cdf0e10cSrcweir throw ( uno::RuntimeException ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 174cdf0e10cSrcweir ensureIsAlive(); 175cdf0e10cSrcweir return implGetHeaderBar( 0 ); 176cdf0e10cSrcweir } 177cdf0e10cSrcweir 178cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleRows() 179cdf0e10cSrcweir throw ( uno::RuntimeException ) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir TCSolarGuard aSolarGuard; 182cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 183cdf0e10cSrcweir ensureIsAlive(); 184cdf0e10cSrcweir Sequence< sal_Int32 > aSelSeq; 185cdf0e10cSrcweir implGetSelectedRows( aSelSeq ); 186cdf0e10cSrcweir return aSelSeq; 187cdf0e10cSrcweir } 188cdf0e10cSrcweir 189cdf0e10cSrcweir //columns aren't selectable 190cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleColumns() 191cdf0e10cSrcweir throw ( uno::RuntimeException ) 192cdf0e10cSrcweir { 193cdf0e10cSrcweir Sequence< sal_Int32 > aSelSeq(0); 194cdf0e10cSrcweir return aSelSeq; 195cdf0e10cSrcweir } 196cdf0e10cSrcweir 197cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleRowSelected( sal_Int32 nRow ) 198cdf0e10cSrcweir throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir TCSolarGuard aSolarGuard; 201cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 202cdf0e10cSrcweir ensureIsAlive(); 203cdf0e10cSrcweir ensureIsValidRow( nRow ); 204cdf0e10cSrcweir sal_Bool bSelected = sal_False; 205cdf0e10cSrcweir Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows(); 206cdf0e10cSrcweir for(int i=0; i<selectedRows.getLength(); i++) 207cdf0e10cSrcweir { 208cdf0e10cSrcweir if(nRow == selectedRows[i]) 209cdf0e10cSrcweir { 210cdf0e10cSrcweir bSelected = sal_True; 211cdf0e10cSrcweir continue; 212cdf0e10cSrcweir } 213cdf0e10cSrcweir } 214cdf0e10cSrcweir return bSelected; 215cdf0e10cSrcweir } 216cdf0e10cSrcweir 217cdf0e10cSrcweir //columns aren't selectable 218cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleColumnSelected( sal_Int32 nColumn ) 219cdf0e10cSrcweir throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 220cdf0e10cSrcweir { 221cdf0e10cSrcweir (void) nColumn; 222cdf0e10cSrcweir return sal_False; 223cdf0e10cSrcweir } 224cdf0e10cSrcweir 225cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleGridControlTable::getAccessibleCellAt( 226cdf0e10cSrcweir sal_Int32 nRow, sal_Int32 nColumn ) 227cdf0e10cSrcweir throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 228cdf0e10cSrcweir { 229cdf0e10cSrcweir TCSolarGuard aSolarGuard; 230cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 231cdf0e10cSrcweir ensureIsAlive(); 232cdf0e10cSrcweir ensureIsValidAddress( nRow, nColumn ); 233cdf0e10cSrcweir sal_Int32 nCount = getAccessibleChildCount(); 234cdf0e10cSrcweir sal_Int32 nChildIndex = nRow*m_aTable.GetColumnCount() + nColumn; 235cdf0e10cSrcweir if(m_pAccessCellVector.size() == 0 || m_pAccessCellVector.size() != (unsigned)nCount) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir m_pAccessCellVector.resize(nCount); 238cdf0e10cSrcweir m_pCellVector.resize(nCount); 239cdf0e10cSrcweir } 240cdf0e10cSrcweir if(!m_pAccessCellVector[nChildIndex].is()) 241cdf0e10cSrcweir { 242cdf0e10cSrcweir AccessibleGridControlTableCell* pCell = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumn, TCTYPE_TABLECELL); 243cdf0e10cSrcweir m_pCellVector[nChildIndex] = pCell; 244cdf0e10cSrcweir m_pAccessCellVector[nChildIndex] = pCell; 245cdf0e10cSrcweir } 246cdf0e10cSrcweir return m_pAccessCellVector[nChildIndex]; 247cdf0e10cSrcweir } 248cdf0e10cSrcweir 249cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected( 250cdf0e10cSrcweir sal_Int32 nRow, sal_Int32 nColumn ) 251cdf0e10cSrcweir throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 252cdf0e10cSrcweir { 253cdf0e10cSrcweir TCSolarGuard aSolarGuard; 254cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 255cdf0e10cSrcweir ensureIsAlive(); 256cdf0e10cSrcweir ensureIsValidAddress( nRow, nColumn ); 257cdf0e10cSrcweir (void) nColumn; 258cdf0e10cSrcweir //selection of single cells not possible, so if row is selected, the cell will be selected too 259cdf0e10cSrcweir return isAccessibleRowSelected(nRow); 260cdf0e10cSrcweir } 261cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChildIndex ) 262cdf0e10cSrcweir throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir TCSolarGuard aSolarGuard; 265cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 266cdf0e10cSrcweir ensureIsAlive(); 267cdf0e10cSrcweir ensureIsValidIndex( nChildIndex ); 268cdf0e10cSrcweir sal_Int32 nColumns = m_aTable.GetColumnCount(); 269cdf0e10cSrcweir sal_Int32 nRow = (nChildIndex / nColumns); 270cdf0e10cSrcweir m_aTable.SelectRow( nRow, sal_True ); 271cdf0e10cSrcweir } 272cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleChildSelected( sal_Int32 nChildIndex ) 273cdf0e10cSrcweir throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 274cdf0e10cSrcweir { 275cdf0e10cSrcweir TCSolarGuard aSolarGuard; 276cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 277cdf0e10cSrcweir ensureIsAlive(); 278cdf0e10cSrcweir ensureIsValidIndex( nChildIndex ); 279cdf0e10cSrcweir sal_Int32 nColumns = m_aTable.GetColumnCount(); 280cdf0e10cSrcweir sal_Int32 nRow = (nChildIndex / nColumns); 281cdf0e10cSrcweir return isAccessibleRowSelected(nRow); 282cdf0e10cSrcweir } 283cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::clearAccessibleSelection() 284cdf0e10cSrcweir throw ( uno::RuntimeException ) 285cdf0e10cSrcweir { 286cdf0e10cSrcweir TCSolarGuard aSolarGuard; 287cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 288cdf0e10cSrcweir ensureIsAlive(); 289cdf0e10cSrcweir m_aTable.SelectAllRows( false ); 290cdf0e10cSrcweir } 291cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::selectAllAccessibleChildren() 292cdf0e10cSrcweir throw ( uno::RuntimeException ) 293cdf0e10cSrcweir { 294cdf0e10cSrcweir TCSolarGuard aSolarGuard; 295cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 296cdf0e10cSrcweir ensureIsAlive(); 297cdf0e10cSrcweir Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows(); 298cdf0e10cSrcweir for(int i=0;i<m_aTable.GetRowCount();i++) 299cdf0e10cSrcweir selectedRows[i]=i; 300cdf0e10cSrcweir } 301cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleGridControlTable::getSelectedAccessibleChildCount() 302cdf0e10cSrcweir throw ( uno::RuntimeException ) 303cdf0e10cSrcweir { 304cdf0e10cSrcweir TCSolarGuard aSolarGuard; 305cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 306cdf0e10cSrcweir ensureIsAlive(); 307cdf0e10cSrcweir Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows(); 308cdf0e10cSrcweir sal_Int32 nColumns = m_aTable.GetColumnCount(); 309cdf0e10cSrcweir return selectedRows.getLength()*nColumns; 310cdf0e10cSrcweir } 311cdf0e10cSrcweir Reference< XAccessible > SAL_CALL 312cdf0e10cSrcweir AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) 313cdf0e10cSrcweir throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 314cdf0e10cSrcweir { 315cdf0e10cSrcweir TCSolarGuard aSolarGuard; 316cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 317cdf0e10cSrcweir ensureIsAlive(); 318cdf0e10cSrcweir if(isAccessibleChildSelected(nSelectedChildIndex)) 319cdf0e10cSrcweir return getAccessibleChild(nSelectedChildIndex); 320cdf0e10cSrcweir else 321cdf0e10cSrcweir return NULL; 322cdf0e10cSrcweir } 323cdf0e10cSrcweir //not implemented yet, because only row selection possible 324cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild( 325cdf0e10cSrcweir sal_Int32 nSelectedChildIndex ) 326cdf0e10cSrcweir throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir TCSolarGuard aSolarGuard; 329cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 330cdf0e10cSrcweir ensureIsAlive(); 331cdf0e10cSrcweir (void)nSelectedChildIndex; 332cdf0e10cSrcweir } 333cdf0e10cSrcweir // XInterface ----------------------------------------------------------------- 334cdf0e10cSrcweir 335cdf0e10cSrcweir Any SAL_CALL AccessibleGridControlTable::queryInterface( const uno::Type& rType ) 336cdf0e10cSrcweir throw ( uno::RuntimeException ) 337cdf0e10cSrcweir { 338cdf0e10cSrcweir Any aAny( AccessibleGridControlTableBase::queryInterface( rType ) ); 339cdf0e10cSrcweir return aAny.hasValue() ? 340cdf0e10cSrcweir aAny : AccessibleGridControlTableImplHelper1::queryInterface( rType ); 341cdf0e10cSrcweir } 342cdf0e10cSrcweir 343cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::acquire() throw () 344cdf0e10cSrcweir { 345cdf0e10cSrcweir AccessibleGridControlTableBase::acquire(); 346cdf0e10cSrcweir } 347cdf0e10cSrcweir 348cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::release() throw () 349cdf0e10cSrcweir { 350cdf0e10cSrcweir AccessibleGridControlTableBase::release(); 351cdf0e10cSrcweir } 352cdf0e10cSrcweir // XServiceInfo --------------------------------------------------------------- 353cdf0e10cSrcweir 354cdf0e10cSrcweir OUString SAL_CALL AccessibleGridControlTable::getImplementationName() 355cdf0e10cSrcweir throw ( uno::RuntimeException ) 356cdf0e10cSrcweir { 357cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlTable" ) ); 358cdf0e10cSrcweir } 359cdf0e10cSrcweir 360cdf0e10cSrcweir // internal virtual methods --------------------------------------------------- 361cdf0e10cSrcweir 362cdf0e10cSrcweir Rectangle AccessibleGridControlTable::implGetBoundingBox() 363cdf0e10cSrcweir { 364cdf0e10cSrcweir Window* pParent = m_aTable.GetAccessibleParentWindow(); 365cdf0e10cSrcweir DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" ); 366cdf0e10cSrcweir Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent )); 367cdf0e10cSrcweir Rectangle aTableRect( m_aTable.calcTableRect() ); 368cdf0e10cSrcweir long nX = aGridRect.Left() + aTableRect.Left(); 369cdf0e10cSrcweir long nY = aGridRect.Top() + aTableRect.Top(); 370cdf0e10cSrcweir long nWidth = aGridRect.GetSize().Width()-aTableRect.Left(); 371cdf0e10cSrcweir long nHeight = aGridRect.GetSize().Height()-aTableRect.Top(); 372cdf0e10cSrcweir Rectangle aTable( Point( nX, nY ), Size( nWidth, nHeight )); 373cdf0e10cSrcweir return aTable; 374cdf0e10cSrcweir } 375cdf0e10cSrcweir 376cdf0e10cSrcweir Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen() 377cdf0e10cSrcweir { 378cdf0e10cSrcweir Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( NULL )); 379cdf0e10cSrcweir Rectangle aTableRect( m_aTable.calcTableRect() ); 380cdf0e10cSrcweir long nX = aGridRect.Left() + aTableRect.Left(); 381cdf0e10cSrcweir long nY = aGridRect.Top() + aTableRect.Top(); 382cdf0e10cSrcweir long nWidth = aGridRect.GetSize().Width()-aTableRect.Left(); 383cdf0e10cSrcweir long nHeight = aGridRect.GetSize().Height()-aTableRect.Top(); 384cdf0e10cSrcweir Rectangle aTable( Point( nX, nY ), Size( nWidth, nHeight )); 385cdf0e10cSrcweir return aTable; 386cdf0e10cSrcweir } 387cdf0e10cSrcweir // internal helper methods ---------------------------------------------------- 388cdf0e10cSrcweir Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar( 389cdf0e10cSrcweir sal_Int32 nChildIndex ) 390cdf0e10cSrcweir throw ( uno::RuntimeException ) 391cdf0e10cSrcweir { 392cdf0e10cSrcweir Reference< XAccessible > xRet; 393cdf0e10cSrcweir Reference< XAccessibleContext > xContext( m_xParent, uno::UNO_QUERY ); 394cdf0e10cSrcweir if( xContext.is() ) 395cdf0e10cSrcweir { 396cdf0e10cSrcweir try 397cdf0e10cSrcweir { 398cdf0e10cSrcweir xRet = xContext->getAccessibleChild( nChildIndex ); 399cdf0e10cSrcweir } 400cdf0e10cSrcweir catch( lang::IndexOutOfBoundsException& ) 401cdf0e10cSrcweir { 402cdf0e10cSrcweir DBG_ERROR( "implGetHeaderBar - wrong child index" ); 403cdf0e10cSrcweir } 404cdf0e10cSrcweir // RuntimeException goes to caller 405cdf0e10cSrcweir } 406cdf0e10cSrcweir return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY ); 407cdf0e10cSrcweir } 408cdf0e10cSrcweir 409cdf0e10cSrcweir std::vector< AccessibleGridControlTableCell* >& AccessibleGridControlTable::getCellVector() 410cdf0e10cSrcweir { 411cdf0e10cSrcweir return m_pCellVector; 412cdf0e10cSrcweir } 413cdf0e10cSrcweir 414cdf0e10cSrcweir std::vector< Reference< XAccessible > >& AccessibleGridControlTable::getAccessibleCellVector() 415cdf0e10cSrcweir { 416cdf0e10cSrcweir return m_pAccessCellVector; 417cdf0e10cSrcweir } 418cdf0e10cSrcweir // ============================================================================ 419cdf0e10cSrcweir 420cdf0e10cSrcweir } // namespace accessibility 421cdf0e10cSrcweir 422cdf0e10cSrcweir // ============================================================================ 423cdf0e10cSrcweir 424