From 968a76817340cafaeb239b71164974e3c0c43f04 Mon Sep 17 00:00:00 2001 From: Steve Yin Date: Tue, 26 Nov 2013 10:51:41 +0000 Subject: [PATCH] Integrate branch of IAccessible2 Change-Id: I95b681a7aa171c321a876e6a38392e30583d7a5b --- include/toolkit/awt/vclxwindows.hxx | 4 ++ .../source/awt/vclxaccessiblecomponent.cxx | 39 ++++++++++++++++++- toolkit/source/awt/vclxwindows.cxx | 22 +++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/include/toolkit/awt/vclxwindows.hxx b/include/toolkit/awt/vclxwindows.hxx index 74b6482f4e2a..641383d1c50a 100644 --- a/include/toolkit/awt/vclxwindows.hxx +++ b/include/toolkit/awt/vclxwindows.hxx @@ -961,6 +961,8 @@ public: class TOOLKIT_DLLPUBLIC VCLXDateField : public ::com::sun::star::awt::XDateField, public VCLXFormattedSpinField { +protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext(); public: VCLXDateField(); ~VCLXDateField(); @@ -1007,6 +1009,8 @@ public: class VCLXTimeField : public ::com::sun::star::awt::XTimeField, public VCLXFormattedSpinField { +protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext(); public: VCLXTimeField(); ~VCLXTimeField(); diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index e1be4c15f190..c087b14455be 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -436,13 +437,46 @@ void VCLXAccessibleComponent::FillAccessibleStateSet( utl::AccessibleStateSetHel if ( pWindow->GetStyle() & WB_SIZEABLE ) rStateSet.AddState( accessibility::AccessibleStateType::RESIZABLE ); - + // 6. frame doesn't have MOVABLE state + // 10. for password text, where is the sensitive state? + if( ( getAccessibleRole() == accessibility::AccessibleRole::FRAME ||getAccessibleRole() == accessibility::AccessibleRole::DIALOG )&& pWindow->GetStyle() & WB_MOVEABLE ) + rStateSet.AddState( accessibility::AccessibleStateType::MOVEABLE ); if( pWindow->IsDialog() ) { Dialog *pDlg = static_cast< Dialog* >( pWindow ); if( pDlg->IsInExecute() ) rStateSet.AddState( accessibility::AccessibleStateType::MODAL ); } + //If a combobox or list's edit child isn't read-only,EDITABLE state + //should be set. + if( pWindow && pWindow->GetType() == WINDOW_COMBOBOX ) + { + if( !( pWindow->GetStyle() & WB_READONLY) || + !((Edit*)pWindow)->IsReadOnly() ) + rStateSet.AddState( accessibility::AccessibleStateType::EDITABLE ); + } + + Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD ); + + while( pWindow && pChild ) + { + Window* pWinTemp = pChild->GetWindow( WINDOW_FIRSTCHILD ); + if( pWinTemp && pWinTemp->GetType() == WINDOW_EDIT ) + { + if( !( pWinTemp->GetStyle() & WB_READONLY) || + !((Edit*)pWinTemp)->IsReadOnly() ) + rStateSet.AddState( accessibility::AccessibleStateType::EDITABLE ); + break; + } + if( pChild->GetType() == WINDOW_EDIT ) + { + if( !( pChild->GetStyle() & WB_READONLY) || + !((Edit*)pChild)->IsReadOnly()) + rStateSet.AddState( accessibility::AccessibleStateType::EDITABLE ); + break; + } + pChild = pChild->GetWindow( WINDOW_NEXT ); + } } else { @@ -767,6 +801,9 @@ sal_Int32 SAL_CALL VCLXAccessibleComponent::getForeground( ) throw (uno::Runtim else aFont = pWindow->GetFont(); nColor = aFont.GetColor().GetColor(); + // COL_AUTO is not very meaningful for AT + if ( nColor == (sal_Int32)COL_AUTO) + nColor = pWindow->GetTextColor().GetColor(); } } diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 84e0f66dbb70..e7a2e84ec7e2 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -4798,6 +4798,17 @@ VCLXDateField::~VCLXDateField() { } +//change the window type here to match the role +::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXDateField::CreateAccessibleContext() +{ + Window* pWindow = GetWindow(); + if ( pWindow ) + { + pWindow->SetType( WINDOW_DATEFIELD ); + } + return getAccessibleFactory().createAccessibleContext( this ); +} + // ::com::sun::star::uno::XInterface ::com::sun::star::uno::Any VCLXDateField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { @@ -5135,6 +5146,17 @@ VCLXTimeField::~VCLXTimeField() { } +//change the window type here to match the role +::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXTimeField::CreateAccessibleContext() +{ + Window* pWindow = GetWindow(); + if ( pWindow ) + { + pWindow->SetType( WINDOW_TIMEFIELD ); + } + return getAccessibleFactory().createAccessibleContext( this ); +} + // ::com::sun::star::uno::XInterface ::com::sun::star::uno::Any VCLXTimeField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) {