diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-18 12:59:21 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-18 12:59:21 +0000 |
commit | a82083128b2a4c6538ef5bff38dcc21e620b7a2c (patch) | |
tree | edcf668b2882cbb3247214ac784af62abc9eb20a /svtools | |
parent | 0b8d7416168e73df21a79da11b4eeb470cb55c17 (diff) |
CWS-TOOLING: integrate CWS impressaccessibility4
2009-09-16 19:30:19 +0200 af r276217 : #i80994# Fixed the triggering of accessibility initialization.
2009-09-16 18:43:57 +0200 af r276214 : #i93083# ValueSet now handles the FOCUSED and FOCUSABLE states correctly.
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/valueacc.cxx | 36 | ||||
-rw-r--r-- | svtools/source/control/valueimp.hxx | 13 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 21 |
3 files changed, 56 insertions, 14 deletions
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index afdb728f450e..96eb8bb39e99 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -37,6 +37,7 @@ #include <vcl/svapp.hxx> #include <svtools/valueset.hxx> #include "valueimp.hxx" +#include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -92,7 +93,8 @@ void ValueSetItem::ClearAccessible() ValueSetAcc::ValueSetAcc( ValueSet* pParent, bool bIsTransientChildrenDisabled ) : ValueSetAccComponentBase (m_aMutex), mpParent( pParent ), - mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ) + mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ), + mbIsFocused(false) { } @@ -166,6 +168,35 @@ ValueSetAcc* ValueSetAcc::getImplementation( const uno::Reference< uno::XInterfa } } + +// ----------------------------------------------------------------------------- + +void ValueSetAcc::GetFocus (void) +{ + mbIsFocused = true; + + // Boradcast the state change. + ::com::sun::star::uno::Any aOldState, aNewState; + aNewState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; + FireAccessibleEvent( + ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, + aOldState, aNewState); +} + +// ----------------------------------------------------------------------------- + +void ValueSetAcc::LoseFocus (void) +{ + mbIsFocused = false; + + // Boradcast the state change. + ::com::sun::star::uno::Any aOldState, aNewState; + aOldState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; + FireAccessibleEvent( + ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, + aOldState, aNewState); +} + // ----------------------------------------------------------------------------- uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueSetAcc::getAccessibleContext() @@ -321,6 +352,9 @@ uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueSetAcc::getAc pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE); if ( !mbIsTransientChildrenDisabled ) pStateSet->AddState (accessibility::AccessibleStateType::MANAGES_DESCENDANTS); + pStateSet->AddState (accessibility::AccessibleStateType::FOCUSABLE); + if (mbIsFocused) + pStateSet->AddState (accessibility::AccessibleStateType::FOCUSED); return pStateSet; } diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx index 8d7951da0dfc..c176629953ae 100644 --- a/svtools/source/control/valueimp.hxx +++ b/svtools/source/control/valueimp.hxx @@ -150,6 +150,17 @@ public: public: + /** Called by the corresponding ValueSet when it gets the focus. + Stores the new focus state and broadcasts a state change event. + */ + void GetFocus (void); + + /** Called by the corresponding ValueSet when it loses the focus. + Stores the new focus state and broadcasts a state change event. + */ + void LoseFocus (void); + + // XAccessible virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); @@ -201,6 +212,8 @@ private: ::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners; ValueSet* mpParent; bool mbIsTransientChildrenDisabled; + /// The current FOCUSED state. + bool mbIsFocused; static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 7326f540c654..4033a9df7bb5 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1683,13 +1683,10 @@ void ValueSet::GetFocus() ImplDrawSelect(); Control::GetFocus(); - // Send accessibility event. - ::com::sun::star::uno::Any aOldState, aNewState; - aNewState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; - ImplFireAccessibleEvent ( - ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, - aOldState, aNewState); - + // Tell the accessible object that we got the focus. + ValueSetAcc* pAcc = ValueSetAcc::getImplementation( GetAccessible( FALSE ) ); + if( pAcc ) + pAcc->GetFocus(); } // ----------------------------------------------------------------------- @@ -1703,12 +1700,10 @@ void ValueSet::LoseFocus() HideFocus(); Control::LoseFocus(); - // Send accessibility event. - ::com::sun::star::uno::Any aOldState, aNewState; - aOldState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; - ImplFireAccessibleEvent ( - ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, - aOldState, aNewState); + // Tell the accessible object that we lost the focus. + ValueSetAcc* pAcc = ValueSetAcc::getImplementation( GetAccessible( FALSE ) ); + if( pAcc ) + pAcc->LoseFocus(); } // ----------------------------------------------------------------------- |