Integrate branch of IAccessible2

Change-Id: I95b681a7aa171c321a876e6a38392e30583d7a5b
This commit is contained in:
Steve Yin 2013-11-26 10:51:41 +00:00 committed by Caolán McNamara
parent 22029c7e17
commit 968a768173
3 changed files with 64 additions and 1 deletions

View file

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

View file

@ -31,6 +31,7 @@
#include <vcl/dialog.hxx>
#include <vcl/vclevent.hxx>
#include <vcl/window.hxx>
#include <vcl/edit.hxx>
#include <tools/debug.hxx>
#include <unotools/accessiblestatesethelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
@ -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();
}
}

View file

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