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.
This commit is contained in:
Oliver Bolte 2009-02-27 05:38:42 +00:00
parent fbb1370148
commit 590a804e78
10 changed files with 189 additions and 15 deletions

View file

@ -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();

View file

@ -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,

View file

@ -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;

View file

@ -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

View file

@ -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 );

View file

@ -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();

View file

@ -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;

View file

@ -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,

View file

@ -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------------------------------
---------------------------------------------------------------------------*/

View file

@ -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))
{
Pop(FALSE);
return 0;
}
SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
if(!IsSttOfPara())
SttPara();
// --> 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() )
{
SttPara();
}
// <--
ClearMark();
Combine();