Kaydet (Commit) b8ce52aa authored tarafından Noel Grandin's avatar Noel Grandin

convert AccessibleStates to enum class

Change-Id: Ie0d8c16bb768201e8646c3136d7ceca67e506a3c
üst 1f11bd90
...@@ -32,8 +32,9 @@ ...@@ -32,8 +32,9 @@
#include "fesh.hxx" #include "fesh.hxx"
#include <vector> #include <vector>
#include <set> #include <set>
class SwAccessibleParagraph; #include <o3tl/typed_flags_set.hxx>
class SwAccessibleParagraph;
class SwViewShell; class SwViewShell;
class Rectangle; class Rectangle;
class SwFrm; class SwFrm;
...@@ -45,9 +46,7 @@ class SwAccessibleEventList_Impl; ...@@ -45,9 +46,7 @@ class SwAccessibleEventList_Impl;
class SwAccessibleEventMap_Impl; class SwAccessibleEventMap_Impl;
class SwShapeList_Impl; class SwShapeList_Impl;
class SdrObject; class SdrObject;
namespace accessibility { namespace accessibility { class AccessibleShape; }
class AccessibleShape;
}
class SwAccessibleShapeMap_Impl; class SwAccessibleShapeMap_Impl;
struct SwAccessibleEvent_Impl; struct SwAccessibleEvent_Impl;
class SwAccessibleSelectedParas_Impl; class SwAccessibleSelectedParas_Impl;
...@@ -57,22 +56,23 @@ class SwAccPreviewData; ...@@ -57,22 +56,23 @@ class SwAccPreviewData;
struct PreviewPage; struct PreviewPage;
namespace vcl { class Window; } namespace vcl { class Window; }
// real states for events enum class AccessibleStates
#define ACC_STATE_EDITABLE 0x01 {
#define ACC_STATE_OPAQUE 0x02 NONE = 0x0000,
// real states for events
// pseudo states for events EDITABLE = 0x0001,
#define ACC_STATE_TEXT_ATTRIBUTE_CHANGED 0x0200 OPAQUE = 0x0002,
#define ACC_STATE_TEXT_SELECTION_CHANGED 0x0100 // pseudo states for events
#define ACC_STATE_CARET 0x80 TEXT_ATTRIBUTE_CHANGED = 0x0200,
#define ACC_STATE_RELATION_FROM 0x40 TEXT_SELECTION_CHANGED = 0x0100,
#define ACC_STATE_RELATION_TO 0x20 CARET = 0x0080,
RELATION_FROM = 0x0040,
#define ACC_STATE_RELATION_MASK 0x60 RELATION_TO = 0x0020,
};
#define ACC_STATE_MASK 0x1F namespace o3tl
{
typedef sal_uInt16 tAccessibleStates; template<> struct typed_flags<AccessibleStates> : is_typed_flags<AccessibleStates, 0x3e3> {};
}
class SwAccessibleMap : public ::accessibility::IAccessibleViewForwarder, class SwAccessibleMap : public ::accessibility::IAccessibleViewForwarder,
public ::accessibility::IAccessibleParent public ::accessibility::IAccessibleParent
...@@ -212,7 +212,7 @@ public: ...@@ -212,7 +212,7 @@ public:
// Invalidate state of whole tree. If an action is open, this call // Invalidate state of whole tree. If an action is open, this call
// is processed when the last action ends. // is processed when the last action ends.
void InvalidateStates( tAccessibleStates _nStates, void InvalidateStates( AccessibleStates _nStates,
const SwFrm* _pFrm = 0 ); const SwFrm* _pFrm = 0 );
void InvalidateRelationSet( const SwFrm* pMaster, const SwFrm* pFollow ); void InvalidateRelationSet( const SwFrm* pMaster, const SwFrm* pFollow );
......
...@@ -352,7 +352,7 @@ void SwAccessibleContext::ScrolledOut( const SwRect& rOldVisArea ) ...@@ -352,7 +352,7 @@ void SwAccessibleContext::ScrolledOut( const SwRect& rOldVisArea )
// #i27301# - use new type definition for <_nStates> // #i27301# - use new type definition for <_nStates>
void SwAccessibleContext::InvalidateChildrenStates( const SwFrm* _pFrm, void SwAccessibleContext::InvalidateChildrenStates( const SwFrm* _pFrm,
tAccessibleStates _nStates ) AccessibleStates _nStates )
{ {
const SwAccessibleChildSList aVisList( GetVisArea(), *_pFrm, *(GetMap()) ); const SwAccessibleChildSList aVisList( GetVisArea(), *_pFrm, *(GetMap()) );
...@@ -1283,14 +1283,14 @@ void SwAccessibleContext::InvalidateFocus() ...@@ -1283,14 +1283,14 @@ void SwAccessibleContext::InvalidateFocus()
} }
// #i27301# - use new type definition for <_nStates> // #i27301# - use new type definition for <_nStates>
void SwAccessibleContext::InvalidateStates( tAccessibleStates _nStates ) void SwAccessibleContext::InvalidateStates( AccessibleStates _nStates )
{ {
if( GetMap() ) if( GetMap() )
{ {
SwViewShell *pVSh = GetMap()->GetShell(); SwViewShell *pVSh = GetMap()->GetShell();
if( pVSh ) if( pVSh )
{ {
if( (_nStates & ACC_STATE_EDITABLE) != 0 ) if( _nStates & AccessibleStates::EDITABLE )
{ {
bool bIsOldEditableState; bool bIsOldEditableState;
bool bIsNewEditableState = IsEditable( pVSh ); bool bIsNewEditableState = IsEditable( pVSh );
...@@ -1304,7 +1304,7 @@ void SwAccessibleContext::InvalidateStates( tAccessibleStates _nStates ) ...@@ -1304,7 +1304,7 @@ void SwAccessibleContext::InvalidateStates( tAccessibleStates _nStates )
FireStateChangedEvent( AccessibleStateType::EDITABLE, FireStateChangedEvent( AccessibleStateType::EDITABLE,
bIsNewEditableState ); bIsNewEditableState );
} }
if( (_nStates & ACC_STATE_OPAQUE) != 0 ) if( _nStates & AccessibleStates::OPAQUE )
{ {
bool bIsOldOpaqueState; bool bIsOldOpaqueState;
bool bIsNewOpaqueState = IsOpaque( pVSh ); bool bIsNewOpaqueState = IsOpaque( pVSh );
......
...@@ -148,7 +148,7 @@ protected: ...@@ -148,7 +148,7 @@ protected:
// SwFrm might belong the current object or to any child or grandchild! // SwFrm might belong the current object or to any child or grandchild!
// #i27301# - use new type definition for <_nStates> // #i27301# - use new type definition for <_nStates>
void InvalidateChildrenStates( const SwFrm* _pFrm, void InvalidateChildrenStates( const SwFrm* _pFrm,
tAccessibleStates _nStates ); AccessibleStates _nStates );
// Dispose children of the specified SwFrm. The SwFrm might belong to // Dispose children of the specified SwFrm. The SwFrm might belong to
// the current object or to any other child or grandchild. // the current object or to any other child or grandchild.
...@@ -346,7 +346,7 @@ public: ...@@ -346,7 +346,7 @@ public:
// Check states // Check states
// #i27301# - use new type definition for <_nStates> // #i27301# - use new type definition for <_nStates>
void InvalidateStates( tAccessibleStates _nStates ); void InvalidateStates( AccessibleStates _nStates );
// the XAccessibleRelationSet may have changed // the XAccessibleRelationSet may have changed
void InvalidateRelation( sal_uInt16 nType ); void InvalidateRelation( sal_uInt16 nType );
......
...@@ -344,7 +344,7 @@ private: ...@@ -344,7 +344,7 @@ private:
// the same as xAcc for any other // the same as xAcc for any other
// event type // event type
EventType meType; // The event type EventType meType; // The event type
tAccessibleStates mnStates; // check states or update caret pos AccessibleStates mnStates; // check states or update caret pos
public: public:
const SwFrm* mpParentFrm; // The object that fires the event const SwFrm* mpParentFrm; // The object that fires the event
...@@ -360,7 +360,7 @@ public: ...@@ -360,7 +360,7 @@ public:
: mxAcc( pA ), : mxAcc( pA ),
maFrmOrObj( rFrmOrObj ), maFrmOrObj( rFrmOrObj ),
meType( eT ), meType( eT ),
mnStates( 0 ), mnStates( AccessibleStates::NONE ),
mpParentFrm( nullptr ) mpParentFrm( nullptr )
{} {}
...@@ -368,7 +368,7 @@ public: ...@@ -368,7 +368,7 @@ public:
const SwAccessibleChild& rFrmOrObj ) const SwAccessibleChild& rFrmOrObj )
: maFrmOrObj( rFrmOrObj ), : maFrmOrObj( rFrmOrObj ),
meType( eT ), meType( eT ),
mnStates( 0 ), mnStates( AccessibleStates::NONE ),
mpParentFrm( nullptr ) mpParentFrm( nullptr )
{ {
OSL_ENSURE( SwAccessibleEvent_Impl::DISPOSE == meType, OSL_ENSURE( SwAccessibleEvent_Impl::DISPOSE == meType,
...@@ -377,7 +377,7 @@ public: ...@@ -377,7 +377,7 @@ public:
SwAccessibleEvent_Impl( EventType eT ) SwAccessibleEvent_Impl( EventType eT )
: meType( eT ), : meType( eT ),
mnStates( 0 ), mnStates( AccessibleStates::NONE ),
mpParentFrm( nullptr ) mpParentFrm( nullptr )
{ {
OSL_ENSURE( SwAccessibleEvent_Impl::SHAPE_SELECTION == meType, OSL_ENSURE( SwAccessibleEvent_Impl::SHAPE_SELECTION == meType,
...@@ -392,7 +392,7 @@ public: ...@@ -392,7 +392,7 @@ public:
mxAcc( pA ), mxAcc( pA ),
maFrmOrObj( rFrmOrObj ), maFrmOrObj( rFrmOrObj ),
meType( eT ), meType( eT ),
mnStates( 0 ), mnStates( AccessibleStates::NONE ),
mpParentFrm( nullptr ) mpParentFrm( nullptr )
{ {
OSL_ENSURE( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType || OSL_ENSURE( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType ||
...@@ -403,7 +403,7 @@ public: ...@@ -403,7 +403,7 @@ public:
SwAccessibleEvent_Impl( EventType eT, SwAccessibleEvent_Impl( EventType eT,
SwAccessibleContext *pA, SwAccessibleContext *pA,
const SwAccessibleChild& rFrmOrObj, const SwAccessibleChild& rFrmOrObj,
const tAccessibleStates _nStates ) const AccessibleStates _nStates )
: mxAcc( pA ), : mxAcc( pA ),
maFrmOrObj( rFrmOrObj ), maFrmOrObj( rFrmOrObj ),
meType( eT ), meType( eT ),
...@@ -419,7 +419,7 @@ public: ...@@ -419,7 +419,7 @@ public:
maOldBox( rR ), maOldBox( rR ),
maFrmOrObj( rFrmOrObj ), maFrmOrObj( rFrmOrObj ),
meType( eT ), meType( eT ),
mnStates( 0 ), mnStates( AccessibleStates::NONE ),
mpParentFrm( pParentFrm ) mpParentFrm( pParentFrm )
{ {
OSL_ENSURE( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType, OSL_ENSURE( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType,
...@@ -461,39 +461,39 @@ public: ...@@ -461,39 +461,39 @@ public:
} }
// <SetStates(..)> only used in method <SwAccessibleMap::AppendEvent(..)> // <SetStates(..)> only used in method <SwAccessibleMap::AppendEvent(..)>
inline void SetStates( tAccessibleStates _nStates ) inline void SetStates( AccessibleStates _nStates )
{ {
mnStates |= _nStates; mnStates |= _nStates;
} }
inline bool IsUpdateCursorPos() const inline bool IsUpdateCursorPos() const
{ {
return (mnStates & ACC_STATE_CARET) != 0; return bool(mnStates & AccessibleStates::CARET);
} }
inline bool IsInvalidateStates() const inline bool IsInvalidateStates() const
{ {
return (mnStates & ACC_STATE_MASK) != 0; return bool(mnStates & (AccessibleStates::EDITABLE | AccessibleStates::OPAQUE));
} }
inline bool IsInvalidateRelation() const inline bool IsInvalidateRelation() const
{ {
return (mnStates & ACC_STATE_RELATION_MASK) != 0; return bool(mnStates & (AccessibleStates::RELATION_FROM | AccessibleStates::RELATION_TO));
} }
inline bool IsInvalidateTextSelection() const inline bool IsInvalidateTextSelection() const
{ {
return ( mnStates & ACC_STATE_TEXT_SELECTION_CHANGED ) != 0; return bool( mnStates & AccessibleStates::TEXT_SELECTION_CHANGED );
} }
inline bool IsInvalidateTextAttrs() const inline bool IsInvalidateTextAttrs() const
{ {
return ( mnStates & ACC_STATE_TEXT_ATTRIBUTE_CHANGED ) != 0; return bool( mnStates & AccessibleStates::TEXT_ATTRIBUTE_CHANGED );
} }
inline tAccessibleStates GetStates() const inline AccessibleStates GetStates() const
{ {
return mnStates & ACC_STATE_MASK; return mnStates;
} }
inline tAccessibleStates GetAllStates() const inline AccessibleStates GetAllStates() const
{ {
return mnStates; return mnStates;
} }
...@@ -937,12 +937,12 @@ void SwAccessibleMap::FireEvent( const SwAccessibleEvent_Impl& rEvent ) ...@@ -937,12 +937,12 @@ void SwAccessibleMap::FireEvent( const SwAccessibleEvent_Impl& rEvent )
{ {
// both events CONTENT_FLOWS_FROM_RELATION_CHANGED and // both events CONTENT_FLOWS_FROM_RELATION_CHANGED and
// CONTENT_FLOWS_TO_RELATION_CHANGED are possible // CONTENT_FLOWS_TO_RELATION_CHANGED are possible
if ( rEvent.GetAllStates() & ACC_STATE_RELATION_FROM ) if ( rEvent.GetAllStates() & AccessibleStates::RELATION_FROM )
{ {
xAccImpl->InvalidateRelation( xAccImpl->InvalidateRelation(
AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED ); AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED );
} }
if ( rEvent.GetAllStates() & ACC_STATE_RELATION_TO ) if ( rEvent.GetAllStates() & AccessibleStates::RELATION_TO )
{ {
xAccImpl->InvalidateRelation( xAccImpl->InvalidateRelation(
AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED ); AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED );
...@@ -1082,7 +1082,7 @@ void SwAccessibleMap::InvalidateCursorPosition( ...@@ -1082,7 +1082,7 @@ void SwAccessibleMap::InvalidateCursorPosition(
SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES, SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES,
pAccImpl, pAccImpl,
SwAccessibleChild(pAccImpl->GetFrm()), SwAccessibleChild(pAccImpl->GetFrm()),
ACC_STATE_CARET ); AccessibleStates::CARET );
AppendEvent( aEvent ); AppendEvent( aEvent );
} }
else else
...@@ -2570,7 +2570,7 @@ void SwAccessibleMap::InvalidateAttr( const SwTxtFrm& rTxtFrm ) ...@@ -2570,7 +2570,7 @@ void SwAccessibleMap::InvalidateAttr( const SwTxtFrm& rTxtFrm )
{ {
SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::INVALID_ATTR, SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::INVALID_ATTR,
pAccImpl, aFrmOrObj ); pAccImpl, aFrmOrObj );
aEvent.SetStates( ACC_STATE_TEXT_ATTRIBUTE_CHANGED ); aEvent.SetStates( AccessibleStates::TEXT_ATTRIBUTE_CHANGED );
AppendEvent( aEvent ); AppendEvent( aEvent );
} }
else else
...@@ -2839,7 +2839,7 @@ void SwAccessibleMap::SetCursorContext( ...@@ -2839,7 +2839,7 @@ void SwAccessibleMap::SetCursorContext(
mxCursorContext = xAcc; mxCursorContext = xAcc;
} }
void SwAccessibleMap::InvalidateStates( tAccessibleStates _nStates, void SwAccessibleMap::InvalidateStates( AccessibleStates _nStates,
const SwFrm* _pFrm ) const SwFrm* _pFrm )
{ {
// Start with the frame or the first upper that is accessible // Start with the frame or the first upper that is accessible
...@@ -2899,8 +2899,8 @@ void SwAccessibleMap::_InvalidateRelationSet( const SwFrm* pFrm, ...@@ -2899,8 +2899,8 @@ void SwAccessibleMap::_InvalidateRelationSet( const SwFrm* pFrm,
SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES, SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES,
pAccImpl, SwAccessibleChild(pFrm), pAccImpl, SwAccessibleChild(pFrm),
( bFrom ( bFrom
? ACC_STATE_RELATION_FROM ? AccessibleStates::RELATION_FROM
: ACC_STATE_RELATION_TO ) ); : AccessibleStates::RELATION_TO ) );
AppendEvent( aEvent ); AppendEvent( aEvent );
} }
else else
...@@ -2961,7 +2961,7 @@ void SwAccessibleMap::InvalidateParaTextSelection( const SwTxtFrm& _rTxtFrm ) ...@@ -2961,7 +2961,7 @@ void SwAccessibleMap::InvalidateParaTextSelection( const SwTxtFrm& _rTxtFrm )
SwAccessibleEvent_Impl::CARET_OR_STATES, SwAccessibleEvent_Impl::CARET_OR_STATES,
pAccImpl, pAccImpl,
SwAccessibleChild( &_rTxtFrm ), SwAccessibleChild( &_rTxtFrm ),
ACC_STATE_TEXT_SELECTION_CHANGED ); AccessibleStates::TEXT_SELECTION_CHANGED );
AppendEvent( aEvent ); AppendEvent( aEvent );
} }
else else
......
...@@ -337,12 +337,12 @@ void SwViewShellImp::InvalidateAccessibleEditableState( bool bAllShells, ...@@ -337,12 +337,12 @@ void SwViewShellImp::InvalidateAccessibleEditableState( bool bAllShells,
for(SwViewShell& rTmp : GetShell()->GetRingContainer()) for(SwViewShell& rTmp : GetShell()->GetRingContainer())
{ {
if( rTmp.Imp()->IsAccessible() ) if( rTmp.Imp()->IsAccessible() )
rTmp.Imp()->GetAccessibleMap().InvalidateStates( ACC_STATE_EDITABLE, pFrm ); rTmp.Imp()->GetAccessibleMap().InvalidateStates( AccessibleStates::EDITABLE, pFrm );
} }
} }
else if( IsAccessible() ) else if( IsAccessible() )
{ {
GetAccessibleMap().InvalidateStates( ACC_STATE_EDITABLE, pFrm ); GetAccessibleMap().InvalidateStates( AccessibleStates::EDITABLE, pFrm );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment