diff options
author | Oliver Bolte <obo@openoffice.org> | 2009-02-27 05:38:42 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2009-02-27 05:38:42 +0000 |
commit | 590a804e7815574a066c658f1f05875a6d0f448f (patch) | |
tree | 2ba33087772154dc21e47c7537422eb45c2e078f | |
parent | fbb1370148b2eebc0d6819d77c67f7a2d30b924a (diff) |
CWS-TOOLING: integrate CWS sw31a11y01
2009-01-09 11:36:08 +0100 ab r266069 : #i97891# NSAccessibilityRoleDescription
2009-01-07 11:01:19 +0100 od r265955 : #i88069# emit accessibility event TEXT_ATTRIBUTE_CHANGED on change of paragraph attributes
2009-01-06 11:50:21 +0100 od r265904 : #i81824# methods <SwWrtShell::_FwdPara()> and <SwWrtShell::_BwdPara()>
- avoid unnecessary cursor movements due avoid unnecessary
accessibility events.
-rw-r--r-- | sw/inc/accmap.hxx | 7 | ||||
-rw-r--r-- | sw/inc/viewsh.hxx | 11 | ||||
-rw-r--r-- | sw/source/core/access/acccontext.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/access/acccontext.hxx | 8 | ||||
-rw-r--r-- | sw/source/core/access/accmap.cxx | 67 | ||||
-rw-r--r-- | sw/source/core/inc/viewimp.hxx | 10 | ||||
-rw-r--r-- | sw/source/core/text/txtfrm.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/view/viewimp.cxx | 21 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 14 | ||||
-rw-r--r-- | sw/source/ui/wrtsh/wrtsh4.cxx | 43 |
10 files changed, 188 insertions, 14 deletions
diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx index 56f089059bf5..ba18cf599872 100644 --- a/sw/inc/accmap.hxx +++ b/sw/inc/accmap.hxx @@ -136,6 +136,9 @@ public: #define ACC_STATE_OPAQUE 0x02 // pseudo states for events +// --> OD 2009-01-07 #i88069# - pseudo state for event TEXT_ATTRIBUTE_CHANGED +#define ACC_STATE_TEXT_ATTRIBUTE_CHANGED 0x0200 +// <-- // --> OD 2005-12-12 #i27301# - pseudo state for event TEXT_SELECTION_CHANGED #define ACC_STATE_TEXT_SELECTION_CHANGED 0x0100 // <-- @@ -282,6 +285,10 @@ public: void InvalidateContent( const SwFrm *pFrm ); + // --> OD 2009-01-06 #i88069# + void InvalidateAttr( const SwTxtFrm& rTxtFrm ); + // <-- + void InvalidateCursorPosition( const SwFrm *pFrm ); void InvalidateFocus(); diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 060bcb2a9e3d..d73db5d79e0b 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -564,6 +564,17 @@ public: */ void InvalidateAccessibleParaTextSelection(); + /** invalidate attributes for paragraphs + + OD 2009-01-06 #i88069# + + @author OD + + @param rTxtFrm + input parameter - paragraph frame, whose attributes have changed + */ + void InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm ); + ViewShell( ViewShell&, Window *pWin = 0, OutputDevice *pOut = 0, long nFlags = 0 ); ViewShell( SwDoc& rDoc, Window *pWin, diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index 9fa7d16b6850..1993978d9030 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -1332,6 +1332,20 @@ void SwAccessibleContext::InvalidateTextSelection() FireAccessibleEvent( aEvent ); } +/** attributes has changed + + OD 2009-01-06 #i88069# + + @author OD +*/ +void SwAccessibleContext::InvalidateAttr() +{ + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::TEXT_ATTRIBUTE_CHANGED; + + FireAccessibleEvent( aEvent ); +} + sal_Bool SwAccessibleContext::HasCursor() { return sal_False; diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx index 778be8054d0e..d35f026968b0 100644 --- a/sw/source/core/access/acccontext.hxx +++ b/sw/source/core/access/acccontext.hxx @@ -376,6 +376,14 @@ public: */ void InvalidateTextSelection(); + /** attributes has changed + + OD 2009-01-06 #i88069# + + @author OD + */ + void InvalidateAttr(); + const ::rtl::OUString& GetName() const { return sName; } virtual sal_Bool HasCursor(); // required by map to remember that object diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 256bdf4e0ab9..a9ec7b047da8 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -325,7 +325,8 @@ public: POS_CHANGED, CHILD_POS_CHANGED, SHAPE_SELECTION, - DISPOSE }; + DISPOSE, + INVALID_ATTR }; private: SwRect maOldBox; // the old bounds for CHILD_POS_CHANGED @@ -458,6 +459,12 @@ public: return ( mnStates & ACC_STATE_TEXT_SELECTION_CHANGED ) != 0; } // <-- + // --> OD 2009-01-07 #i88069# - new event TEXT_ATTRIBUTE_CHANGED + inline sal_Bool IsInvalidateTextAttrs() const + { + return ( mnStates & ACC_STATE_TEXT_ATTRIBUTE_CHANGED ) != 0; + } + // <-- // --> OD 2005-12-12 #i27301# - use new type definition <tAccessibleStates> // for return value inline tAccessibleStates GetStates() const @@ -613,6 +620,13 @@ void SwAccessibleMap::FireEvent( const SwAccessibleEvent_Impl& rEvent ) } else if( xAccImpl.isValid() && xAccImpl->GetFrm() ) { + // --> OD 2009-01-07 #i88069# + if ( rEvent.GetType() != SwAccessibleEvent_Impl::DISPOSE && + rEvent.IsInvalidateTextAttrs() ) + { + xAccImpl->InvalidateAttr(); + } + // <-- switch( rEvent.GetType() ) { case SwAccessibleEvent_Impl::INVALID_CONTENT: @@ -629,6 +643,11 @@ void SwAccessibleMap::FireEvent( const SwAccessibleEvent_Impl& rEvent ) ASSERT( xAccImpl.isValid(), "dispose event has been stored" ); break; + // --> OD 2009-01-06 #i88069# + case SwAccessibleEvent_Impl::INVALID_ATTR: + // nothing to do here - handled above + break; + // <-- default: break; } @@ -744,6 +763,12 @@ void SwAccessibleMap::AppendEvent( const SwAccessibleEvent_Impl& rEvent ) // remove all events for the frame in question. bAppendEvent = sal_False; break; + // --> OD 2009-01-06 #i88069# + case SwAccessibleEvent_Impl::INVALID_ATTR: + ASSERT( aEvent.GetType() == SwAccessibleEvent_Impl::INVALID_ATTR, + "invalid event combination" ); + break; + // <-- } if( bAppendEvent ) { @@ -1683,6 +1708,46 @@ void SwAccessibleMap::InvalidateContent( const SwFrm *pFrm ) } } +// --> OD 2009-01-06 #i88069# +void SwAccessibleMap::InvalidateAttr( const SwTxtFrm& rTxtFrm ) +{ + SwFrmOrObj aFrmOrObj( &rTxtFrm ); + if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) ) + { + uno::Reference < XAccessible > xAcc; + { + vos::OGuard aGuard( maMutex ); + + if( mpFrmMap ) + { + SwAccessibleContextMap_Impl::iterator aIter = + mpFrmMap->find( aFrmOrObj.GetSwFrm() ); + if( aIter != mpFrmMap->end() ) + xAcc = (*aIter).second; + } + } + + if( xAcc.is() ) + { + SwAccessibleContext *pAccImpl = + static_cast< SwAccessibleContext *>( xAcc.get() ); + if( GetShell()->ActionPend() ) + { + SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::INVALID_ATTR, + pAccImpl, aFrmOrObj ); + aEvent.SetStates( ACC_STATE_TEXT_ATTRIBUTE_CHANGED ); + AppendEvent( aEvent ); + } + else + { + FireEvents(); + pAccImpl->InvalidateAttr(); + } + } + } +} +// <-- + void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm ) { SwFrmOrObj aFrmOrObj( pFrm ); diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx index 476990022ff2..d51d42f04339 100644 --- a/sw/source/core/inc/viewimp.hxx +++ b/sw/source/core/inc/viewimp.hxx @@ -201,6 +201,16 @@ private: */ void _InvalidateAccessibleParaTextSelection(); + /** invalidate attributes for paragraphs + + OD 2009-01-06 #i88069# + implementation for wrapper method + <ViewShell::InvalidateAccessibleParaAttrs(..)> + + @author OD + */ + void _InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm ); + public: SwViewImp( ViewShell * ); ~SwViewImp(); diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 32404b85e2b9..e7f0fcd88fb1 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1296,6 +1296,13 @@ void SwTxtFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) else SwCntntFrm::Modify( pOld, pNew ); } + + // --> OD 2009-01-06 #i88069# + if ( GetShell() ) + { + GetShell()->InvalidateAccessibleParaAttrs( *this ); + } + // <-- } break; diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index cf409d8cc90f..7bb1aabe07c8 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -572,6 +572,27 @@ void SwViewImp::_InvalidateAccessibleParaTextSelection() } while ( pTmp != pVSh ); } +/** invalidate attributes for paragraphs + + OD 2009-01-06 #i88069# + + @author OD +*/ +void SwViewImp::_InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm ) +{ + ViewShell* pVSh = GetShell(); + ViewShell* pTmp = pVSh; + do + { + if ( pTmp->Imp()->IsAccessible() ) + { + pTmp->Imp()->GetAccessibleMap().InvalidateAttr( rTxtFrm ); + } + + pTmp = (ViewShell *)pTmp->GetNext(); + } while ( pTmp != pVSh ); +} + // OD 15.01.2003 #103492# - method signature change due to new page preview functionality void SwViewImp::UpdateAccessiblePreview( const std::vector<PrevwPage*>& _rPrevwPages, const Fraction& _rScale, diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 3849a3ee1f84..b63a32d03c5a 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -2567,6 +2567,20 @@ void ViewShell::InvalidateAccessibleParaTextSelection() } } +/** invalidate attributes for paragraphs + + OD 2009-01-06 #i88069# + + @author OD +*/ +void ViewShell::InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm ) +{ + if ( GetLayout() && GetLayout()->IsAnyShellAccessible() ) + { + Imp()->_InvalidateAccessibleParaAttrs( rTxtFrm ); + } +} + /* -----------------------------06.05.2002 13:23------------------------------ ---------------------------------------------------------------------------*/ diff --git a/sw/source/ui/wrtsh/wrtsh4.cxx b/sw/source/ui/wrtsh/wrtsh4.cxx index b7203ca765db..0a7c17118abd 100644 --- a/sw/source/ui/wrtsh/wrtsh4.cxx +++ b/sw/source/ui/wrtsh/wrtsh4.cxx @@ -250,12 +250,16 @@ BOOL SwWrtShell::_FwdPara() { Push(); ClearMark(); - if(!SwCrsrShell::Right(1,CRSR_SKIP_CHARS)) - { - Pop(FALSE); - return 0; - } - SwCrsrShell::Left(1,CRSR_SKIP_CHARS); + // --> OD 2009-01-06 #i81824# + // going right and back again left not needed and causes too much + // accessibility events due to the cursor movements. +// if(!SwCrsrShell::Right(1,CRSR_SKIP_CHARS)) +// { +// Pop(FALSE); +// return 0; +// } +// SwCrsrShell::Left(1,CRSR_SKIP_CHARS); + // <-- BOOL bRet = SwCrsrShell::MovePara(fnParaNext, fnParaStart); ClearMark(); @@ -268,15 +272,28 @@ BOOL SwWrtShell::_BwdPara() { Push(); ClearMark(); - if(!SwCrsrShell::Left(1,CRSR_SKIP_CHARS)) + // --> OD 2009-01-06 #i81824# + // going left and back again right not needed and causes too much + // accessibility events due to the cursor movements. +// if(!SwCrsrShell::Left(1,CRSR_SKIP_CHARS)) +// { +// Pop(FALSE); +// return 0; +// } +// SwCrsrShell::Right(1,CRSR_SKIP_CHARS); + // <-- + // --> OD 2009-01-06 #i81824# + // going to start of paragraph only needed, if move to previous paragraph + // does not happen. Otherwise, useless accessibility events are triggered + // due to cursor movements. +// if(!IsSttOfPara()) +// SttPara(); + BOOL bRet = SwCrsrShell::MovePara(fnParaPrev, fnParaStart); + if ( !bRet && !IsSttOfPara() ) { - Pop(FALSE); - return 0; - } - SwCrsrShell::Right(1,CRSR_SKIP_CHARS); - if(!IsSttOfPara()) SttPara(); - BOOL bRet = SwCrsrShell::MovePara(fnParaPrev, fnParaStart); + } + // <-- ClearMark(); Combine(); |