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