diff options
author | Michael Brauer <mib@openoffice.org> | 2002-05-03 11:34:00 +0000 |
---|---|---|
committer | Michael Brauer <mib@openoffice.org> | 2002-05-03 11:34:00 +0000 |
commit | 16db64566381a00d0e5178c699cb0c776af46139 (patch) | |
tree | 50621cf11e1811a4a890887b9b5e33ba57b68530 /sw/source/core/access | |
parent | 847fe84fa7a52ce7b2ae95b8681627b9a8522d62 (diff) |
#95586#: Accessible tables
Diffstat (limited to 'sw/source/core/access')
-rw-r--r-- | sw/source/core/access/acccell.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/access/acccontext.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/access/accmap.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/access/accpara.cxx | 58 | ||||
-rw-r--r-- | sw/source/core/access/acctable.cxx | 295 | ||||
-rw-r--r-- | sw/source/core/access/acctable.hxx | 24 |
6 files changed, 197 insertions, 206 deletions
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index e316cd772ade..69e5f63936cc 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -2,9 +2,9 @@ * * $RCSfile: acccell.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2002-04-17 14:07:39 $ + * last change: $Author: mib $ $Date: 2002-05-03 12:34:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -313,6 +313,7 @@ void SwAccessibleCell::Dispose( sal_Bool bRecursive ) GetMap()->GetContextImpl( pParent, sal_False ) ); if( xAccImpl.isValid() ) xAccImpl->DisposeChild( GetFrm(), bRecursive ); + SwAccessibleContext::Dispose( bRecursive ); } void SwAccessibleCell::InvalidatePosOrSize( const SwRect& rOldBox ) @@ -322,4 +323,5 @@ void SwAccessibleCell::InvalidatePosOrSize( const SwRect& rOldBox ) GetMap()->GetContextImpl( pParent, sal_False ) ); if( xAccImpl.isValid() ) xAccImpl->InvalidateChildPosOrSize( GetFrm(), rOldBox ); + SwAccessibleContext::InvalidatePosOrSize( rOldBox ); } diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index 34326a03ab85..76923cc03c88 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: acccontext.cxx,v $ * - * $Revision: 1.21 $ + * $Revision: 1.22 $ * - * last change: $Author: dvo $ $Date: 2002-04-24 15:27:21 $ + * last change: $Author: mib $ $Date: 2002-05-03 12:34:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -687,6 +687,10 @@ Reference<XAccessibleStateSet> SAL_CALL SwAccessibleContext::getAccessibleStateSet (void) throw (::com::sun::star::uno::RuntimeException) { + vos::OGuard aGuard(Application::GetSolarMutex()); + + CHECK_FOR_DEFUNC( XAccessibleContext ) + ::utl::AccessibleStateSetHelper *pStateSet = new ::utl::AccessibleStateSetHelper; diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index c1d00aa757d6..13edeae781d2 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: accmap.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: dvo $ $Date: 2002-04-24 15:27:21 $ + * last change: $Author: mib $ $Date: 2002-05-03 12:34:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -207,8 +207,9 @@ public: meType( eT ), mxAcc( pA ), maFrmOrObj( rFrmOrObj ), maOldBox( rR ), mnStates( 0 ) { - ASSERT( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType, - "wrong event constructor, CHILD_POS_CHANGED only" ); + ASSERT( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType || + SwAccessibleEvent_Impl::POS_CHANGED == meType, + "wrong event constructor, (CHILD_)POS_CHANGED only" ); } SwAccessibleEvent_Impl( EventType eT, SwAccessibleContext *pA, const SwFrmOrObj& rFrmOrObj, sal_uInt8 nSt ) : @@ -470,6 +471,7 @@ SwAccessibleMap::SwAccessibleMap( ViewShell *pSh ) : mnFootnote( 1 ), mnEndnote( 1 ) { + pSh->GetLayout()->AddAccessibleShell(); } SwAccessibleMap::~SwAccessibleMap() @@ -508,6 +510,7 @@ SwAccessibleMap::~SwAccessibleMap() SwAccessibleContext *pTmp = static_cast< SwAccessibleContext * >( xTmp.get() ); } + ++aIter; } } #endif @@ -523,6 +526,7 @@ SwAccessibleMap::~SwAccessibleMap() delete mpEvents; mpEvents = 0; } + mpVSh->GetLayout()->RemoveAccessibleShell(); } Reference< XAccessible > SwAccessibleMap::GetDocumentView() diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 897f82539ca3..8cf40d06ca93 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -2,9 +2,9 @@ * * $RCSfile: accpara.cxx,v $ * - * $Revision: 1.28 $ + * $Revision: 1.29 $ * - * last change: $Author: os $ $Date: 2002-04-25 13:57:37 $ + * last change: $Author: mib $ $Date: 2002-05-03 12:34:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -950,7 +950,7 @@ sal_Int32 SwAccessibleParagraph::getCaretPosition() { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleText ); sal_Int32 nRet = GetCaretPos(); { @@ -972,7 +972,7 @@ sal_Unicode SwAccessibleParagraph::getCharacter( sal_Int32 nIndex ) { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleText ); OUString sText( GetString() ); @@ -991,7 +991,7 @@ Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes( { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleText ); const OUString& rText = GetString(); @@ -1038,7 +1038,7 @@ com::sun::star::awt::Rectangle SwAccessibleParagraph::getCharacterBounds( { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); // we have a frame? + CHECK_FOR_DEFUNC( XAccessibleText ); if( ! IsValidChar( nIndex, GetString().getLength() ) ) throw IndexOutOfBoundsException(); @@ -1077,7 +1077,7 @@ sal_Int32 SwAccessibleParagraph::getCharacterCount() { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleText ); return GetString().getLength(); } @@ -1087,7 +1087,7 @@ sal_Int32 SwAccessibleParagraph::getIndexAtPoint( const com::sun::star::awt::Poi { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleText ); // construct SwPosition (where GetCrsrOfst() will put the result into) SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() ); @@ -1119,7 +1119,7 @@ OUString SwAccessibleParagraph::getSelectedText() { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); // we have a frame? + CHECK_FOR_DEFUNC( XAccessibleText ); sal_Int32 nStart, nEnd; sal_Bool bSelected = GetSelection( nStart, nEnd ); @@ -1131,7 +1131,7 @@ sal_Int32 SwAccessibleParagraph::getSelectionStart() { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); // we have a frame? + CHECK_FOR_DEFUNC( XAccessibleText ); sal_Int32 nStart, nEnd; GetSelection( nStart, nEnd ); @@ -1143,7 +1143,7 @@ sal_Int32 SwAccessibleParagraph::getSelectionEnd() { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); // we have a frame? + CHECK_FOR_DEFUNC( XAccessibleText ); sal_Int32 nStart, nEnd; GetSelection( nStart, nEnd ); @@ -1155,7 +1155,7 @@ sal_Bool SwAccessibleParagraph::setSelection( sal_Int32 nStartIndex, sal_Int32 n { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleText ); // parameter checking sal_Int32 nLength = GetString().getLength(); @@ -1193,7 +1193,7 @@ OUString SwAccessibleParagraph::getText() { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleText ); return GetString(); } @@ -1204,7 +1204,7 @@ OUString SwAccessibleParagraph::getTextRange( { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleText ); OUString sText( GetString() ); @@ -1223,7 +1223,7 @@ OUString SwAccessibleParagraph::getTextAtIndex( { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleText ); const OUString rText = GetString(); @@ -1246,7 +1246,7 @@ OUString SwAccessibleParagraph::getTextBeforeIndex( { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleText ); const OUString rText = GetString(); @@ -1276,7 +1276,7 @@ OUString SwAccessibleParagraph::getTextBehindIndex( { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleText ); const OUString rText = GetString(); @@ -1301,7 +1301,7 @@ OUString SwAccessibleParagraph::getTextBehindIndex( sal_Bool SwAccessibleParagraph::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) { - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleText ); vos::OGuard aGuard(Application::GetSolarMutex()); // select and copy (through dispatch mechanism) @@ -1318,7 +1318,7 @@ sal_Bool SwAccessibleParagraph::copyText( sal_Int32 nStartIndex, sal_Int32 nEndI sal_Bool SwAccessibleParagraph::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) { - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleEditableText ); vos::OGuard aGuard(Application::GetSolarMutex()); // select and cut (through dispatch mechanism) @@ -1330,7 +1330,7 @@ sal_Bool SwAccessibleParagraph::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIn sal_Bool SwAccessibleParagraph::pasteText( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) { - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleEditableText ); vos::OGuard aGuard(Application::GetSolarMutex()); // select and paste (through dispatch mechanism) @@ -1358,7 +1358,7 @@ sal_Bool SwAccessibleParagraph::replaceText( { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); // check for live frame + CHECK_FOR_DEFUNC( XAccessibleEditableText ); const OUString& rText = GetString(); @@ -1414,7 +1414,7 @@ sal_Bool SwAccessibleParagraph::setAttributes( throw (IndexOutOfBoundsException, RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - CHECK_FOR_DEFUNC( XAccessibleContext ); + CHECK_FOR_DEFUNC( XAccessibleEditableText ); const OUString& rText = GetString(); @@ -1476,6 +1476,8 @@ void SwAccessibleParagraph::selectAccessibleChild( throw ( IndexOutOfBoundsException, RuntimeException ) { + CHECK_FOR_DEFUNC( XAccessibleSelection ); + aSelectionHelper.selectAccessibleChild(nChildIndex); } @@ -1484,24 +1486,32 @@ sal_Bool SwAccessibleParagraph::isAccessibleChildSelected( throw ( IndexOutOfBoundsException, RuntimeException ) { + CHECK_FOR_DEFUNC( XAccessibleSelection ); + return aSelectionHelper.isAccessibleChildSelected(nChildIndex); } void SwAccessibleParagraph::clearAccessibleSelection( ) throw ( RuntimeException ) { + CHECK_FOR_DEFUNC( XAccessibleSelection ); + aSelectionHelper.clearAccessibleSelection(); } void SwAccessibleParagraph::selectAllAccessible( ) throw ( RuntimeException ) { + CHECK_FOR_DEFUNC( XAccessibleSelection ); + aSelectionHelper.selectAllAccessible(); } sal_Int32 SwAccessibleParagraph::getSelectedAccessibleChildCount( ) throw ( RuntimeException ) { + CHECK_FOR_DEFUNC( XAccessibleSelection ); + return aSelectionHelper.getSelectedAccessibleChildCount(); } @@ -1510,6 +1520,8 @@ Reference<XAccessible> SwAccessibleParagraph::getSelectedAccessibleChild( throw ( IndexOutOfBoundsException, RuntimeException) { + CHECK_FOR_DEFUNC( XAccessibleSelection ); + return aSelectionHelper.getSelectedAccessibleChild(nSelectedChildIndex); } @@ -1518,5 +1530,7 @@ void SwAccessibleParagraph::deselectSelectedAccessibleChild( throw ( IndexOutOfBoundsException, RuntimeException ) { + CHECK_FOR_DEFUNC( XAccessibleSelection ); + aSelectionHelper.deselectSelectedAccessibleChild(nSelectedChildIndex); } diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index 1878436e4bc2..6014e4ad68ec 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: acctable.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: vg $ $Date: 2002-04-19 12:59:38 $ + * last change: $Author: mib $ $Date: 2002-05-03 12:34:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -136,51 +136,12 @@ using namespace ::rtl; const sal_Char sServiceName[] = "com.sun.star.table.AccessibleTableView"; const sal_Char sImplementationName[] = "SwAccessibleTable"; -class SwAccessibleTableEvent_Impl -{ - const SwFrm *mpFrm; - sal_Int32 mnRow; - sal_Int32 mnColumn; - sal_Int32 mnRowExtent; - sal_Int32 mnColumnExtent; - -public: - - inline SwAccessibleTableEvent_Impl( const SwFrm *pFrm, - sal_Int32 nRow, sal_Int32 nColumn, - sal_Int32 nRowExtent, - sal_Int32 nColumnExtent ); - const SwFrm *GetFrm() const { return mpFrm; } - - const sal_Int32 GetRow() const { return mnRow; } - const sal_Int32 GetColumn() const { return mnColumn; } - - const sal_Int32 GetRowExtent() const { return mnRowExtent; } - const sal_Int32 GetColumnExtent() const { return mnColumnExtent; } -}; - -inline SwAccessibleTableEvent_Impl::SwAccessibleTableEvent_Impl( - const SwFrm *pFrm, - sal_Int32 nRow, sal_Int32 nColumn, - sal_Int32 nRowExtent, - sal_Int32 nColumnExtent ) : - mpFrm( pFrm ), mnRow( nRow ), mnColumn( nColumn ), - mnRowExtent( nRowExtent ), mnColumnExtent( nColumnExtent ) -{ -} - -typedef ::std::list < SwAccessibleTableEvent_Impl > _SwAccessibleTableEventList_Impl; -class SwAccessibleTableEventList_Impl : public _SwAccessibleTableEventList_Impl -{ -public: - SwAccessibleTableEventList_Impl() : _SwAccessibleTableEventList_Impl() {} -}; - -//------------------------------------------------------------------------------ - typedef ::std::less < sal_Int32 > Int32Less_Impl; typedef ::std::set < sal_Int32, Int32Less_Impl > Int32Set_Impl; +typedef ::std::pair < sal_Int32, sal_Int32 > Int32Pair_Impl; +typedef ::std::list < Int32Pair_Impl > Int32PairList_Impl; + class SwAccTableSelHander_Impl { public: @@ -194,10 +155,15 @@ class SwAccessibleTableData_Impl { Int32Set_Impl maRows; Int32Set_Impl maColumns; + Int32PairList_Impl maExtents; // cell extends for event processing only Point maTabFrmPos; const SwTabFrm *mpTabFrm; - void CollectData( const Point& rPos, const SwFrm *pFrm ); + void CollectData( const SwFrm *pFrm ); + void CollectExtents( const SwFrm *pFrm ); + sal_Bool CompareExtents( const SwFrm *pFrm, + Int32PairList_Impl::const_iterator& rIter, + const Int32PairList_Impl::const_iterator& rEndIter ) const; sal_Bool FindCell( const Point& rPos, const SwFrm *pFrm , sal_Bool bExact, const SwFrm *& rFrm ) const; @@ -223,6 +189,7 @@ public: sal_Bool bExact ) const; inline sal_Int32 GetRowCount() const; inline sal_Int32 GetColumnCount() const; + sal_Bool CompareExtents( const SwAccessibleTableData_Impl& r ) const; void GetSelection( sal_Int32 nStart, sal_Int32 nEnd, const SwSelBoxes& rSelBoxes, @@ -235,15 +202,14 @@ public: void GetRowColumnAndExtent( const SwRect& rBox, sal_Int32& rRow, sal_Int32& rColumn, - sal_Int32& rRowExtend, - sal_Int32& rColumnExtend ); + sal_Int32& rRowExtent, + sal_Int32& rColumnExtent ) const; const Point& GetTablePos() const { return maTabFrmPos; } void SetTablePos( const Point& rPos ) { maTabFrmPos = rPos; } }; -void SwAccessibleTableData_Impl::CollectData( const Point& rPos, - const SwFrm *pFrm ) +void SwAccessibleTableData_Impl::CollectData( const SwFrm *pFrm ) { const SwFrmOrObjSList aList( pFrm ); SwFrmOrObjSList::const_iterator aIter( aList.begin() ); @@ -256,22 +222,95 @@ void SwAccessibleTableData_Impl::CollectData( const Point& rPos, { if( pLower->IsRowFrm() ) { - maRows.insert( pLower->Frm().Top() - rPos.Y() ); - CollectData( rPos, pLower ); + maRows.insert( pLower->Frm().Top() - maTabFrmPos.Y() ); + CollectData( pLower ); } else if( pLower->IsCellFrm() && rLower.IsAccessible() ) { - maColumns.insert( pLower->Frm().Left() - rPos.X() ); + maColumns.insert( pLower->Frm().Left() - maTabFrmPos.X() ); + } + else + { + CollectData( pLower ); + } + } + ++aIter; + } +} + +void SwAccessibleTableData_Impl::CollectExtents( const SwFrm *pFrm ) +{ + const SwFrmOrObjSList aList( pFrm ); + SwFrmOrObjSList::const_iterator aIter( aList.begin() ); + SwFrmOrObjSList::const_iterator aEndIter( aList.end() ); + while( aIter != aEndIter ) + { + const SwFrmOrObj& rLower = *aIter; + const SwFrm *pLower = rLower.GetSwFrm(); + if( pLower ) + { + if( pLower->IsCellFrm() && rLower.IsAccessible() ) + { + sal_Int32 nRow, nCol; + Int32Pair_Impl aCellExtents; + GetRowColumnAndExtent( pLower->Frm(), nRow, nCol, + aCellExtents.first, + aCellExtents.second ); + + maExtents.push_back( aCellExtents ); } else { - CollectData( rPos, pLower ); + CollectExtents( pLower ); } } ++aIter; } } +sal_Bool SwAccessibleTableData_Impl::CompareExtents( const SwFrm *pFrm, + Int32PairList_Impl::const_iterator& rIter, + const Int32PairList_Impl::const_iterator& rEndIter ) const +{ + sal_Bool bRet = sal_True; + + const SwFrmOrObjSList aList( pFrm ); + SwFrmOrObjSList::const_iterator aIter( aList.begin() ); + SwFrmOrObjSList::const_iterator aEndIter( aList.end() ); + while( bRet && aIter != aEndIter ) + { + const SwFrmOrObj& rLower = *aIter; + const SwFrm *pLower = rLower.GetSwFrm(); + if( pLower ) + { + if( pLower->IsCellFrm() && rLower.IsAccessible() ) + { + sal_Int32 nRow, nCol; + Int32Pair_Impl aCellExtents; + GetRowColumnAndExtent( pLower->Frm(), nRow, nCol, + aCellExtents.first, + aCellExtents.second ); + if( rIter == rEndIter || + *rIter != aCellExtents ) + { + bRet = sal_False; + } + else + { + rIter++; + } + } + else + { + bRet = CompareExtents( pLower, rIter, rEndIter ); + } + } + ++aIter; + } + + return bRet; +} + sal_Bool SwAccessibleTableData_Impl::FindCell( const Point& rPos, const SwFrm *pFrm, sal_Bool bExact, const SwFrm *& rRet ) const @@ -445,12 +484,34 @@ inline sal_Int32 SwAccessibleTableData_Impl::GetColumnCount() const return static_cast< sal_Int32 >( maColumns.size() ); } +sal_Bool SwAccessibleTableData_Impl::CompareExtents( + const SwAccessibleTableData_Impl& rCmp ) const +{ + if( maExtents.size() != rCmp.maExtents.size() ) + return sal_False; + + Int32PairList_Impl::const_iterator aIter( maExtents.begin() ); + Int32PairList_Impl::const_iterator aEndIter( maExtents.end() ); + Int32PairList_Impl::const_iterator aCmpIter( rCmp.maExtents.begin() ); + while( aIter != aEndIter ) + { + if( *aIter != *aCmpIter ) + return sal_False; + + ++aIter; + ++aCmpIter; + } + + return sal_True; +} + SwAccessibleTableData_Impl::SwAccessibleTableData_Impl( const SwTabFrm *pTabFrm ) : mpTabFrm( pTabFrm ), maTabFrmPos( pTabFrm->Frm().Pos() ) { - CollectData( mpTabFrm->Frm().Pos(), mpTabFrm ); + CollectData( mpTabFrm ); + CollectExtents( mpTabFrm ); } inline Int32Set_Impl::const_iterator SwAccessibleTableData_Impl::GetRowIter( @@ -496,7 +557,7 @@ void SwAccessibleTableData_Impl::CheckRowAndCol( void SwAccessibleTableData_Impl::GetRowColumnAndExtent( const SwRect& rBox, sal_Int32& rRow, sal_Int32& rColumn, - sal_Int32& rRowExtent, sal_Int32& rColumnExtent ) + sal_Int32& rRowExtent, sal_Int32& rColumnExtent ) const { Int32Set_Impl::const_iterator aStt( maRows.lower_bound( rBox.Top() - maTabFrmPos.Y() ) ); @@ -621,29 +682,15 @@ const SwSelBoxes *SwAccessibleTable::GetSelBoxes() const return pSelBoxes; } -void SwAccessibleTable::AppendEvent( const SwFrm *pFrm, const SwRect& rBox ) -{ - sal_Int32 nRow, nCol, nRowExt, nColExt; - mpTableData->GetRowColumnAndExtent( rBox, nRow, nCol, nRowExt, nColExt ); - - if( !mpEvents ) - mpEvents = new SwAccessibleTableEventList_Impl; - SwAccessibleTableEvent_Impl aEvent( pFrm, nRow, nCol, nRowExt, nColExt ); - mpEvents->push_back( aEvent ); -} - void SwAccessibleTable::FireTableChangeEvent( - const SwAccessibleTableData_Impl *pTableData ) + const SwAccessibleTableData_Impl& rTableData ) { - if( !pTableData ) - pTableData = &GetTableData(); - AccessibleTableModelChange aModelChange; aModelChange.Type = AccessibleTableModelChangeType::UPDATE; aModelChange.FirstRow = 0; - aModelChange.LastRow = pTableData->GetRowCount() - 1; + aModelChange.LastRow = rTableData.GetRowCount() - 1; aModelChange.FirstColumn = 0; - aModelChange.LastColumn = pTableData->GetColumnCount() - 1; + aModelChange.LastColumn = rTableData.GetColumnCount() - 1; AccessibleEventObject aEvent; aEvent.EventId = AccessibleEventId::ACCESSIBLE_TABLE_MODEL_CHANGED; @@ -662,8 +709,7 @@ SwAccessibleTable::SwAccessibleTable( SwAccessibleMap *pMap, const SwTabFrm *pTabFrm ) : SwAccessibleContext( pMap, AccessibleRole::TABLE, pTabFrm ), - mpTableData( 0 ), - mpEvents( 0 ) + mpTableData( 0 ) { vos::OGuard aGuard(Application::GetSolarMutex()); @@ -682,8 +728,6 @@ SwAccessibleTable::~SwAccessibleTable() vos::OGuard aGuard(Application::GetSolarMutex()); delete mpTableData; - ASSERT( !mpEvents, "events are existing" ); - delete mpEvents; } Any SwAccessibleTable::queryInterface( const Type& rType ) @@ -692,8 +736,8 @@ Any SwAccessibleTable::queryInterface( const Type& rType ) Any aRet; if ( rType == ::getCppuType((Reference<XAccessibleTable> *)0) ) { -// Reference<XAccessibleTable> xThis( this ); -// aRet <<= xThis; + Reference<XAccessibleTable> xThis( this ); + aRet <<= xThis; } else { @@ -709,16 +753,12 @@ void SwAccessibleTable::UpdateTableData() delete mpTableData; mpTableData = new SwAccessibleTableData_Impl( pTabFrm ); - delete mpEvents; - mpEvents = 0; } void SwAccessibleTable::ClearTableData() { delete mpTableData; mpTableData = 0; - delete mpEvents; - mpEvents = 0; } OUString SAL_CALL SwAccessibleTable::getAccessibleDescription (void) @@ -1109,60 +1149,8 @@ void SwAccessibleTable::InvalidatePosOrSize( const SwRect& rOldBox ) vos::OGuard aGuard(Application::GetSolarMutex()); if( HasTableData() ) - { GetTableData().SetTablePos( GetFrm()->Frm().Pos() ); - const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() ); - - SwAccessibleTableData_Impl *pOldTableData = mpTableData; - - if( mpEvents ) - { - mpTableData = new SwAccessibleTableData_Impl( pTabFrm ); - sal_Bool bFireEvent = sal_False; - - SwAccessibleTableEventList_Impl::const_iterator aIter( mpEvents->begin() ); - SwAccessibleTableEventList_Impl::const_iterator aEndIter( mpEvents->end() ); - while( !bFireEvent && aIter != aEndIter ) - { - const SwAccessibleTableEvent_Impl& rEvent = *aIter; - if( rEvent.GetFrm() && rEvent.GetRowExtent() > 0 && - rEvent.GetColumnExtent() > 0 ) - { - // the frame did extist before. - sal_Int32 nRow, nCol, nRowExt, nColExt; - mpTableData->GetRowColumnAndExtent( - rEvent.GetFrm()->Frm(), nRow, nCol, nRowExt, nColExt ); - if( nRow != rEvent.GetRow() || nCol != rEvent.GetColumn() || - nRowExt != rEvent.GetRowExtent() || - nColExt != rEvent.GetColumnExtent() ) - { - bFireEvent = sal_True; - } - } - else - { - // in any other case currently change the whole model. - bFireEvent = sal_True; - } - - ++aIter; - } - - if( bFireEvent ) - FireTableChangeEvent( pOldTableData ); - - delete mpEvents; - mpEvents = 0; - } - else - { - mpTableData = 0; - } - - delete pOldTableData; - } - SwAccessibleContext::InvalidatePosOrSize( rOldBox ); } @@ -1173,18 +1161,8 @@ void SwAccessibleTable::DisposeChild( const SwFrm *pFrm, if( HasTableData() ) { - if( GetMap()->GetShell()->ActionPend() ) - { - AppendDisposeEvent( pFrm ); - } - else - { - const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() ); - SwAccessibleTableData_Impl *pOldTableData = mpTableData; - mpTableData = new SwAccessibleTableData_Impl( pTabFrm ); - FireTableChangeEvent( pOldTableData ); - delete pOldTableData; - } + FireTableChangeEvent( GetTableData() ); + ClearTableData(); } // There are two reason why this method has been called. The first one @@ -1204,17 +1182,24 @@ void SwAccessibleTable::InvalidateChildPosOrSize( const SwFrm *pFrm, if( HasTableData() ) { - if( GetMap()->GetShell()->ActionPend() ) - { - AppendPosOrSizeEvent( pFrm, rOldBox ); - } - else + ASSERT( !HasTableData() || + GetFrm()->Frm().Pos() == GetTableData().GetTablePos(), + "table has invalid position" ); + if( HasTableData() ) { const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() ); - SwAccessibleTableData_Impl *pOldTableData = mpTableData; - mpTableData = new SwAccessibleTableData_Impl( pTabFrm ); - FireTableChangeEvent( pOldTableData ); - delete pOldTableData; + SwAccessibleTableData_Impl *pNewTableData = + new SwAccessibleTableData_Impl( pTabFrm ); + if( !pNewTableData->CompareExtents( GetTableData() ) ) + { + FireTableChangeEvent( GetTableData() ); + ClearTableData(); + mpTableData = pNewTableData; + } + else + { + delete pNewTableData; + } } } diff --git a/sw/source/core/access/acctable.hxx b/sw/source/core/access/acctable.hxx index 183435f6ca13..dbdd3234cfdc 100644 --- a/sw/source/core/access/acctable.hxx +++ b/sw/source/core/access/acctable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: acctable.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2002-04-17 14:07:39 $ + * last change: $Author: mib $ $Date: 2002-05-03 12:34:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,21 +75,15 @@ class SwTabFrm; class SwAccessibleTableData_Impl; -class SwAccessibleTableEventList_Impl; class SwAccessibleTable : public SwAccessibleContext, public ::drafts::com::sun::star::accessibility::XAccessibleTable { SwAccessibleTableData_Impl *mpTableData; // the table's data, prot by Sol-Mutex - SwAccessibleTableEventList_Impl *mpEvents; // the table's data, prot by Sol-Mutex const SwSelBoxes *GetSelBoxes() const; - void AppendEvent( const SwFrm *pFrm, const SwRect& rBox ); - inline void AppendDisposeEvent( const SwFrm *pFrm); - inline void AppendPosOrSizeEvent( const SwFrm *pFrm, const SwRect& rBox ); - - void FireTableChangeEvent( const SwAccessibleTableData_Impl *pTableData=0 ); + void FireTableChangeEvent( const SwAccessibleTableData_Impl& rTableData ); protected: @@ -239,18 +233,6 @@ public: const SwRect& rFrm ); }; - -inline void SwAccessibleTable::AppendDisposeEvent( const SwFrm *pFrm ) -{ - AppendEvent( 0, pFrm->Frm() ); -} - -inline void SwAccessibleTable::AppendPosOrSizeEvent( const SwFrm *pFrm, - const SwRect& rBox ) -{ - AppendEvent( pFrm, rBox ); -} - inline SwAccessibleTableData_Impl& SwAccessibleTable::GetTableData() { if( !mpTableData ) |