1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_accessibility.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "accessibility/extended/AccessibleGridControlTableCell.hxx" 32*cdf0e10cSrcweir #include <svtools/accessibletable.hxx> 33*cdf0e10cSrcweir #include "accessibility/extended/AccessibleGridControl.hxx" 34*cdf0e10cSrcweir #include <tools/gen.hxx> 35*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 36*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp> 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir namespace accessibility 39*cdf0e10cSrcweir { 40*cdf0e10cSrcweir namespace 41*cdf0e10cSrcweir { 42*cdf0e10cSrcweir void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException) 43*cdf0e10cSrcweir { 44*cdf0e10cSrcweir if ( _nIndex >= _sText.getLength() ) 45*cdf0e10cSrcweir throw ::com::sun::star::lang::IndexOutOfBoundsException(); 46*cdf0e10cSrcweir } 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount ) 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir return _nRow * _nColumnCount + _nColumn; 51*cdf0e10cSrcweir } 52*cdf0e10cSrcweir } 53*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 54*cdf0e10cSrcweir using namespace utl; 55*cdf0e10cSrcweir using namespace comphelper; 56*cdf0e10cSrcweir using ::rtl::OUString; 57*cdf0e10cSrcweir using ::accessibility::AccessibleGridControl; 58*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 59*cdf0e10cSrcweir using ::com::sun::star::accessibility::XAccessible; 60*cdf0e10cSrcweir using namespace ::com::sun::star::accessibility; 61*cdf0e10cSrcweir using namespace ::svt; 62*cdf0e10cSrcweir using namespace ::svt::table; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir // ============================================================================= 66*cdf0e10cSrcweir // = AccessibleGridControlCell 67*cdf0e10cSrcweir // ============================================================================= 68*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 69*cdf0e10cSrcweir AccessibleGridControlCell::AccessibleGridControlCell( 70*cdf0e10cSrcweir const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable, 71*cdf0e10cSrcweir sal_Int32 _nRowPos, sal_uInt16 _nColPos, AccessibleTableControlObjType _eType ) 72*cdf0e10cSrcweir :AccessibleGridControlBase( _rxParent, _rTable, _eType ) 73*cdf0e10cSrcweir ,m_nRowPos( _nRowPos ) 74*cdf0e10cSrcweir ,m_nColPos( _nColPos ) 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir // set accessible name here, because for that we need the position of the cell 77*cdf0e10cSrcweir // and so the base class isn't capable of doing this 78*cdf0e10cSrcweir ::rtl::OUString aAccName; 79*cdf0e10cSrcweir if(_eType == TCTYPE_TABLECELL) 80*cdf0e10cSrcweir aAccName = _rTable.GetAccessibleObjectName( TCTYPE_TABLECELL, _nRowPos, _nColPos ); 81*cdf0e10cSrcweir else if(_eType == TCTYPE_ROWHEADERCELL) 82*cdf0e10cSrcweir aAccName = _rTable.GetAccessibleObjectName( TCTYPE_ROWHEADERCELL, _nRowPos, 0 ); 83*cdf0e10cSrcweir else if(_eType == TCTYPE_COLUMNHEADERCELL) 84*cdf0e10cSrcweir aAccName = _rTable.GetAccessibleObjectName( TCTYPE_COLUMNHEADERCELL, 0, _nRowPos ); 85*cdf0e10cSrcweir implSetName( aAccName ); 86*cdf0e10cSrcweir } 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 89*cdf0e10cSrcweir AccessibleGridControlCell::~AccessibleGridControlCell() 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir } 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 94*cdf0e10cSrcweir void SAL_CALL AccessibleGridControlCell::grabFocus() throw ( RuntimeException ) 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 97*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 98*cdf0e10cSrcweir m_aTable.GoToCell( m_nColPos, m_nRowPos ); 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir //// ----------------------------------------------------------------------------- 101*cdf0e10cSrcweir // implementation of a table cell 102*cdf0e10cSrcweir ::rtl::OUString AccessibleGridControlTableCell::implGetText() 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir ensureIsAlive(); 105*cdf0e10cSrcweir return m_aTable.GetAccessibleCellText( getRowPos(), getColumnPos() ); 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir ::com::sun::star::lang::Locale AccessibleGridControlTableCell::implGetLocale() 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir ensureIsAlive(); 111*cdf0e10cSrcweir return m_aTable.GetAccessible()->getAccessibleContext()->getLocale(); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir void AccessibleGridControlTableCell::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir nStartIndex = 0; 117*cdf0e10cSrcweir nEndIndex = 0; 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir AccessibleGridControlTableCell::AccessibleGridControlTableCell(const Reference<XAccessible >& _rxParent, 121*cdf0e10cSrcweir IAccessibleTable& _rTable, 122*cdf0e10cSrcweir sal_Int32 _nRowPos, 123*cdf0e10cSrcweir sal_uInt16 _nColPos, 124*cdf0e10cSrcweir AccessibleTableControlObjType eObjType) 125*cdf0e10cSrcweir :AccessibleGridControlCell( _rxParent, _rTable, _nRowPos, _nColPos, eObjType ) 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir // XInterface ------------------------------------------------------------- 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir /** Queries for a new interface. */ 132*cdf0e10cSrcweir ::com::sun::star::uno::Any SAL_CALL AccessibleGridControlTableCell::queryInterface( 133*cdf0e10cSrcweir const ::com::sun::star::uno::Type& rType ) 134*cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir Any aRet = AccessibleGridControlCell::queryInterface(rType); 137*cdf0e10cSrcweir if ( !aRet.hasValue() ) 138*cdf0e10cSrcweir aRet = AccessibleTextHelper_BASE::queryInterface(rType); 139*cdf0e10cSrcweir return aRet; 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir /** Aquires the object (calls acquire() on base class). */ 143*cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTableCell::acquire() throw () 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir AccessibleGridControlCell::acquire(); 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir /** Releases the object (calls release() on base class). */ 149*cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTableCell::release() throw () 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir AccessibleGridControlCell::release(); 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir ::com::sun::star::awt::Rectangle SAL_CALL AccessibleGridControlTableCell::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 157*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir ensureIsAlive(); 160*cdf0e10cSrcweir if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) 161*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir ::com::sun::star::awt::Rectangle aRect; 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir if ( &m_aTable ) 166*cdf0e10cSrcweir aRect = AWTRectangle( m_aTable.GetFieldCharacterBounds( getRowPos(), getColumnPos(), nIndex ) ); 167*cdf0e10cSrcweir return aRect; 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleGridControlTableCell::getIndexAtPoint( const ::com::sun::star::awt::Point& _aPoint ) throw (RuntimeException) 171*cdf0e10cSrcweir { 172*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 173*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 174*cdf0e10cSrcweir ensureIsAlive(); 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir return m_aTable.GetFieldIndexAtPoint( getRowPos(), getColumnPos(), VCLPoint( _aPoint ) ); 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir /** @return 180*cdf0e10cSrcweir The name of this class. 181*cdf0e10cSrcweir */ 182*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getImplementationName() 183*cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ) 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlTableCell" ) ); 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir /** @return The count of visible children. */ 189*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleGridControlTableCell::getAccessibleChildCount() 190*cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ) 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir return 0; 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir /** @return The XAccessible interface of the specified child. */ 196*cdf0e10cSrcweir ::com::sun::star::uno::Reference< 197*cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible > SAL_CALL 198*cdf0e10cSrcweir AccessibleGridControlTableCell::getAccessibleChild( sal_Int32 ) 199*cdf0e10cSrcweir throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 200*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir throw ::com::sun::star::lang::IndexOutOfBoundsException(); 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir /** Creates a new AccessibleStateSetHelper and fills it with states of the 206*cdf0e10cSrcweir current object. 207*cdf0e10cSrcweir @return 208*cdf0e10cSrcweir A filled AccessibleStateSetHelper. 209*cdf0e10cSrcweir */ 210*cdf0e10cSrcweir ::utl::AccessibleStateSetHelper* AccessibleGridControlTableCell::implCreateStateSetHelper() 211*cdf0e10cSrcweir { 212*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 213*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir ::utl::AccessibleStateSetHelper* pStateSetHelper = new ::utl::AccessibleStateSetHelper; 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir if( isAlive() ) 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir // SHOWING done with mxParent 220*cdf0e10cSrcweir if( implIsShowing() ) 221*cdf0e10cSrcweir pStateSetHelper->AddState( AccessibleStateType::SHOWING ); 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir m_aTable.FillAccessibleStateSetForCell( *pStateSetHelper, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir else 226*cdf0e10cSrcweir pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir return pStateSetHelper; 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir // XAccessible ------------------------------------------------------------ 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir /** @return The XAccessibleContext interface of this object. */ 235*cdf0e10cSrcweir Reference< XAccessibleContext > SAL_CALL AccessibleGridControlTableCell::getAccessibleContext() throw ( RuntimeException ) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir ensureIsAlive(); 238*cdf0e10cSrcweir return this; 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir // XAccessibleContext ----------------------------------------------------- 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleGridControlTableCell::getAccessibleIndexInParent() 244*cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 247*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 248*cdf0e10cSrcweir ensureIsAlive(); 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir return ( getRowPos() * m_aTable.GetColumnCount() ) + getColumnPos(); 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir return -1; 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleGridControlTableCell::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 260*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) 263*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir return sal_False; 266*cdf0e10cSrcweir } 267*cdf0e10cSrcweir sal_Unicode SAL_CALL AccessibleGridControlTableCell::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 270*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 271*cdf0e10cSrcweir return OCommonAccessibleText::getCharacter( nIndex ); 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleGridControlTableCell::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 276*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir ::rtl::OUString sText( implGetText() ); 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir if ( !implIsValidIndex( nIndex, sText.getLength() ) ) 281*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(); 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException) 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 288*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 289*cdf0e10cSrcweir return OCommonAccessibleText::getCharacterCount( ); 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 295*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 296*cdf0e10cSrcweir return OCommonAccessibleText::getSelectedText( ); 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 301*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 302*cdf0e10cSrcweir return OCommonAccessibleText::getSelectionStart( ); 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException) 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 307*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 308*cdf0e10cSrcweir return OCommonAccessibleText::getSelectionEnd( ); 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleGridControlTableCell::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 313*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 314*cdf0e10cSrcweir if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) 315*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir return sal_False; 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getText( ) throw (::com::sun::star::uno::RuntimeException) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 322*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 323*cdf0e10cSrcweir return OCommonAccessibleText::getText( ); 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 328*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 329*cdf0e10cSrcweir return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex ); 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 334*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 335*cdf0e10cSrcweir return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 340*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 341*cdf0e10cSrcweir return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 346*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 347*cdf0e10cSrcweir return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleGridControlTableCell::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir TCSolarGuard aSolarGuard; 352*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getOslMutex() ); 353*cdf0e10cSrcweir ::rtl::OUString sText = implGetText(); 354*cdf0e10cSrcweir checkIndex_Impl( nStartIndex, sText ); 355*cdf0e10cSrcweir checkIndex_Impl( nEndIndex, sText ); 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir //!!! don't know how to put a string into the clipboard 358*cdf0e10cSrcweir return sal_False; 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir Rectangle AccessibleGridControlTableCell::implGetBoundingBox() 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir Window* pParent = m_aTable.GetAccessibleParentWindow(); 364*cdf0e10cSrcweir DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" ); 365*cdf0e10cSrcweir Rectangle aGridRect = m_aTable.GetWindowExtentsRelative( pParent ); 366*cdf0e10cSrcweir sal_Int32 nIndex = getAccessibleIndexInParent(); 367*cdf0e10cSrcweir Rectangle aCellRect = m_aTable.calcCellRect(nIndex%m_aTable.GetColumnCount(), nIndex/m_aTable.GetColumnCount()); 368*cdf0e10cSrcweir long nX = aGridRect.Left() + aCellRect.Left(); 369*cdf0e10cSrcweir long nY = aGridRect.Top() + aCellRect.Top(); 370*cdf0e10cSrcweir Rectangle aCell( Point( nX, nY ), aCellRect.GetSize()); 371*cdf0e10cSrcweir return aCell; 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 374*cdf0e10cSrcweir Rectangle AccessibleGridControlTableCell::implGetBoundingBoxOnScreen() 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir Rectangle aGridRect = m_aTable.GetWindowExtentsRelative( NULL ); 377*cdf0e10cSrcweir sal_Int32 nIndex = getAccessibleIndexInParent(); 378*cdf0e10cSrcweir Rectangle aCellRect = m_aTable.calcCellRect(nIndex%m_aTable.GetColumnCount(), nIndex/m_aTable.GetColumnCount()); 379*cdf0e10cSrcweir long nX = aGridRect.Left() + aCellRect.Left(); 380*cdf0e10cSrcweir long nY = aGridRect.Top() + aCellRect.Top(); 381*cdf0e10cSrcweir Rectangle aCell( Point( nX, nY ), aCellRect.GetSize()); 382*cdf0e10cSrcweir return aCell; 383*cdf0e10cSrcweir } 384*cdf0e10cSrcweir } 385