diff options
author | Armin Le Grand <alg@apache.org> | 2013-11-27 16:25:40 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2013-11-27 16:25:40 +0000 |
commit | 812e2a8bf64274e47db572b8ca592f49b1263ad7 (patch) | |
tree | 404f9a7432e94c42a09bb76b33eb7d38186ccff6 /svtools/source/control/valueacc.cxx | |
parent | 9818d8d1c64bd93adfaacb8a2f824a9db1f4987d (diff) |
resync to trunk (after accessibility integration)
Diffstat (limited to 'svtools/source/control/valueacc.cxx')
-rw-r--r-- | svtools/source/control/valueacc.cxx | 60 |
1 files changed, 57 insertions, 3 deletions
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index d60b94d49143..e70841b22442 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -34,6 +34,15 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> +//IAccessibility2 Implementation 2009----- +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_ +#include <com/sun/star/accessibility/AccessibleRelationType.hpp> +#endif +#ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_ +#include <unotools/accessiblerelationsethelper.hxx> +#endif +//-----IAccessibility2 Implementation 2009 using namespace ::com::sun::star; // ---------------- @@ -316,6 +325,9 @@ sal_Int16 SAL_CALL ValueSetAcc::getAccessibleRole() Window* pLabel = mpParent->GetAccessibleRelationLabeledBy(); if ( pLabel && pLabel != mpParent ) aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() ); + + if ( !aRet.Len() ) + aRet = mpParent->GetQuickHelpText(); } return aRet; @@ -327,7 +339,32 @@ uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueSetAcc::ge throw (uno::RuntimeException) { ThrowIfDisposed(); - return uno::Reference< accessibility::XAccessibleRelationSet >(); +//IAccessibility2 Implementation 2009----- + uno::Reference< accessibility::XAccessibleRelationSet > xRelSet; + Window* pWindow = (Window*)mpParent; + if ( pWindow ) + { + utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper; + xRelSet = pRelationSet; + + Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy(); + if ( pLabeledBy && pLabeledBy != pWindow ) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = pLabeledBy->GetAccessible(); + pRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) ); + } + + Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf(); + if ( pMemberOf && pMemberOf != pWindow ) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = pMemberOf->GetAccessible(); + pRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) ); + } + } + return xRelSet; +//-----IAccessibility2 Implementation 2009 } // ----------------------------------------------------------------------------- @@ -755,7 +792,10 @@ ValueSetItem* ValueSetAcc::getItem (sal_uInt16 nIndex) const nIndex -= 1; } if (pItem == NULL) - pItem = mpParent->ImplGetVisibleItem (static_cast<sal_uInt16>(nIndex)); +//IAccessibility2 Implementation 2009----- + //pItem = mpParent->ImplGetVisibleItem (static_cast<sal_uInt16>(nIndex)); + pItem = mpParent->ImplGetItem (static_cast<sal_uInt16>(nIndex)); +//-----IAccessibility2 Implementation 2009 return pItem; } @@ -939,7 +979,10 @@ sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent() // just in case the number of children changes in the mean time. try { - pItem = mpParent->mrParent.ImplGetVisibleItem (i); +//IAccessibility2 Implementation 2009----- + //pItem = mpParent->mrParent.ImplGetVisibleItem (i); + pItem = mpParent->mrParent.ImplGetItem(i); +//-----IAccessibility2 Implementation 2009 } catch (lang::IndexOutOfBoundsException aException) { @@ -956,6 +999,17 @@ sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent() } } +//IAccessibility2 Implementation 2009----- + //if this valueset contain a none field(common value is default), then we should increase the real index and set the noitem index value equal 0. + if ( mpParent && ( (mpParent->mrParent.GetStyle() & WB_NONEFIELD) != 0 ) ) + { + ValueSetItem* pFirstItem = mpParent->mrParent.ImplGetItem (VALUESET_ITEM_NONEITEM); + if( pFirstItem && pFirstItem ->GetAccessible(mbIsTransientChildrenDisabled).get() == this ) + nIndexInParent = 0; + else + nIndexInParent++; + } +//-----IAccessibility2 Implementation 2009 return nIndexInParent; } |