summaryrefslogtreecommitdiff
path: root/accessibility/source
diff options
context:
space:
mode:
authorSteve Yin <steve_y@apache.org>2013-11-14 08:18:05 +0000
committerSteve Yin <steve_y@apache.org>2013-11-14 08:18:05 +0000
commita5c4ddcf8ed5344d9bceeffd7431cd6895a407ca (patch)
tree7e830be2c7fae1c81a868f196aa940696efeeb37 /accessibility/source
parenta2afc19e04f8bb3089cbfef34960ad8f0a3b99bf (diff)
Integrate branch of IAccessible2
Notes
Diffstat (limited to 'accessibility/source')
-rw-r--r--accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx2
-rw-r--r--accessibility/source/extended/accessibleeditbrowseboxcell.cxx14
-rw-r--r--accessibility/source/extended/accessibleiconchoicectrl.cxx31
-rw-r--r--accessibility/source/extended/accessibleiconchoicectrlentry.cxx3
-rw-r--r--accessibility/source/extended/accessiblelistbox.cxx265
-rw-r--r--accessibility/source/extended/accessiblelistboxentry.cxx365
-rw-r--r--accessibility/source/extended/accessibletablistboxtable.cxx60
-rw-r--r--accessibility/source/extended/textwindowaccessibility.cxx410
-rw-r--r--accessibility/source/helper/accessiblestrings.src51
-rw-r--r--accessibility/source/helper/characterattributeshelper.cxx5
-rw-r--r--accessibility/source/standard/accessiblemenubasecomponent.cxx15
-rw-r--r--accessibility/source/standard/accessiblemenuitemcomponent.cxx39
-rw-r--r--accessibility/source/standard/vclxaccessiblebox.cxx234
-rw-r--r--accessibility/source/standard/vclxaccessiblebutton.cxx17
-rw-r--r--accessibility/source/standard/vclxaccessiblecheckbox.cxx8
-rw-r--r--accessibility/source/standard/vclxaccessiblelist.cxx347
-rw-r--r--accessibility/source/standard/vclxaccessiblelistitem.cxx12
-rw-r--r--accessibility/source/standard/vclxaccessiblemenu.cxx11
-rw-r--r--accessibility/source/standard/vclxaccessiblemenuitem.cxx20
-rw-r--r--accessibility/source/standard/vclxaccessibleradiobutton.cxx3
-rw-r--r--accessibility/source/standard/vclxaccessiblescrollbar.cxx21
-rw-r--r--accessibility/source/standard/vclxaccessibletabcontrol.cxx3
-rw-r--r--accessibility/source/standard/vclxaccessibletextcomponent.cxx52
-rw-r--r--accessibility/source/standard/vclxaccessibletoolbox.cxx34
-rw-r--r--accessibility/source/standard/vclxaccessibletoolboxitem.cxx38
25 files changed, 1919 insertions, 141 deletions
diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
index d2ee9547b99b..64c9be328a18 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
@@ -65,7 +65,7 @@ AccessibleBrowseBoxHeaderCell::AccessibleBrowseBoxHeaderCell(sal_Int32 _nColumnR
// SHOWING done with mxParent
if( implIsShowing() )
pStateSetHelper->AddState( AccessibleStateType::SHOWING );
-
+ mpBrowseBox->FillAccessibleStateSet( *pStateSetHelper, getType() );
BBSolarGuard aSolarGuard;
pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
diff --git a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
index 474078badcfa..1d72d51dbef0 100644
--- a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
+++ b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
@@ -130,13 +130,15 @@ namespace accessibility
SolarMethodGuard aGuard( *this );
// TODO: localize this!
- String sName = mpBrowseBox->GetColumnDescription( ::sal::static_int_cast< sal_uInt16 >( getColumnPos() ) );
- if ( 0 == sName.Len() )
- {
- sName = String::CreateFromAscii( "Column " );
- sName += String::CreateFromInt32( getColumnPos( ) );
- }
+// IAccessible2 implementation, 2009
+ //String sName = mpBrowseBox->GetColumnDescription( getColumnPos( ) );
+ //if ( 0 == sName.Len() )
+ //{
+ // sName = String::CreateFromAscii( "Column " );
+ String sName = String::CreateFromAscii( "Column " );
+ sName += String::CreateFromInt32( getColumnPos( ) - 1 );
+ //}
sName += String::CreateFromAscii( ", Row " );
sName += String::CreateFromInt32( getRowPos( ) );
diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx
index 014413cf2234..2598c92db75f 100644
--- a/accessibility/source/extended/accessibleiconchoicectrl.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrl.cxx
@@ -79,11 +79,36 @@ namespace accessibility
// modified selection. The active descendant event is
// send after that so that the receiving AT has time to
// read the text or name of the active child.
- NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+// NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+
+ if ( getCtrl() && getCtrl()->HasFocus() )
+ {
+ SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() );
+ if ( pEntry )
+ {
+ sal_uLong nPos = getCtrl()->GetEntryListPos( pEntry );
+ Reference< XAccessible > xChild = new AccessibleIconChoiceCtrlEntry( *getCtrl(), nPos, this );
+ uno::Any aOldValue, aNewValue;
+ aNewValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
+
+ NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOldValue, aNewValue );
+
+ }
+ }
+ break;
+ }
+ case VCLEVENT_WINDOW_GETFOCUS :
+ {
SvtIconChoiceCtrl* pCtrl = getCtrl();
if ( pCtrl && pCtrl->HasFocus() )
{
SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() );
+ if ( pEntry == NULL )
+ {
+ sal_uLong nPos=0;
+ pEntry = getCtrl()->GetSelectedEntry ( nPos );
+ }
if ( pEntry )
{
sal_uLong nPos = pCtrl->GetEntryListPos( pEntry );
@@ -91,6 +116,7 @@ namespace accessibility
uno::Any aOldValue, aNewValue;
aNewValue <<= xChild;
NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
+ NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOldValue, aNewValue );
}
}
break;
@@ -190,7 +216,8 @@ namespace accessibility
// -----------------------------------------------------------------------------
sal_Int16 SAL_CALL AccessibleIconChoiceCtrl::getAccessibleRole( ) throw (RuntimeException)
{
- return AccessibleRole::TREE;
+ //return AccessibleRole::TREE;
+ return AccessibleRole::LIST;
}
// -----------------------------------------------------------------------------
::rtl::OUString SAL_CALL AccessibleIconChoiceCtrl::getAccessibleDescription( ) throw (RuntimeException)
diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
index 3703efadc442..d756bcf8aeab 100644
--- a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
@@ -351,7 +351,8 @@ throw(RuntimeException)
// -----------------------------------------------------------------------------
sal_Int16 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRole( ) throw (RuntimeException)
{
- return AccessibleRole::LABEL;
+ //return AccessibleRole::LABEL;
+ return AccessibleRole::LIST_ITEM;
}
// -----------------------------------------------------------------------------
::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleDescription( ) throw (RuntimeException)
diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx
index 42ac4d06e109..159b76e4c086 100644
--- a/accessibility/source/extended/accessiblelistbox.cxx
+++ b/accessibility/source/extended/accessiblelistbox.cxx
@@ -89,19 +89,25 @@ namespace accessibility
{
case VCLEVENT_CHECKBOX_TOGGLE :
{
- if ( getListBox() && getListBox()->HasFocus() )
+ if ( !getListBox() || !getListBox()->HasFocus() )
{
- SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() );
- if ( !pEntry )
- pEntry = getListBox()->GetCurEntry();
+ return;
+ }
+ AccessibleListBoxEntry* pCurOpEntry = GetCurEventEntry(rVclWindowEvent);
+ if(!pCurOpEntry)
+ {
+ return ;
+ }
+ uno::Any aValue;
+ aValue <<= AccessibleStateType::CHECKED;
- if ( pEntry )
- {
- Reference< XAccessible > xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
- uno::Any aOldValue, aNewValue;
- aNewValue <<= xChild;
- NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
- }
+ if ( getListBox()->GetCheckButtonState( pCurOpEntry->GetSvLBoxEntry() ) == SV_BUTTON_CHECKED )
+ {
+ pCurOpEntry->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, uno::Any(), aValue );
+ }
+ else
+ {
+ pCurOpEntry->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aValue,uno::Any() );
}
break;
}
@@ -112,17 +118,104 @@ namespace accessibility
// modified selection. The active descendant event is
// send after that so that the receiving AT has time to
// read the text or name of the active child.
- NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
- if ( getListBox() && getListBox()->HasFocus() )
+// NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+ OSL_ASSERT(0 && "Debug: Treelist shouldn't use VCLEVENT_LISTBOX_SELECT");
+ }
+ case VCLEVENT_LISTBOX_TREESELECT:
+ {
+ if ( getListBox() && getListBox()->HasFocus() )
+ {
+ AccessibleListBoxEntry* pEntry =static_cast< AccessibleListBoxEntry* >(m_xFocusedChild.get());
+ if (pEntry)
+ {
+ pEntry->NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+ }
+ }
+ }
+ break;
+ case VCLEVENT_LISTBOX_TREEFOCUS:
+ {
+ SvTreeListBox* pBox = getListBox();
+ sal_Bool bNeedFocus = sal_False;
+ if (pBox)
+ {
+ Window* pParent = ((Window*)pBox)->GetParent();
+ if (pParent && pParent->GetType() == WINDOW_FLOATINGWINDOW)
+ {
+ // MT: ImplGetAppSVData shouldn't be exported from VCL.
+ // In which scenario is this needed?
+ // If needed, we need to find an other solution
+ /*
+ ImplSVData* pSVData = ImplGetAppSVData();
+ if (pSVData && pSVData->maWinData.mpFirstFloat == (FloatingWindow*)pParent)
+ bNeedFocus = sal_True;
+ */
+ }
+ }
+ if( pBox && (pBox->HasFocus() || bNeedFocus) )
+ {
+ uno::Any aOldValue, aNewValue;
+ SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() );
+ if ( pEntry )
+ {
+ AccessibleListBoxEntry* pEntryFocus =static_cast< AccessibleListBoxEntry* >(m_xFocusedChild.get());
+ if (pEntryFocus && pEntryFocus->GetSvLBoxEntry() == pEntry)
+ {
+ aOldValue <<= uno::Any();
+ aNewValue <<= m_xFocusedChild;
+ NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
+ return ;
+ }
+
+ aOldValue <<= m_xFocusedChild;
+
+ MAP_ENTRY::iterator mi = m_mapEntry.find(pEntry);
+ if(mi != m_mapEntry.end())
+ {
+ OSL_ASSERT(mi->second.get() != NULL);
+ m_xFocusedChild = mi->second;
+ }
+ else
+ {
+ AccessibleListBoxEntry *pEntNew = new AccessibleListBoxEntry( *getListBox(), pEntry, NULL );
+ m_xFocusedChild = pEntNew;
+ m_mapEntry.insert(MAP_ENTRY::value_type(pEntry,pEntNew));
+ }
+
+ aNewValue <<= m_xFocusedChild;
+ NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
+ }
+ else
+ {
+ aOldValue <<= uno::Any();
+ aNewValue <<= AccessibleStateType::FOCUSED;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ }
+ }
+ break;
+ case VCLEVENT_LISTBOX_ITEMREMOVED:
{
SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() );
if ( pEntry )
{
- Reference< XAccessible > xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
- uno::Any aOldValue, aNewValue;
- aNewValue <<= xChild;
- NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
+ RemoveChildEntries(pEntry);
+ }
+ else
+ {
+ // NULL means Clear()
+ MAP_ENTRY::iterator mi = m_mapEntry.begin();
+ for ( ; mi != m_mapEntry.end() ; ++mi)
+ {
+ uno::Any aNewValue;
+ uno::Any aOldValue;
+ aOldValue <<= mi->second;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
+ }
+ m_mapEntry.clear();
}
+
+
}
break;
@@ -148,15 +241,72 @@ namespace accessibility
NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), aListBoxEntry );
}
}
- break;
}
+ break;
// <--
- }
default:
VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
}
}
}
+
+ AccessibleListBoxEntry* AccessibleListBox::GetCurEventEntry( const VclWindowEvent& rVclWindowEvent )
+ {
+ SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() );
+ if ( !pEntry )
+ pEntry = getListBox()->GetCurEntry();
+
+ AccessibleListBoxEntry* pEntryFocus =static_cast< AccessibleListBoxEntry* >(m_xFocusedChild.get());
+ if (pEntryFocus && pEntry && pEntry != pEntryFocus->GetSvLBoxEntry())
+ {
+ AccessibleListBoxEntry *pAccCurOptionEntry =NULL;
+ MAP_ENTRY::iterator mi = m_mapEntry.find(pEntry);
+ if (mi != m_mapEntry.end())
+ {
+ pAccCurOptionEntry= static_cast< AccessibleListBoxEntry* >(mi->second.get());
+ }
+ else
+ {
+ pAccCurOptionEntry =new AccessibleListBoxEntry( *getListBox(), pEntry, NULL );
+ std::pair<MAP_ENTRY::iterator, bool> pairMi = m_mapEntry.insert(MAP_ENTRY::value_type(pAccCurOptionEntry->GetSvLBoxEntry(),pAccCurOptionEntry));
+ mi = pairMi.first;
+ }
+
+ uno::Any aNewValue;
+ aNewValue <<= mi->second;//xAcc
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, uno::Any(), aNewValue );//Add
+
+ return pAccCurOptionEntry;
+ }
+ else
+ {
+ return pEntryFocus;
+ }
+ return NULL;
+ }
+
+ void AccessibleListBox::RemoveChildEntries(SvLBoxEntry* pEntry)
+ {
+ MAP_ENTRY::iterator mi = m_mapEntry.find(pEntry);
+ if ( mi != m_mapEntry.end() )
+ {
+ uno::Any aNewValue;
+ uno::Any aOldValue;
+ aOldValue <<= mi->second;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
+
+ m_mapEntry.erase(mi);
+ }
+
+ SvTreeListBox* pBox = getListBox();
+ SvLBoxEntry* pEntryChild = pBox->FirstChild(pEntry);
+ while (pEntryChild)
+ {
+ RemoveChildEntries(pEntryChild);
+ pEntryChild = pBox->NextSibling(pEntryChild);
+ }
+ }
+
// -----------------------------------------------------------------------------
void AccessibleListBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent )
{
@@ -182,6 +332,7 @@ namespace accessibility
{
::osl::MutexGuard aGuard( m_aMutex );
+ m_mapEntry.clear();
VCLXAccessibleComponent::disposing();
m_xParent = NULL;
}
@@ -258,7 +409,9 @@ namespace accessibility
if ( !pEntry )
throw IndexOutOfBoundsException();
- return new AccessibleListBoxEntry( *getListBox(), pEntry, this );
+ // Solution: Set the parameter of the parent to null to let entry determine the parent by itself
+ //return new AccessibleListBoxEntry( *getListBox(), pEntry, this );
+ return new AccessibleListBoxEntry( *getListBox(), pEntry, NULL );
}
// -----------------------------------------------------------------------------
Reference< XAccessible > SAL_CALL AccessibleListBox::getAccessibleParent( ) throw (RuntimeException)
@@ -269,9 +422,54 @@ namespace accessibility
return m_xParent;
}
// -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleListBox::getRoleType()
+ {
+ sal_Int32 nCase = 0;
+ SvLBoxEntry* pEntry = getListBox()->GetEntry(0);
+ if ( pEntry )
+ {
+ if( pEntry->HasChildsOnDemand() || getListBox()->GetChildCount(pEntry) > 0 )
+ {
+ nCase = 1;
+ return nCase;
+ }
+ }
+
+ sal_Bool bHasButtons = (getListBox()->GetStyle() & WB_HASBUTTONS)!=0;
+ if( !(getListBox()->GetTreeFlags() & TREEFLAG_CHKBTN) )
+ {
+ if( bHasButtons )
+ nCase = 1;
+ }
+ else
+ {
+ if( bHasButtons )
+ nCase = 2;
+ else
+ nCase = 3;
+ }
+ return nCase;
+ }
sal_Int16 SAL_CALL AccessibleListBox::getAccessibleRole( ) throw (RuntimeException)
{
- return AccessibleRole::TREE;
+ if(getListBox())
+ {
+ short nType = getListBox()->GetAllEntriesAccessibleRoleType();
+ if( nType == TREEBOX_ALLITEM_ACCROLE_TYPE_TREE)
+ return AccessibleRole::TREE;
+ else if( nType == TREEBOX_ALLITEM_ACCROLE_TYPE_LIST)
+ return AccessibleRole::LIST;
+ }
+
+ //o is: return AccessibleRole::TREE;
+ sal_Bool bHasButtons = (getListBox()->GetStyle() & WB_HASBUTTONS)!=0;
+ if(!bHasButtons && (getListBox()->GetTreeFlags() & TREEFLAG_CHKBTN))
+ return AccessibleRole::LIST;
+ else
+ if(getRoleType() == 0)
+ return AccessibleRole::LIST;
+ else
+ return AccessibleRole::TREE;
}
// -----------------------------------------------------------------------------
::rtl::OUString SAL_CALL AccessibleListBox::getAccessibleDescription( ) throw (RuntimeException)
@@ -356,16 +554,19 @@ namespace accessibility
ensureAlive();
- sal_Int32 i, nSelCount = 0, nCount = 0;
- nCount = getListBox()->GetLevelChildCount( NULL );
- for ( i = 0; i < nCount; ++i )
- {
- SvLBoxEntry* pEntry = getListBox()->GetEntry( i );
- if ( getListBox()->IsSelected( pEntry ) )
- ++nSelCount;
- }
- return nSelCount;
+// sal_Int32 i, nSelCount = 0, nCount = 0;
+// nCount = getListBox()->GetLevelChildCount( NULL );
+// for ( i = 0; i < nCount; ++i )
+// {
+// SvLBoxEntry* pEntry = getListBox()->GetEntry( i );
+// if ( getListBox()->IsSelected( pEntry ) )
+// ++nSelCount;
+// }
+// return nSelCount;
+
+ int nTestCount = getListBox()->GetSelectionCount();
+ return nTestCount;
}
// -----------------------------------------------------------------------------
Reference< XAccessible > SAL_CALL AccessibleListBox::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
@@ -388,7 +589,9 @@ namespace accessibility
if ( nSelCount == ( nSelectedChildIndex + 1 ) )
{
- xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
+ // Solution: Set the parameter of the parent to null to let entry determine the parent by itself
+ //xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
+ xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, NULL );
break;
}
}
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx
index d29ef1afd200..84d69615fb87 100644
--- a/accessibility/source/extended/accessiblelistboxentry.cxx
+++ b/accessibility/source/extended/accessiblelistboxentry.cxx
@@ -25,6 +25,7 @@
#include "precompiled_accessibility.hxx"
#include "accessibility/extended/accessiblelistboxentry.hxx"
#include <svtools/svtreebx.hxx>
+#include <accessibility/helper/accresmgr.hxx>
#include <svtools/stringtransfer.hxx>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Rectangle.hpp>
@@ -44,7 +45,10 @@
#include <comphelper/sequence.hxx>
#include <comphelper/accessibleeventnotifier.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-
+#include <accessibility/helper/accessiblestrings.hrc>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEVALUE_HPP_
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#endif
#define ACCESSIBLE_ACTION_COUNT 1
namespace
@@ -76,7 +80,7 @@ namespace accessibility
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star;
-
+ using namespace ::comphelper;
DBG_NAME(AccessibleListBoxEntry)
// -----------------------------------------------------------------------------
@@ -89,6 +93,7 @@ namespace accessibility
AccessibleListBoxEntry_BASE ( m_aMutex ),
ListBoxAccessibleBase( _rListBox ),
+ m_pSvLBoxEntry ( _pEntry ),
m_nClientId ( 0 ),
m_aParent ( _xParent )
@@ -110,6 +115,19 @@ namespace accessibility
}
}
+ // IA2 CWS
+ void AccessibleListBoxEntry::NotifyAccessibleEvent( sal_Int16 _nEventId,
+ const ::com::sun::star::uno::Any& _aOldValue,
+ const ::com::sun::star::uno::Any& _aNewValue )
+ {
+ Reference< uno::XInterface > xSource( *this );
+ AccessibleEventObject aEventObj( xSource, _nEventId, _aNewValue, _aOldValue );
+
+ if (m_nClientId)
+ comphelper::AccessibleEventNotifier::addEvent( m_nClientId, aEventObj );
+ }
+
+
// -----------------------------------------------------------------------------
Rectangle AccessibleListBoxEntry::GetBoundingBox_Impl() const
{
@@ -196,8 +214,10 @@ namespace accessibility
{
::rtl::OUString sRet;
SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ //IAccessibility2 Implementation 2009-----
if ( pEntry )
- sRet = getListBox()->SearchEntryText( pEntry );
+ sRet = getListBox()->SearchEntryTextWithHeadTitle( pEntry );
+ //-----IAccessibility2 Implementation 2009
return sRet;
}
// -----------------------------------------------------------------------------
@@ -337,8 +357,9 @@ namespace accessibility
::osl::MutexGuard aGuard( m_aMutex );
EnsureIsAlive();
- SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
- SvLBoxEntry* pEntry = pParent ? getListBox()->GetEntry( pParent, i ) : NULL;
+// SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
+// SvLBoxEntry* pEntry = pParent ? getListBox()->GetEntry( pParent, i ) : NULL;
+ SvLBoxEntry* pEntry =GetRealChild(i);
if ( !pEntry )
throw IndexOutOfBoundsException();
@@ -369,6 +390,10 @@ namespace accessibility
SvLBoxEntry* pParentEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
DBG_ASSERT( pParentEntry, "AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!" );
+ //IAccessibility2 Implementation 2009-----
+ if ( pParentEntry )
+ pParentEntry = getListBox()->GetParent(pParentEntry);
+ //-----IAccessibility2 Implementation 2009
if ( pParentEntry )
xParent = new AccessibleListBoxEntry( *getListBox(), pParentEntry, NULL );
// note that we pass NULL here as parent-accessible:
@@ -398,15 +423,104 @@ namespace accessibility
return m_aEntryPath.empty() ? -1 : m_aEntryPath.back();
}
// -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleListBoxEntry::getRoleType()
+ {
+ sal_Int32 nCase = 0;
+ SvLBoxEntry* pEntry = getListBox()->GetEntry(0);
+ if ( pEntry )
+ {
+ if( pEntry->HasChildsOnDemand() || getListBox()->GetChildCount(pEntry) > 0 )
+ {
+ nCase = 1;
+ return nCase;
+ }
+ }
+
+ sal_Bool bHasButtons = (getListBox()->GetStyle() & WB_HASBUTTONS)!=0;
+ if( !(getListBox()->GetTreeFlags() & TREEFLAG_CHKBTN) )
+ {
+ if( bHasButtons )
+ nCase = 1;
+ }
+ else
+ {
+ if( bHasButtons )
+ nCase = 2;
+ else
+ nCase = 3;
+ }
+ return nCase;
+ }
sal_Int16 SAL_CALL AccessibleListBoxEntry::getAccessibleRole( ) throw (RuntimeException)
{
- return AccessibleRole::LABEL;
+ SvTreeListBox* pBox = getListBox();
+ if(pBox)
+ {
+ short nType = pBox->GetAllEntriesAccessibleRoleType();
+ if( nType == TREEBOX_ALLITEM_ACCROLE_TYPE_TREE)
+ return AccessibleRole::TREE_ITEM;
+ else if( nType == TREEBOX_ALLITEM_ACCROLE_TYPE_LIST)
+ return AccessibleRole::LIST_ITEM;
+ }
+
+ sal_uInt16 treeFlag = pBox->GetTreeFlags();
+ if(treeFlag & TREEFLAG_CHKBTN )
+ {
+ SvLBoxEntry* pEntry = pBox->GetEntryFromPath( m_aEntryPath );
+ SvButtonState eState = pBox->GetCheckButtonState( pEntry );
+ switch( eState )
+ {
+ case SV_BUTTON_CHECKED:
+ case SV_BUTTON_UNCHECKED:
+ return AccessibleRole::CHECK_BOX;
+ case SV_BUTTON_TRISTATE:
+ default:
+ return AccessibleRole::LABEL;
+ }
+ }
+ else
+ {
+
+ if(getRoleType() == 0)
+ return AccessibleRole::LIST_ITEM;
+ else
+ //o is: return AccessibleRole::LABEL;
+ return AccessibleRole::TREE_ITEM;
+ }
}
// -----------------------------------------------------------------------------
::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription( ) throw (RuntimeException)
{
// no description for every item
- return ::rtl::OUString();
+ SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if( getAccessibleRole() == AccessibleRole::TREE_ITEM )
+ {
+ return getListBox()->GetEntryLongDescription( pEntry );
+ }
+ //want to cout the real column nubmer in the list box.
+ sal_uInt16 iRealItemCount = 0;
+ sal_uInt16 iCount = 0;
+ sal_uInt16 iTotleItemCount = pEntry->ItemCount();
+ SvLBoxItem* pItem;
+ while( iCount < iTotleItemCount )
+ {
+ pItem = pEntry->GetItem( iCount );
+ if ( pItem->IsA() == SV_ITEM_ID_LBOXSTRING &&
+ static_cast<SvLBoxString*>( pItem )->GetText().Len() > 0 )
+ {
+ iRealItemCount++;
+ }
+ iCount++;
+ }
+ if(iRealItemCount<=1 )
+ {
+ return ::rtl::OUString();
+ }
+ else
+ {
+ return getListBox()->SearchEntryTextWithHeadTitle( pEntry );
+ }
+
}
// -----------------------------------------------------------------------------
::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleName( ) throw (RuntimeException)
@@ -414,7 +528,24 @@ namespace accessibility
::osl::MutexGuard aGuard( m_aMutex );
EnsureIsAlive();
- return implGetText();
+
+ ::rtl::OUString sRet;
+ sRet = implGetText();
+
+ SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+
+ String altText = getListBox()->GetEntryAltText( pEntry );
+ if( altText.Len() > 0 )
+ {
+ sRet += ::rtl::OUString(' ');
+ sRet += altText;
+ }
+
+ // IA2 CWS. Removed for now - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this
+ // if ( pEntry && pEntry->IsMarked())
+ // sRet = sRet + ::rtl::OUString(TK_RES_STRING(STR_SVT_ACC_LISTENTRY_SELCTED_STATE));
+
+ return sRet;
}
// -----------------------------------------------------------------------------
Reference< XAccessibleRelationSet > SAL_CALL AccessibleListBoxEntry::getAccessibleRelationSet( ) throw (RuntimeException)
@@ -444,14 +575,25 @@ namespace accessibility
if ( IsAlive_Impl() )
{
- pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
- pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
- pStateSetHelper->AddState( AccessibleStateType::ENABLED );
- pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
- if ( getListBox()->IsInplaceEditingEnabled() )
- pStateSetHelper->AddState( AccessibleStateType::EDITABLE );
- if ( IsShowing_Impl() )
- pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ switch(getAccessibleRole())
+ {
+ case AccessibleRole::LABEL:
+ pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
+ pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+ pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ if ( getListBox()->IsInplaceEditingEnabled() )
+ pStateSetHelper->AddState( AccessibleStateType::EDITABLE );
+ if ( IsShowing_Impl() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ break;
+ case AccessibleRole::CHECK_BOX:
+ pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
+ pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+ pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ if ( IsShowing_Impl() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ break;
+ }
getListBox()->FillAccessibleEntryStateSet(
getListBox()->GetEntryFromPath( m_aEntryPath ), *pStateSetHelper );
}
@@ -586,6 +728,7 @@ namespace accessibility
ALBSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
EnsureIsAlive();
+ if(aPoint.X==0 && aPoint.Y==0) return 0;
sal_Int32 nIndex = -1;
SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
@@ -660,7 +803,20 @@ namespace accessibility
::osl::MutexGuard aGuard( m_aMutex );
// three actions supported
- return ACCESSIBLE_ACTION_COUNT;
+ SvTreeListBox* pBox = getListBox();
+ sal_uInt16 treeFlag = pBox->GetTreeFlags();
+ sal_Bool bHasButtons = (getListBox()->GetStyle() & WB_HASBUTTONS)!=0;
+ if( (treeFlag & TREEFLAG_CHKBTN) && !bHasButtons)
+ {
+ sal_Int16 role = getAccessibleRole();
+ if ( role == AccessibleRole::CHECK_BOX )
+ return 2;
+ else if ( role == AccessibleRole::LABEL )
+ return 0;
+ }
+ else
+ return ACCESSIBLE_ACTION_COUNT;
+ return 0;
}
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL AccessibleListBoxEntry::doAccessibleAction( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
@@ -671,17 +827,30 @@ namespace accessibility
sal_Bool bRet = sal_False;
checkActionIndex_Impl( nIndex );
EnsureIsAlive();
-
- SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
- if ( pEntry )
+ sal_uInt16 treeFlag = getListBox()->GetTreeFlags();
+ if( nIndex == 0 && (treeFlag & TREEFLAG_CHKBTN) )
{
- if ( getListBox()->IsExpanded( pEntry ) )
- getListBox()->Collapse( pEntry );
- else
- getListBox()->Expand( pEntry );
- bRet = sal_True;
+ if(getAccessibleRole() == AccessibleRole::CHECK_BOX)
+ {
+ SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ SvButtonState state = getListBox()->GetCheckButtonState( pEntry );
+ if ( state == SV_BUTTON_CHECKED )
+ getListBox()->SetCheckButtonState(pEntry, (SvButtonState)SV_BMP_UNCHECKED);
+ else if (state == SV_BMP_UNCHECKED)
+ getListBox()->SetCheckButtonState(pEntry, (SvButtonState)SV_BUTTON_CHECKED);
+ }
+ }else if( (nIndex == 1 && (treeFlag & TREEFLAG_CHKBTN) ) || (nIndex == 0) )
+ {
+ SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if ( pEntry )
+ {
+ if ( getListBox()->IsExpanded( pEntry ) )
+ getListBox()->Collapse( pEntry );
+ else
+ getListBox()->Expand( pEntry );
+ bRet = sal_True;
+ }
}
-
return bRet;
}
// -----------------------------------------------------------------------------
@@ -694,7 +863,38 @@ namespace accessibility
EnsureIsAlive();
static const ::rtl::OUString sActionDesc( RTL_CONSTASCII_USTRINGPARAM( "toggleExpand" ) );
- return sActionDesc;
+ static const ::rtl::OUString sActionDesc1( RTL_CONSTASCII_USTRINGPARAM( "Check" ) );
+ static const ::rtl::OUString sActionDesc2( RTL_CONSTASCII_USTRINGPARAM( "UnCheck" ) );
+ // sal_Bool bHasButtons = (getListBox()->GetStyle() & WB_HASBUTTONS)!=0;
+ SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ SvButtonState state = getListBox()->GetCheckButtonState( pEntry );
+ sal_uInt16 treeFlag = getListBox()->GetTreeFlags();
+ if(nIndex == 0 && (treeFlag & TREEFLAG_CHKBTN))
+ {
+ if(getAccessibleRole() == AccessibleRole::CHECK_BOX)
+ {
+ if ( state == SV_BUTTON_CHECKED )
+ return sActionDesc2;
+ else if (state == SV_BMP_UNCHECKED)
+ return sActionDesc1;
+ }
+ else
+ {
+ //Sometimes, a List or Tree may have both checkbox and label at the same time
+ return ::rtl::OUString();
+ }
+ }else if( (nIndex == 1 && (treeFlag & TREEFLAG_CHKBTN)) || nIndex == 0 )
+ {
+ //IAccessibility2 Implementation 2009-----
+ if( pEntry->HasChilds() || pEntry->HasChildsOnDemand() )
+ //-----IAccessibility2 Implementation 2009
+ return getListBox()->IsExpanded( pEntry ) ? \
+ ::rtl::OUString(TK_RES_STRING(STR_SVT_ACC_ACTION_COLLAPSE)) :
+ ::rtl::OUString(TK_RES_STRING(STR_SVT_ACC_ACTION_EXPAND));
+ return ::rtl::OUString();
+
+ }
+ throw IndexOutOfBoundsException();
}
// -----------------------------------------------------------------------------
Reference< XAccessibleKeyBinding > AccessibleListBoxEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
@@ -715,9 +915,11 @@ namespace accessibility
::osl::MutexGuard aGuard( m_aMutex );
EnsureIsAlive();
+// IAccessible2 implementation, 2009
+// SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
+// SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, nChildIndex );
- SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
- SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, nChildIndex );
+ SvLBoxEntry* pEntry =GetRealChild(nChildIndex);
if ( !pEntry )
throw IndexOutOfBoundsException();
@@ -960,6 +1162,111 @@ namespace accessibility
return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType);
}
+ // -----------------------------------------------------------------------------
+ // XAccessibleValue
+ // -----------------------------------------------------------------------------
+
+ Any AccessibleListBoxEntry::getCurrentValue( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ Any aValue;
+ sal_Int32 level = ((sal_Int32) m_aEntryPath.size() - 1);
+ level = level < 0 ? 0: level;
+ aValue <<= level;
+ return aValue;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Bool AccessibleListBoxEntry::setCurrentValue( const Any& aNumber ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+
+ sal_Bool bReturn = sal_False;
+ SvTreeListBox* pBox = getListBox();
+ if(getAccessibleRole() == AccessibleRole::CHECK_BOX)
+ {
+ SvLBoxEntry* pEntry = pBox->GetEntryFromPath( m_aEntryPath );
+ if ( pEntry )
+ {
+ sal_Int32 nValue, nValueMin, nValueMax;
+ aNumber >>= nValue;
+ getMinimumValue() >>= nValueMin;
+ getMaximumValue() >>= nValueMax;
+
+ if ( nValue < nValueMin )
+ nValue = nValueMin;
+ else if ( nValue > nValueMax )
+ nValue = nValueMax;
+
+ pBox->SetCheckButtonState(pEntry, (SvButtonState) nValue );
+ bReturn = sal_True;
+ }
+ }
+
+ return bReturn;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Any AccessibleListBoxEntry::getMaximumValue( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Any aValue;
+ // SvTreeListBox* pBox = getListBox();
+ switch(getAccessibleRole())
+ {
+ case AccessibleRole::CHECK_BOX:
+ aValue <<= (sal_Int32)1;
+ break;
+ case AccessibleRole::LABEL:
+ default:
+ break;
+ }
+
+ return aValue;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Any AccessibleListBoxEntry::getMinimumValue( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Any aValue;
+ // SvTreeListBox* pBox = getListBox();
+ switch(getAccessibleRole())
+ {
+ case AccessibleRole::CHECK_BOX:
+ aValue <<= (sal_Int32)0;
+ break;
+ case AccessibleRole::LABEL:
+ default:
+ break;
+ }
+
+ return aValue;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ SvLBoxEntry * AccessibleListBoxEntry::GetRealChild(sal_Int32 nIndex)
+ {
+ SvLBoxEntry* pEntry =NULL;
+ SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if (pParent)
+ {
+ pEntry = getListBox()->GetEntry( pParent, nIndex );
+ if ( !pEntry && getAccessibleChildCount() > 0 )
+ {
+ getListBox()->RequestingChilds(pParent);
+ pEntry = getListBox()->GetEntry( pParent, nIndex );
+ }
+ }
+ return pEntry;
+ }
//........................................................................
}// namespace accessibility
//........................................................................
diff --git a/accessibility/source/extended/accessibletablistboxtable.cxx b/accessibility/source/extended/accessibletablistboxtable.cxx
index d72d239e60b2..4654a8e24018 100644
--- a/accessibility/source/extended/accessibletablistboxtable.cxx
+++ b/accessibility/source/extended/accessibletablistboxtable.cxx
@@ -32,6 +32,9 @@
#include <svtools/svtabbx.hxx>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#ifndef _SVTOOLS_ACCESSIBILEBROWSEBOXTABLECELL_HXX
+#include "accessibility/extended/AccessibleBrowseBoxTableCell.hxx"
+#endif
//........................................................................
namespace accessibility
{
@@ -154,6 +157,63 @@ namespace accessibility
}
break;
}
+ case VCLEVENT_WINDOW_GETFOCUS :
+ {
+ uno::Any aOldValue, aNewValue;
+ aNewValue <<= AccessibleStateType::FOCUSED;
+ commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue );
+ break;
+
+ }
+ case VCLEVENT_WINDOW_LOSEFOCUS :
+ {
+ uno::Any aOldValue, aNewValue;
+ aOldValue <<= AccessibleStateType::FOCUSED;
+ commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue );
+ break;
+ }
+ case VCLEVENT_LISTBOX_TREESELECT:
+ {
+ SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() );
+ if (pEntry)
+ {
+ sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry );
+ Reference< XAccessible > xChild = m_pTabListBox->CreateAccessibleCell( nRow, m_pTabListBox->GetCurrColumn() );
+ TriState eState = STATE_DONTKNOW;
+ if ( m_pTabListBox->IsCellCheckBox( nRow, m_pTabListBox->GetCurrColumn(), eState ) )
+ {
+ AccessibleCheckBoxCell* pCell = static_cast< AccessibleCheckBoxCell* >( xChild.get() );
+ pCell->commitEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+ }
+ else
+ {
+ AccessibleBrowseBoxTableCell* pCell = static_cast< AccessibleBrowseBoxTableCell* >( xChild.get() );
+ pCell->commitEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+ }
+ }
+ }
+ break;
+ case VCLEVENT_LISTBOX_TREEFOCUS:
+ {
+ if ( m_pTabListBox && m_pTabListBox->HasFocus() )
+ {
+ uno::Any aOldValue, aNewValue;
+ SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() );
+ if ( pEntry )
+ {
+ sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry );
+ m_xCurChild = m_pTabListBox->CreateAccessibleCell( nRow, m_pTabListBox->GetCurrColumn() );
+ aNewValue <<= m_xCurChild;
+ commitEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aNewValue ,aOldValue);
+ }
+ else
+ {
+ aNewValue <<= AccessibleStateType::FOCUSED;
+ commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue ,aOldValue);
+ }
+ }
+ }
+ break;
case VCLEVENT_CHECKBOX_TOGGLE :
{
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index fc95d00a898d..7d8efb1438a4 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -41,6 +41,8 @@ namespace css = ::com::sun::star;
namespace accessibility
{
+ ::sal_Int32 getSelectionType(::sal_Int32 nNewFirstPara, ::sal_Int32 nNewFirstPos, ::sal_Int32 nNewLastPara, ::sal_Int32 nNewLastPos);
+ void sendEvent(::sal_Int32 start, ::sal_Int32 end, ::sal_Int16 nEventId);
// Both ::osl::Mutex and ParagraphBase implement acquire and release, and thus
// ::rtl::Reference< Paragraph > does not work. So ParagraphImpl was factored
@@ -1012,16 +1014,114 @@ Document::retrieveCharacterBounds(ParagraphImpl const * pParagraph,
// XXX numeric overflow
}
+struct IndexCompare
+{
+ const ::css::beans::PropertyValue* pValues;
+ IndexCompare( const ::css::beans::PropertyValue* pVals ) : pValues(pVals) {}
+ bool operator() ( const sal_Int32& a, const sal_Int32& b ) const
+ {
+ return (pValues[a].Name < pValues[b].Name) ? true : false;
+ }
+};
+
::css::uno::Sequence< ::css::beans::PropertyValue >
Document::retrieveCharacterAttributes(
ParagraphImpl const * pParagraph, ::sal_Int32 nIndex,
const ::css::uno::Sequence< ::rtl::OUString >& aRequestedAttributes)
{
::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+
+ Font aFont = m_rEngine.GetFont();
+ const sal_Int32 AttributeCount = 9;
+ sal_Int32 i = 0;
+ ::css::uno::Sequence< ::css::beans::PropertyValue > aAttribs( AttributeCount );
+ //character background color
+ {
+ aAttribs[i].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharBackColor"));
+ aAttribs[i].Handle = -1;
+ aAttribs[i].Value = mapFontColor( aFont.GetFillColor() );
+ aAttribs[i].State = ::css::beans::PropertyState_DIRECT_VALUE;
+ i++;
+ }
+ //character color
+ {
+ aAttribs[i].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharColor"));
+ aAttribs[i].Handle = -1;
+ //aAttribs[i].Value = mapFontColor( aFont.GetColor() );
+ aAttribs[i].Value = mapFontColor( m_rEngine.GetTextColor() );
+ aAttribs[i].State = ::css::beans::PropertyState_DIRECT_VALUE;
+ i++;
+ }
+ //character font name
+ {
+ aAttribs[i].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontName"));
+ aAttribs[i].Handle = -1;
+ aAttribs[i].Value = ::css::uno::makeAny( (::rtl::OUString)aFont.GetName() );
+ aAttribs[i].State = ::css::beans::PropertyState_DIRECT_VALUE;
+ i++;
+ }
+ //character height
+ {
+ aAttribs[i].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharHeight"));
+ aAttribs[i].Handle = -1;
+ aAttribs[i].Value = ::css::uno::makeAny( (sal_Int16)aFont.GetHeight() );
+ aAttribs[i].State = ::css::beans::PropertyState_DIRECT_VALUE;
+ i++;
+ }
+ //character posture
+ {
+ aAttribs[i].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPosture"));
+ aAttribs[i].Handle = -1;
+ aAttribs[i].Value = ::css::uno::makeAny( (sal_Int16)aFont.GetItalic() );
+ aAttribs[i].State = ::css::beans::PropertyState_DIRECT_VALUE;
+ i++;
+ }
+ //character relief
+ /*{
+ aAttribs[i].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharRelief"));
+ aAttribs[i].Handle = -1;
+ aAttribs[i].Value = ::css::uno::makeAny( (sal_Int16)aFont.GetRelief() );
+ aAttribs[i].State = ::css::beans::PropertyState_DIRECT_VALUE;
+ i++;
+ }*/
+ //character strikeout
+ {
+ aAttribs[i].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharStrikeout"));
+ aAttribs[i].Handle = -1;
+ aAttribs[i].Value = ::css::uno::makeAny( (sal_Int16)aFont.GetStrikeout() );
+ aAttribs[i].State = ::css::beans::PropertyState_DIRECT_VALUE;
+ i++;
+ }
+ //character underline
+ {
+ aAttribs[i].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharUnderline"));
+ aAttribs[i].Handle = -1;
+ aAttribs[i].Value = ::css::uno::makeAny( (sal_Int16)aFont.GetUnderline() );
+ aAttribs[i].State = ::css::beans::PropertyState_DIRECT_VALUE;
+ i++;
+ }
+ //character weight
+ {
+ aAttribs[i].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharWeight"));
+ aAttribs[i].Handle = -1;
+ aAttribs[i].Value = ::css::uno::makeAny( (float)aFont.GetWeight() );
+ aAttribs[i].State = ::css::beans::PropertyState_DIRECT_VALUE;
+ i++;
+ }
+ //character alignment
+ {
+ aAttribs[i].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaAdjust"));
+ aAttribs[i].Handle = -1;
+ aAttribs[i].Value = ::css::uno::makeAny( (sal_Int16)m_rEngine.GetTextAlign() );
+ aAttribs[i].State = ::css::beans::PropertyState_DIRECT_VALUE;
+ i++;
+ }
::osl::MutexGuard aInternalGuard(GetMutex());
::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber());
// XXX numeric overflow
- if (nIndex < 0 || nIndex >= m_rEngine.GetText(nNumber).Len())
+ // nIndex can be equal to Len();
+ //if (nIndex < 0 || nIndex >= m_rEngine.GetText(nNumber).Len())
+ if (nIndex < 0 || nIndex > m_rEngine.GetText(nNumber).Len())
throw ::css::lang::IndexOutOfBoundsException(
::rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
@@ -1045,7 +1145,31 @@ Document::retrieveCharacterAttributes(
aCharAttrSeq[ aRunIter->first ] = aRunIter->second;
}
- return convertHashMapToSequence( aCharAttrSeq );
+ ::css::beans::PropertyValue* pValues = aAttribs.getArray();
+ for (i = 0; i < AttributeCount; i++,pValues++)
+ {
+ aCharAttrSeq[ pValues->Name ] = *pValues;
+ }
+
+ ::css::uno::Sequence< ::css::beans::PropertyValue > aRes = convertHashMapToSequence( aCharAttrSeq );
+
+ // sort the attributes
+ sal_Int32 nLength = aRes.getLength();
+ const ::css::beans::PropertyValue* pPairs = aRes.getConstArray();
+ sal_Int32* pIndices = new sal_Int32[nLength];
+ for( i = 0; i < nLength; i++ )
+ pIndices[i] = i;
+ std::sort( &pIndices[0], &pIndices[nLength], IndexCompare(pPairs) );
+ // create sorted sequences accoring to index array
+ ::css::uno::Sequence< ::css::beans::PropertyValue > aNewValues( nLength );
+ ::css::beans::PropertyValue* pNewValues = aNewValues.getArray();
+ for( i = 0; i < nLength; i++ )
+ {
+ pNewValues[i] = pPairs[pIndices[i]];
+ }
+ delete[] pIndices;
+
+ return aNewValues;
}
void Document::retrieveDefaultAttributesImpl(
@@ -1416,7 +1540,8 @@ void Document::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
{
// #107179# if our parent is a compound control (e.g. MultiLineEdit),
// suppress the window focus events here
- if ( !m_bCompoundControlChild )
+// IAccessible2 implementation 2009
+ //if ( !m_bCompoundControlChild )
VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
}
break;
@@ -1483,7 +1608,26 @@ Document::getAccessibleAtPoint(::css::awt::Point const & rPoint)
}
return 0;
}
+void Document::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
+ if (!m_rView.IsReadOnly())
+ rStateSet.AddState( ::css::accessibility::AccessibleStateType::EDITABLE );
+}
+void Document::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
+{
+ if( getAccessibleParent()->getAccessibleContext()->getAccessibleRole() == ::css::accessibility::AccessibleRole::SCROLL_PANE )
+ {
+ ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > aSequence(1);
+ aSequence[0] = getAccessibleParent();
+ rRelationSet.AddRelation( ::css::accessibility::AccessibleRelation( ::css::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
+ }
+ else
+ {
+ VCLXAccessibleComponent::FillAccessibleRelationSet(rRelationSet);
+ }
+}
// virtual
void SAL_CALL Document::disposing()
{
@@ -1626,9 +1770,25 @@ IMPL_LINK(Document, WindowEventHandler, ::VclSimpleEvent *, pEvent)
::osl::MutexGuard aInternalGuard(GetMutex());
if (!isAlive())
break;
-
- if (m_aFocused >= m_aVisibleBegin && m_aFocused < m_aVisibleEnd)
+ //to enable the PARAGRAPH to get focus for multiline edit
+ ::sal_Int32 count = getAccessibleChildCount();
+ ::sal_Bool bEmpty = m_aFocused == m_aVisibleEnd && count == 1;
+ if ((m_aFocused >= m_aVisibleBegin && m_aFocused < m_aVisibleEnd) || bEmpty)
{
+ Paragraphs::iterator m_aTemp = bEmpty ? m_aVisibleBegin : m_aFocused;
+ ::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(m_aTemp));
+ if (xParagraph.is())
+ {
+ xParagraph->notifyEvent(
+ ::css::accessibility::AccessibleEventId::
+ STATE_CHANGED,
+ ::css::uno::Any(),
+ ::css::uno::makeAny(
+ ::css::accessibility::AccessibleStateType::
+ FOCUSED));
+ }
+ }
+ /*
::rtl::Reference< ParagraphImpl > xParagraph(
getParagraph(m_aFocused));
if (xParagraph.is())
@@ -1639,7 +1799,7 @@ IMPL_LINK(Document, WindowEventHandler, ::VclSimpleEvent *, pEvent)
::css::uno::makeAny(
::css::accessibility::AccessibleStateType::
FOCUSED));
- }
+ */
break;
}
case VCLEVENT_WINDOW_LOSEFOCUS:
@@ -1647,7 +1807,24 @@ IMPL_LINK(Document, WindowEventHandler, ::VclSimpleEvent *, pEvent)
::osl::MutexGuard aInternalGuard(GetMutex());
if (!isAlive())
break;
+ //to enable the PARAGRAPH to get focus for multiline edit
+ ::sal_Int32 count = getAccessibleChildCount();
+ ::sal_Bool bEmpty = m_aFocused == m_aVisibleEnd && count == 1;
+ if ((m_aFocused >= m_aVisibleBegin && m_aFocused < m_aVisibleEnd) || bEmpty)
+ {
+ Paragraphs::iterator m_aTemp = bEmpty ? m_aVisibleBegin : m_aFocused;
+ ::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(m_aTemp));
+ if (xParagraph.is())
+ xParagraph->notifyEvent(
+ ::css::accessibility::AccessibleEventId::
+ STATE_CHANGED,
+ ::css::uno::makeAny(
+ ::css::accessibility::AccessibleStateType::
+ FOCUSED),
+ ::css::uno::Any());
+ }
+ /*
if (m_aFocused >= m_aVisibleBegin && m_aFocused < m_aVisibleEnd)
{
::rtl::Reference< ParagraphImpl > xParagraph(
@@ -1661,6 +1838,7 @@ IMPL_LINK(Document, WindowEventHandler, ::VclSimpleEvent *, pEvent)
FOCUSED),
::css::uno::Any());
}
+ */
break;
}
}
@@ -2007,6 +2185,124 @@ void Document::handleParagraphNotifications()
}
}
+::sal_Int32 Document::getSelectionType(::sal_Int32 nNewFirstPara, ::sal_Int32 nNewFirstPos, ::sal_Int32 nNewLastPara, ::sal_Int32 nNewLastPos)
+{
+ if (m_nSelectionFirstPara == -1)
+ return -1;
+ ::sal_Int32 Osp = m_nSelectionFirstPara, Osl = m_nSelectionFirstPos, Oep = m_nSelectionLastPara, Oel = m_nSelectionLastPos;
+ ::sal_Int32 Nsp = nNewFirstPara, Nsl = nNewFirstPos, Nep = nNewLastPara, Nel = nNewLastPos;
+ TextPaM Ns(Nsp, sal_uInt16(Nsl));
+ TextPaM Ne(Nep, sal_uInt16(Nel));
+ TextPaM Os(Osp, sal_uInt16(Osl));
+ TextPaM Oe(Oep, sal_uInt16(Oel));
+
+ if (Os == Oe && Ns == Ne)
+ {
+ //only caret moves.
+ return 1;
+ }
+ else if (Os == Oe && Ns != Ne)
+ {
+ //old has no selection but new has selection
+ return 2;
+ }
+ else if (Os != Oe && Ns == Ne)
+ {
+ //old has selection but new has no selection.
+ return 3;
+ }
+ else if (Os != Oe && Ns != Ne && Osp == Nsp && Osl == Nsl)
+ {
+ //both old and new have selections.
+ if (Oep == Nep )
+ {
+ //Send text_selection_change event on Nep
+
+ return 4;
+ }
+ else if (Oep < Nep)
+ {
+ //all the following examples like 1,2->1,3 means that old start select para is 1, old end select para is 2,
+ // then press shift up, the new start select para is 1, new end select para is 3;
+ //for example, 1, 2 -> 1, 3; 4,1 -> 4, 7; 4,1 -> 4, 2; 4,4->4,5
+ if (Nep >= Nsp)
+ {
+ // 1, 2 -> 1, 3; 4, 1 -> 4, 7; 4,4->4,5;
+ if (Oep < Osp)
+ {
+ // 4,1 -> 4,7;
+ return 5;
+ }
+ else if (Oep >= Osp)
+ {
+ // 1, 2 -> 1, 3; 4,4->4,5;
+ return 6;
+ }
+ }
+ else
+ {
+ // 4,1 -> 4,2,
+ if (Oep < Osp)
+ {
+ // 4,1 -> 4,2,
+ return 7;
+ }
+ else if (Oep >= Osp)
+ {
+ // no such condition. Oep > Osp = Nsp > Nep
+ }
+ }
+ }
+ else if (Oep > Nep)
+ {
+ // 3,2 -> 3,1; 4,7 -> 4,1; 4, 7 -> 4,6; 4,4 -> 4,3
+ if (Nep >= Nsp)
+ {
+ // 4,7 -> 4,6
+ if (Oep <= Osp)
+ {
+ //no such condition, Oep<Osp=Nsp <= Nep
+ }
+ else if (Oep > Osp)
+ {
+ // 4,7 ->4,6
+ return 8;
+ }
+ }
+ else
+ {
+ // 3,2 -> 3,1, 4,7 -> 4,1; 4,4->4,3
+ if (Oep <= Osp)
+ {
+ // 3,2 -> 3,1; 4,4->4,3
+ return 9;
+ }
+ else if (Oep > Osp)
+ {
+ // 4,7 -> 4,1
+ return 10;
+ }
+ }
+ }
+ }
+ return -1;
+}
+
+
+void Document::sendEvent(::sal_Int32 start, ::sal_Int32 end, ::sal_Int16 nEventId)
+{
+ Paragraphs::iterator aEnd = ::std::min(m_xParagraphs->begin() + end + 1, m_aVisibleEnd);
+ for (Paragraphs::iterator aIt = ::std::max(m_xParagraphs->begin() + start, m_aVisibleBegin);
+ aIt < aEnd; ++aIt)
+ {
+ ::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(aIt));
+ if (xParagraph.is())
+ xParagraph->notifyEvent(
+ nEventId,
+ ::css::uno::Any(), ::css::uno::Any());
+ }
+}
+
void Document::handleSelectionChangeNotification()
{
::TextSelection const & rSelection = m_rView.GetSelection();
@@ -2048,7 +2344,11 @@ void Document::handleSelectionChangeNotification()
::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(aIt));
if (xParagraph.is())
{
- if (aIt != m_aFocused)
+ //disable the first event when user types in empty field.
+ ::sal_Int32 count = getAccessibleChildCount();
+ ::sal_Bool bEmpty = count > 1;
+ //if (aIt != m_aFocused)
+ if (aIt != m_aFocused && bEmpty)
xParagraph->notifyEvent(
::css::accessibility::AccessibleEventId::
STATE_CHANGED,
@@ -2068,6 +2368,100 @@ void Document::handleSelectionChangeNotification()
}
m_aFocused = aIt;
+ ::sal_Int32 nMin;
+ ::sal_Int32 nMax;
+ ::sal_Int32 ret = getSelectionType(nNewFirstPara, nNewFirstPos, nNewLastPara, nNewLastPos);
+ switch (ret)
+ {
+ case -1:
+ {
+ //no event
+ }
+ break;
+ case 1:
+ {
+ //only caret moved, already handled in above
+ }
+ break;
+ case 2:
+ {
+ //old has no selection but new has selection
+ nMin = ::std::min(nNewFirstPara, nNewLastPara);
+ nMax = ::std::max(nNewFirstPara, nNewLastPara);
+ sendEvent(nMin, nMax, ::css::accessibility::AccessibleEventId::SELECTION_CHANGED);
+ sendEvent(nMin, nMax, ::css::accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED);
+ }
+ break;
+ case 3:
+ {
+ //old has selection but new has no selection.
+ nMin = ::std::min(m_nSelectionFirstPara, m_nSelectionLastPara);
+ nMax = ::std::max(m_nSelectionFirstPara, m_nSelectionLastPara);
+ sendEvent(nMin, nMax, ::css::accessibility::AccessibleEventId::SELECTION_CHANGED);
+ sendEvent(nMin, nMax, ::css::accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED);
+ }
+ break;
+ case 4:
+ {
+ //Send text_selection_change event on Nep
+ sendEvent(nNewLastPara, nNewLastPara, ::css::accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED);
+ }
+ break;
+ case 5:
+ {
+ // 4, 1 -> 4, 7
+ sendEvent(m_nSelectionLastPara, m_nSelectionFirstPara-1, ::css::accessibility::AccessibleEventId::SELECTION_CHANGED);
+ sendEvent(nNewFirstPara+1, nNewLastPara, ::css::accessibility::AccessibleEventId::SELECTION_CHANGED);
+
+ sendEvent(m_nSelectionLastPara, nNewLastPara, ::css::accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED);
+ }
+ break;
+ case 6:
+ {
+ // 1, 2 -> 1, 4; 4,4->4,5;
+ sendEvent(m_nSelectionLastPara+1, nNewLastPara, ::css::accessibility::AccessibleEventId::SELECTION_CHANGED);
+
+ sendEvent(m_nSelectionLastPara, nNewLastPara, ::css::accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED);
+ }
+ break;
+ case 7:
+ {
+ // 4,1 -> 4,3,
+ sendEvent(m_nSelectionLastPara +1, nNewLastPara , ::css::accessibility::AccessibleEventId::SELECTION_CHANGED);
+
+ sendEvent(m_nSelectionLastPara, nNewLastPara, ::css::accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED);
+ }
+ break;
+ case 8:
+ {
+ // 4,7 ->4,5;
+ sendEvent(nNewLastPara + 1, m_nSelectionLastPara, ::css::accessibility::AccessibleEventId::SELECTION_CHANGED);
+
+ sendEvent(nNewLastPara, m_nSelectionLastPara, ::css::accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED);
+ }
+ break;
+ case 9:
+ {
+ // 3,2 -> 3,1; 4,4->4,3
+ sendEvent(nNewLastPara, m_nSelectionLastPara - 1, ::css::accessibility::AccessibleEventId::SELECTION_CHANGED);
+
+ sendEvent(nNewLastPara, m_nSelectionLastPara, ::css::accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED);
+ }
+ break;
+ case 10:
+ {
+ // 4,7 -> 4,1
+ sendEvent(m_nSelectionFirstPara + 1, m_nSelectionLastPara, ::css::accessibility::AccessibleEventId::SELECTION_CHANGED);
+ sendEvent(nNewLastPara, nNewFirstPara - 1, ::css::accessibility::AccessibleEventId::SELECTION_CHANGED);
+
+ sendEvent(nNewLastPara, m_nSelectionLastPara, ::css::accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED);
+ }
+ break;
+ default:
+ break;
+ }
+
+ /*
// Update both old and new selection. (Regardless of how the two selections
// look like, there will always be two ranges to the left and right of the
// overlap---the overlap and/or the range to the right of it possibly being
@@ -2143,7 +2537,7 @@ void Document::handleSelectionChangeNotification()
// notify selection changes
notifySelectionChange( nFirst1, nLast1 );
notifySelectionChange( nFirst2, nLast2 );
-
+ */
m_nSelectionFirstPara = nNewFirstPara;
m_nSelectionFirstPos = nNewFirstPos;
m_nSelectionLastPara = nNewLastPara;
diff --git a/accessibility/source/helper/accessiblestrings.src b/accessibility/source/helper/accessiblestrings.src
index bcff8eb8e9ea..31b6719097fa 100644
--- a/accessibility/source/helper/accessiblestrings.src
+++ b/accessibility/source/helper/accessiblestrings.src
@@ -25,11 +25,12 @@
#include <accessibility/helper/accessiblestrings.hrc>
#endif
-
+//IAccessibility2 Impplementaton 2009-----
String RID_STR_ACC_ACTION_CLICK
{
- Text = "click";
+ Text = "press";
};
+//-----IAccessibility2 Impplementaton 2009
String RID_STR_ACC_ACTION_TOGGLEPOPUP
{
@@ -66,6 +67,52 @@ String RID_STR_ACC_NAME_BROWSEBUTTON
Text [ en-US ] = "Browse";
};
+String STR_SVT_ACC_ACTION_EXPAND
+{
+ Text [ en-US ] = "Expand" ;
+};
+
+String STR_SVT_ACC_ACTION_COLLAPSE
+{
+ Text [ en-US ] = "Collapse";
+};
+String STR_SVT_ACC_LISTENTRY_SELCTED_STATE
+{
+ Text [ en-US ] = "(Selected)";
+};
+
+String RID_STR_ACC_NAME_PREVIEW
+{
+ Text [ en-US ] = "Preview";
+};
+
+String RID_STR_ACC_ACTION_CHECK
+{
+ Text [ en-US ] = "Check";
+};
+String RID_STR_ACC_ACTION_UNCHECK
+{
+ Text [ en-US ] = "Uncheck";
+};
+String RID_STR_ACC_ACTION_DOUBLE_CLICK
+{
+ Text [ en-US ] = "Double click";
+};
+
+String RID_STR_ACC_SCROLLBAR_NAME_VERTICAL
+{
+ Text [ en-US ] = "Vertical scroll bar";
+};
+String RID_STR_ACC_SCROLLBAR_NAME_HORIZONTAL
+{
+ Text [ en-US ] = "Horizontal scroll bar";
+};
+
+String RID_STR_ACC_PANEL_DESCRIPTION
+{
+ Text [ en-US ] = "Please press enter to go into child control for more operations";
+};
+
String RID_STR_ACC_DESC_PANELDECL_TABBAR
{
Text [ en-US ] = "Panel Deck Tab Bar";
diff --git a/accessibility/source/helper/characterattributeshelper.cxx b/accessibility/source/helper/characterattributeshelper.cxx
index f5e1fa6f5f9a..3a04c9a0d586 100644
--- a/accessibility/source/helper/characterattributeshelper.cxx
+++ b/accessibility/source/helper/characterattributeshelper.cxx
@@ -35,6 +35,8 @@ using namespace ::com::sun::star::beans;
CharacterAttributesHelper::CharacterAttributesHelper( const Font& rFont, sal_Int32 nBackColor, sal_Int32 nColor )
{
+ // MT: IA2 CWS commented out CharFontCharSet, CharFontFamily, CharFontPitch, CharFontStyleName, CharScaleWidth - any AT interested in this?
+
m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharBackColor" ), makeAny( (sal_Int32) nBackColor ) ) );
m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharColor" ), makeAny( (sal_Int32) nColor ) ) );
m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharFontCharSet" ), makeAny( (sal_Int16) rFont.GetCharSet() ) ) );
@@ -47,6 +49,9 @@ CharacterAttributesHelper::CharacterAttributesHelper( const Font& rFont, sal_Int
m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharStrikeout" ), makeAny( (sal_Int16) rFont.GetStrikeout() ) ) );
m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharUnderline" ), makeAny( (sal_Int16) rFont.GetUnderline() ) ) );
m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharWeight" ), makeAny( (float) rFont.GetWeight() ) ) );
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharPosture" ), makeAny( (sal_Int16)rFont.GetItalic() ) ) );
+ // MT: Introduced with IA2 CWS, but adjustment is not a char attr...
+ // m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "ParaAdjust" ), makeAny( nAjust ) ) );
}
// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/accessibility/source/standard/accessiblemenubasecomponent.cxx
index 4b08b757d716..e52d95cd54de 100644
--- a/accessibility/source/standard/accessiblemenubasecomponent.cxx
+++ b/accessibility/source/standard/accessiblemenubasecomponent.cxx
@@ -134,15 +134,20 @@ void OAccessibleMenuBaseComponent::SetEnabled( sal_Bool bEnabled )
{
if ( m_bEnabled != bEnabled )
{
+ sal_Int16 nStateType=AccessibleStateType::ENABLED;
+ if (IsMenuHideDisabledEntries())
+ {
+ nStateType = AccessibleStateType::VISIBLE;
+ }
Any aOldValue[2], aNewValue[2];
if ( m_bEnabled )
{
aOldValue[0] <<= AccessibleStateType::SENSITIVE;
- aOldValue[1] <<= AccessibleStateType::ENABLED;
+ aOldValue[1] <<= nStateType;
}
else
{
- aNewValue[0] <<= AccessibleStateType::ENABLED;
+ aNewValue[0] <<= nStateType;
aNewValue[1] <<= AccessibleStateType::SENSITIVE;
}
m_bEnabled = bEnabled;
@@ -777,3 +782,9 @@ Reference< XAccessibleStateSet > OAccessibleMenuBaseComponent::getAccessibleStat
}
// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuBaseComponent::IsMenuHideDisabledEntries()
+{
+ return sal_False;
+}
+
diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/accessibility/source/standard/accessiblemenuitemcomponent.cxx
index ac46d893abdb..f288d64b5406 100644
--- a/accessibility/source/standard/accessiblemenuitemcomponent.cxx
+++ b/accessibility/source/standard/accessiblemenuitemcomponent.cxx
@@ -208,6 +208,18 @@ void OAccessibleMenuItemComponent::SetAccessibleName( const ::rtl::OUString& sAc
if ( sName.getLength() == 0 )
sName = m_pParent->GetItemText( nItemId );
sName = OutputDevice::GetNonMnemonicString( sName );
+
+ // IA2 CWS, MT: Is adding 5 blanks really before the accelname reasonable? And which Platform / Accessibility API does need it this way? ATK has API for this...
+ // Also, IAccessible2 has IAccessibleAction::keyBinding, so I doubt that this is needed.
+ // But if so, it needs to move to the IA2 bridge.
+ /*
+ ::rtl::OUString sAccName = m_pParent->GetAccelKey( nItemId ).GetName();
+ if ( sAccName.getLength() )
+ {
+ sName += ::rtl::OUString::createFromAscii(" ");
+ sName += aAccelName;
+ }
+ */
}
return sName;
@@ -240,7 +252,8 @@ void OAccessibleMenuItemComponent::SetItemText( const ::rtl::OUString& sItemText
void OAccessibleMenuItemComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
{
- if ( IsEnabled() )
+ sal_Bool bEnabled = IsEnabled();
+ if ( bEnabled )
{
rStateSet.AddState( AccessibleStateType::ENABLED );
rStateSet.AddState( AccessibleStateType::SENSITIVE );
@@ -248,10 +261,10 @@ void OAccessibleMenuItemComponent::FillAccessibleStateSet( utl::AccessibleStateS
if ( IsVisible() )
{
- rStateSet.AddState( AccessibleStateType::VISIBLE );
rStateSet.AddState( AccessibleStateType::SHOWING );
+ if( !IsMenuHideDisabledEntries() || bEnabled )
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
}
-
rStateSet.AddState( AccessibleStateType::OPAQUE );
}
@@ -497,3 +510,23 @@ Reference< awt::XFont > OAccessibleMenuItemComponent::getFont( ) throw (Runtime
}
// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuItemComponent::IsMenuHideDisabledEntries()
+{
+ if (m_pParent )
+ {
+ if( m_pParent->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES)
+ {
+ return sal_True;
+ }
+ // IA2 CWS, but the menus shouldn't have different flags, and even if so, the GetStartedFromMenu shouldn't matter
+ /*
+ else if (m_pParent->GetStartedFromMenu() &&
+ m_pParent->GetStartedFromMenu()->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES)
+ {
+ return sal_True;
+ }
+ */
+ }
+ return sal_False;
+}
diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx
index 360673e0f41a..2ae5be1c1e7b 100644
--- a/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -116,11 +116,98 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
{
switch ( rVclWindowEvent.GetId() )
{
+ case VCLEVENT_LISTBOX_SELECT:
+ case VCLEVENT_LISTBOX_FOCUSITEMCHANGED:
+
+ {
+ // Forward the call to the list child.
+ VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
+ if ( pList == NULL )
+ {
+ getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
+ pList = static_cast<VCLXAccessibleList*>(m_xList.get());
+ }
+ if ( pList != NULL )
+ {
+ pList->ProcessWindowEvent (rVclWindowEvent, m_bIsDropDownBox);
+ if(m_bIsDropDownBox)
+ {
+ NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED, Any(), Any());
+ Any aOldValue;
+ Any aNewValue;
+ aOldValue <<= AccessibleStateType::INDETERMINATE;
+ NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue);
+
+ }
+ }
+ break;
+ }
case VCLEVENT_DROPDOWN_OPEN:
+ {
+ VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
+ if ( pList == NULL )
+ {
+ getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
+ pList = static_cast<VCLXAccessibleList*>(m_xList.get());
+ }
+ if ( pList != NULL )
+ {
+ pList->ProcessWindowEvent (rVclWindowEvent);
+ pList->HandleDropOpen();
+ }
+ break;
+ }
case VCLEVENT_DROPDOWN_CLOSE:
+ {
+ VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
+ if ( pList == NULL )
+ {
+ getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
+ pList = static_cast<VCLXAccessibleList*>(m_xList.get());
+ }
+ if ( pList != NULL )
+ {
+ pList->ProcessWindowEvent (rVclWindowEvent);
+ }
+ Window* pWindow = GetWindow();
+ if( pWindow && (pWindow->HasFocus() || pWindow->HasChildPathFocus()) )
+ {
+ Any aOldValue, aNewValue;
+ aNewValue <<= AccessibleStateType::FOCUSED;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ }
+ case VCLEVENT_COMBOBOX_SELECT:
+ {
+ VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
+ if (pList != NULL)
+ {
+ Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
+ if ( xText.is() )
+ {
+ ::rtl::OUString sText = xText->getSelectedText();
+ if ( !sText.getLength() )
+ sText = xText->getText();
+ pList->UpdateSelection_Acc (sText, m_bIsDropDownBox);
+ //if(m_bIsDropDownBox && !pList->IsInDropDown())
+ if (m_bIsDropDownBox || ( !m_bIsDropDownBox && m_aBoxType==COMBOBOX))
+ NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED, Any(), Any());
+
+ Any aOldValue;
+ Any aNewValue;
+ aOldValue <<= AccessibleStateType::INDETERMINATE;
+ NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue);
+
+ }
+ }
+ break;
+ }
+ //case VCLEVENT_DROPDOWN_OPEN:
+ //case VCLEVENT_DROPDOWN_CLOSE:
case VCLEVENT_LISTBOX_DOUBLECLICK:
case VCLEVENT_LISTBOX_SCROLLED:
- case VCLEVENT_LISTBOX_SELECT:
+ //case VCLEVENT_LISTBOX_SELECT:
case VCLEVENT_LISTBOX_ITEMADDED:
case VCLEVENT_LISTBOX_ITEMREMOVED:
case VCLEVENT_COMBOBOX_ITEMADDED:
@@ -139,7 +226,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
break;
}
- case VCLEVENT_COMBOBOX_SELECT:
+ //case VCLEVENT_COMBOBOX_SELECT:
case VCLEVENT_COMBOBOX_DESELECT:
{
// Selection is handled by VCLXAccessibleList which operates on
@@ -163,6 +250,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
case VCLEVENT_EDIT_MODIFY:
case VCLEVENT_EDIT_SELECTIONCHANGED:
+ // case VCLEVENT_EDIT_CARETCHANGED:
// Modify/Selection events are handled by the combo box instead of
// directly by the edit field (Why?). Therefore, delegate this
// call to the edit field.
@@ -177,7 +265,30 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
}
}
break;
-
+ /*
+ // MT: Not sending VCLEVENT_LISTBOX_STATEUPDATE, see comment in ListBox::SelectEntryPos
+ case VCLEVENT_LISTBOX_STATEUPDATE:
+ {
+ // Need to update the INDETERMINATE state sometimes
+ if (m_bIsDropDownBox && m_aBoxType==LISTBOX)
+ {
+ sal_Int32 nSelectedEntryCount = 0;
+ ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
+ if (pListBox != NULL && pListBox->GetEntryCount() > 0)
+ {
+ nSelectedEntryCount = pListBox->GetSelectEntryCount();
+ Any aOldValue;
+ Any aNewValue;
+ if ( nSelectedEntryCount == 0)
+ aNewValue <<= AccessibleStateType::INDETERMINATE;
+ else
+ aOldValue <<= AccessibleStateType::INDETERMINATE;
+ NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue);
+ }
+ }
+ break;
+ }
+ */
default:
VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
}
@@ -256,7 +367,11 @@ Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int32
{
ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
if (pComboBox!=NULL && pComboBox->GetSubEdit()!=NULL)
+ //Set the edit's acc name the same as parent
+ {
+ pComboBox->GetSubEdit()->SetAccessibleName(getAccessibleName());
m_xText = pComboBox->GetSubEdit()->GetAccessible();
+ }
}
else if (m_bIsDropDownBox)
m_xText = new VCLXAccessibleTextField (GetVCLXWindow(),this);
@@ -275,7 +390,11 @@ sal_Int16 SAL_CALL VCLXAccessibleBox::getAccessibleRole (void) throw (RuntimeExc
// Return the role <const>COMBO_BOX</const> for both VCL combo boxes and
// VCL list boxes in DropDown-Mode else <const>PANEL</const>.
// This way the Java bridge has not to handle both independently.
- return m_bIsDropDownBox ? AccessibleRole::COMBO_BOX : AccessibleRole::PANEL;
+ //return m_bIsDropDownBox ? AccessibleRole::COMBO_BOX : AccessibleRole::PANEL;
+ if (m_bIsDropDownBox || (!m_bIsDropDownBox && m_aBoxType == COMBOBOX ))
+ return AccessibleRole::COMBO_BOX;
+ else
+ return AccessibleRole::PANEL;
}
sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleIndexInParent (void)
@@ -296,7 +415,7 @@ sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleActionCount (void)
// There is one action for drop down boxes (toggle popup) and none for
// the other boxes.
- return m_bIsDropDownBox ? 1 : 0;
+ return m_bIsDropDownBox ? 0 : 1;
}
sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex)
@@ -343,7 +462,11 @@ sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex)
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
if (nIndex<0 || nIndex>=getAccessibleActionCount())
throw ::com::sun::star::lang::IndexOutOfBoundsException();
- return TK_RES_STRING( RID_STR_ACC_ACTION_TOGGLEPOPUP);
+ //Solution:When combo_box,it should not has action information.
+ //return TK_RES_STRING( RID_STR_ACC_ACTION_TOGGLEPOPUP);
+ if (m_aBoxType == LISTBOX)
+ return ::rtl::OUString();
+ return m_bIsDropDownBox?::rtl::OUString():TK_RES_STRING( RID_STR_ACC_ACTION_TOGGLEPOPUP);
}
Reference< XAccessibleKeyBinding > VCLXAccessibleBox::getAccessibleActionKeyBinding( sal_Int32 nIndex )
@@ -367,3 +490,102 @@ void SAL_CALL VCLXAccessibleBox::disposing (void)
VCLXAccessibleComponent::disposing();
}
+// ===== XAccessibleValue ===============================================
+Any VCLXAccessibleBox::getCurrentValue( )
+ throw( RuntimeException )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ Any aAny;
+ if( m_xList.is() && m_xText.is())
+ {
+ // VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
+ Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
+ if ( xText.is() )
+ {
+ ::rtl::OUString sText = xText->getText();
+ aAny <<= sText;
+ }
+ }
+ if (m_aBoxType == LISTBOX && m_bIsDropDownBox && m_xList.is() )
+ {
+
+ VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
+ if(pList->IsInDropDown())
+ {
+ if(pList->getSelectedAccessibleChildCount()>0)
+ {
+ Reference<XAccessibleContext> xName (pList->getSelectedAccessibleChild((sal_Int32)(0)), UNO_QUERY);
+ if(xName.is())
+ {
+ aAny <<= xName->getAccessibleName();
+ }
+ }
+ }
+ }
+
+ return aAny;
+}
+
+sal_Bool VCLXAccessibleBox::setCurrentValue( const Any& aNumber )
+ throw( RuntimeException )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::rtl::OUString fValue;
+ sal_Bool bValid = (aNumber >>= fValue);
+ if( bValid )
+ {
+
+ }
+ return bValid;
+
+}
+
+Any VCLXAccessibleBox::getMaximumValue( )
+ throw( RuntimeException )
+{
+ Any aAny;
+ return aAny;
+}
+
+Any VCLXAccessibleBox::getMinimumValue( )
+ throw( RuntimeException )
+{
+ Any aAny;
+ return aAny;
+}
+
+// Set the INDETERMINATE state when there is no selected item for combobox
+void VCLXAccessibleBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ VCLXAccessibleComponent::FillAccessibleStateSet(rStateSet);
+ if (m_aBoxType == COMBOBOX )
+ {
+ ::rtl::OUString sText;
+ sal_Int32 nEntryCount = 0;
+ ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
+ if (pComboBox != NULL)
+ {
+ Edit* pSubEdit = pComboBox->GetSubEdit();
+ if ( pSubEdit)
+ sText = pSubEdit->GetText();
+ nEntryCount = pComboBox->GetEntryCount();
+ }
+ if (sText.getLength() == 0 && nEntryCount >0)
+ rStateSet.AddState(AccessibleStateType::INDETERMINATE);
+ }
+ else if (m_aBoxType == LISTBOX && m_bIsDropDownBox == true)
+ {
+ sal_Int32 nSelectedEntryCount = 0;
+ ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
+ if (pListBox != NULL && pListBox->GetEntryCount() > 0)
+ {
+ nSelectedEntryCount = pListBox->GetSelectEntryCount();
+ if ( nSelectedEntryCount == 0)
+ rStateSet.AddState(AccessibleStateType::INDETERMINATE);
+ }
+ }
+}
diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx
index 8b08bef932ab..b8aad65dc52d 100644
--- a/accessibility/source/standard/vclxaccessiblebutton.cxx
+++ b/accessibility/source/standard/vclxaccessiblebutton.cxx
@@ -103,6 +103,16 @@ void VCLXAccessibleButton::FillAccessibleStateSet( utl::AccessibleStateSetHelper
if ( pButton->IsPressed() )
rStateSet.AddState( AccessibleStateType::PRESSED );
+
+ // IA2 CWS: If the button has a poppup menu,it should has the state EXPANDABLE
+ if( pButton->GetType() == WINDOW_MENUBUTTON )
+ {
+ rStateSet.AddState( AccessibleStateType::EXPANDABLE );
+ }
+ if( pButton->GetStyle() & WB_DEFBUTTON )
+ {
+ rStateSet.AddState( AccessibleStateType::DEFAULT );
+ }
}
}
@@ -145,6 +155,13 @@ Sequence< ::rtl::OUString > VCLXAccessibleButton::getSupportedServiceNames() thr
OExternalLockGuard aGuard( this );
::rtl::OUString aName( VCLXAccessibleTextComponent::getAccessibleName() );
+
+ // IA2 CWS: Removed special handling for browse/more buttons.
+ // Comment was "the '...' or '<<' or '>>' should be kepted per the requirements from AT"
+ // MT: We did introduce this special handling by intention.
+ // As the original text is still what you get via XAccessibleText,
+ // I think for the accessible name the stuff below is correct.
+
sal_Int32 nLength = aName.getLength();
if ( nLength >= 3 && aName.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("..."), nLength - 3 ) )
diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
index f324a721cd3d..139a15e31699 100644
--- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx
+++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
@@ -238,7 +238,13 @@ sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex ) throw (
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
throw IndexOutOfBoundsException();
- return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
+ //IAccessibility2 Implementation 2009-----
+ // return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
+ //-----IAccessibility2 Implementation 2009
+ if(IsChecked())
+ return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_UNCHECK ) );
+ else
+ return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CHECK ) );
}
// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblelist.cxx b/accessibility/source/standard/vclxaccessiblelist.cxx
index e48b3a141e77..1cff9aab265b 100644
--- a/accessibility/source/standard/vclxaccessiblelist.cxx
+++ b/accessibility/source/standard/vclxaccessiblelist.cxx
@@ -36,6 +36,12 @@
#include <vcl/lstbox.hxx>
#include <toolkit/helper/convert.hxx>
+#ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
+#include <unotools/accessiblerelationsethelper.hxx>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#endif
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -65,6 +71,7 @@ VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType
m_nLastSelectedPos ( LISTBOX_ENTRY_NOTFOUND ),
m_bDisableProcessEvent ( false ),
m_bVisible ( true ),
+ m_nCurSelectedPos ( LISTBOX_ENTRY_NOTFOUND ),
m_xParent ( _xParent )
{
// Because combo boxes and list boxes have the no common interface for
@@ -89,6 +96,7 @@ VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType
}
}
UpdateVisibleLineCount();
+ m_nCurSelectedPos=m_pListBoxHelper->GetSelectEntryPos();
sal_uInt16 nCount = static_cast<sal_uInt16>(getAccessibleChildCount());
m_aAccessibleChildren.reserve(nCount);
@@ -188,6 +196,218 @@ void VCLXAccessibleList::notifyVisibleStates(sal_Bool _bSetNew )
}
}
// -----------------------------------------------------------------------------
+void VCLXAccessibleList::UpdateSelection_Acc (::rtl::OUString sTextOfSelectedItem, bool b_IsDropDownList)
+{
+ if ( m_aBoxType == COMBOBOX )
+ {
+ ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ if ( pBox != NULL )
+ {
+ // Find the index of the selected item inside the VCL control...
+ sal_uInt16 nIndex = pBox->GetEntryPos (XubString(sTextOfSelectedItem));
+ // ...and then find the associated accessibility object.
+ if ( nIndex == LISTBOX_ENTRY_NOTFOUND )
+ nIndex = 0;
+ UpdateSelection_Impl_Acc(b_IsDropDownList);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool b_IsDropDownList)
+{
+ uno::Any aOldValue, aNewValue;
+ VCLXAccessibleListItem* pCurItem =NULL;
+
+ {
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ Reference< XAccessible > xNewAcc;
+ if ( m_pListBoxHelper )
+ {
+ sal_uInt16 i=0;
+ m_nCurSelectedPos = LISTBOX_ENTRY_NOTFOUND;
+ for ( ListItems::iterator aIter = m_aAccessibleChildren.begin();
+ aIter != m_aAccessibleChildren.end(); ++aIter,++i)
+ {
+ Reference< XAccessible > xHold = *aIter;
+ if ( xHold.is() )
+ {
+ VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >( xHold.get() );
+ // Retrieve the item's index from the list entry.
+ sal_Bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i);
+ if (bNowSelected)
+ m_nCurSelectedPos = i;
+
+ if ( bNowSelected && !pItem->IsSelected() )
+ {
+ xNewAcc = *aIter;
+ aNewValue <<= xNewAcc;
+
+ pCurItem = pItem;
+
+ }
+ else if ( pItem->IsSelected() )
+ m_nLastSelectedPos = i;
+
+ pItem->SetSelected( bNowSelected );
+ }
+ else
+ { // it could happen that a child was not created before
+ checkEntrySelected(i,aNewValue,xNewAcc);
+ }
+ }
+ sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount();
+ if ( i < nCount ) // here we have to check the if any other listbox entry is selected
+ {
+ for (; i < nCount && !checkEntrySelected(i,aNewValue,xNewAcc) ;++i )
+ ;
+ }
+ if ( xNewAcc.is() && GetWindow()->HasFocus() )
+ {
+ if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND )
+ aOldValue <<= getAccessibleChild( (sal_Int32)m_nLastSelectedPos );
+ aNewValue <<= xNewAcc;
+ }
+ }
+ }
+ if (m_aBoxType == COMBOBOX && b_IsDropDownList)
+ {
+ //VCLXAccessibleDropDownComboBox
+ //when in list is dropped down, xText = NULL
+ if (m_pListBoxHelper->IsInDropDown())
+ {
+ if ( aNewValue.hasValue() || aOldValue.hasValue() )
+ {
+ NotifyAccessibleEvent(
+ AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ aOldValue,
+ aNewValue );
+
+ NotifyListItem(aNewValue);
+
+ }
+ }
+ }
+ else if (m_aBoxType == COMBOBOX && !b_IsDropDownList)
+ {
+ //VCLXAccessibleComboBox
+ NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, uno::Any(), uno::Any() );
+ }
+ else if (m_aBoxType == LISTBOX && b_IsDropDownList)
+ {
+ //VCLXAccessibleDropdownListBox
+ //when in list is dropped down, xText = NULL
+ if (m_pListBoxHelper->IsInDropDown())
+ {
+ if ( aNewValue.hasValue() || aOldValue.hasValue() )
+ {
+ NotifyAccessibleEvent(
+ AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ aOldValue,
+ aNewValue );
+
+ NotifyListItem(aNewValue);
+ }
+ }
+ }
+ else if (m_aBoxType == LISTBOX && !b_IsDropDownList)
+ {
+ //VCLXAccessibleListBox, xText = NULL.
+
+
+ if ( aNewValue.hasValue())
+ {
+ NotifyListItem(aNewValue);
+ }
+ }
+}
+void VCLXAccessibleList::NotifyListItem(::com::sun::star::uno::Any& val)
+{
+ Reference< XAccessible > xCurItem;
+ val >>= xCurItem;
+ if (xCurItem.is())
+ {
+ VCLXAccessibleListItem* pCurItem = static_cast< VCLXAccessibleListItem* >(xCurItem.get());
+ if (pCurItem)
+ {
+ pCurItem->NotifyAccessibleEvent(AccessibleEventId::SELECTION_CHANGED,Any(),Any());
+ }
+ }
+}
+
+
+void VCLXAccessibleList::UpdateFocus_Impl_Acc (sal_uInt16 nPos ,bool b_IsDropDownList)
+{
+ if (!(m_aBoxType == LISTBOX && !b_IsDropDownList))
+ {
+ return ;
+ }
+ Reference<XAccessible> xChild= CreateChild(nPos);
+ if ( !xChild.is() )
+ {
+ return ;
+ }
+ m_nCurSelectedPos = nPos;
+ uno::Any aOldValue, aNewValue;
+ aNewValue <<= xChild;
+
+ NotifyAccessibleEvent(
+ AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ aOldValue,
+ aNewValue );
+}
+
+// -----------------------------------------------------------------------------
+void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent, bool b_IsDropDownList)
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_LISTBOX_SELECT:
+ if ( !m_bDisableProcessEvent )
+ UpdateSelection_Impl_Acc(b_IsDropDownList);
+ break;
+ case VCLEVENT_LISTBOX_FOCUSITEMCHANGED:
+ if ( !m_bDisableProcessEvent )
+ UpdateFocus_Impl_Acc((sal_uInt16)reinterpret_cast<sal_uInt32>(rVclWindowEvent.GetData()),b_IsDropDownList);
+ break;
+ case VCLEVENT_WINDOW_GETFOCUS:
+ break;
+ case VCLEVENT_CONTROL_GETFOCUS:
+ {
+ VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
+ if (m_aBoxType == COMBOBOX && b_IsDropDownList)
+ {
+ //VCLXAccessibleDropDownComboBox
+ }
+ else if (m_aBoxType == LISTBOX && b_IsDropDownList)
+ {
+ }
+ else if ( m_aBoxType == LISTBOX && !b_IsDropDownList)
+ {
+ if ( m_pListBoxHelper )
+ {
+ uno::Any aOldValue,
+ aNewValue;
+ sal_uInt16 nPos = m_nCurSelectedPos; //m_pListBoxHelper->GetSelectEntryPos();
+
+ if ( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos = m_pListBoxHelper->GetTopEntry();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ aNewValue <<= CreateChild(nPos);
+ NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ aOldValue,
+ aNewValue );
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+}
+// -----------------------------------------------------------------------------
void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
{
// Create a reference to this object to prevent an early release of the
@@ -206,11 +426,13 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve
case VCLEVENT_COMBOBOX_SCROLLED:
UpdateEntryRange_Impl();
break;
-
+ // IAccessible2 implementation, 2009
+ /*
case VCLEVENT_LISTBOX_SELECT:
if ( !m_bDisableProcessEvent )
UpdateSelection_Impl();
break;
+ */
// The selection events VCLEVENT_COMBOBOX_SELECT and
// VCLEVENT_COMBOBOX_DESELECT are not handled here because here we
// have no access to the edit field. Its text is necessary to
@@ -236,20 +458,29 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve
rVclWindowEvent.GetData()));
break;
case VCLEVENT_CONTROL_GETFOCUS:
- VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
- if ( m_pListBoxHelper )
{
- uno::Any aOldValue,
- aNewValue;
- sal_uInt16 nPos = m_pListBoxHelper->GetSelectEntryPos();
- if ( nPos == LISTBOX_ENTRY_NOTFOUND )
- nPos = m_pListBoxHelper->GetTopEntry();
- if ( nPos != LISTBOX_ENTRY_NOTFOUND )
- aNewValue <<= CreateChild(nPos);
-
- NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
- aOldValue,
- aNewValue );
+ VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
+ // Added by IBM Symphony Acc team to handle the list item focus when List control get focus
+ sal_Bool b_IsDropDownList = sal_True;
+ if (m_pListBoxHelper)
+ b_IsDropDownList = ((m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN);
+ if ( m_aBoxType == LISTBOX && !b_IsDropDownList )
+ {
+ if ( m_pListBoxHelper )
+ {
+ uno::Any aOldValue,
+ aNewValue;
+ sal_uInt16 nPos = m_nCurSelectedPos;
+
+ if ( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos = m_pListBoxHelper->GetTopEntry();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ aNewValue <<= CreateChild(nPos);
+ NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ aOldValue,
+ aNewValue );
+ }
+ }
}
break;
@@ -257,6 +488,24 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve
VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
}
}
+
+ void VCLXAccessibleList::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
+{
+ ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ if( m_aBoxType == LISTBOX )
+ {
+ if (m_pListBoxHelper && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) != WB_DROPDOWN)
+ {
+ uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+ aSequence[0] = pBox->GetAccessible();
+ rRelationSet.AddRelation( com::sun::star::accessibility::AccessibleRelation( com::sun::star::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
+ }
+ }
+ else
+ {
+ VCLXAccessibleComponent::FillAccessibleRelationSet(rRelationSet);
+ }
+}
// -----------------------------------------------------------------------------
/** To find out which item is currently selected and to update the SELECTED
@@ -315,9 +564,12 @@ Reference<XAccessible> VCLXAccessibleList::CreateChild (sal_Int32 i)
// check if position is empty and can be used else we have to adjust all entries behind this
if ( xChild.is() )
{
+ // IAccessible2 implementation, 2009
+ /*
ListItems::iterator aIter = m_aAccessibleChildren.begin() + nPos;
::std::mem_fun_t<bool, VCLXAccessibleListItem> aTemp(&VCLXAccessibleListItem::IncrementIndexInParent);
adjustEntriesIndexInParent( aIter, aTemp);
+ */
}
else
{
@@ -332,6 +584,9 @@ Reference<XAccessible> VCLXAccessibleList::CreateChild (sal_Int32 i)
sal_Bool bNowSelected = sal_False;
if ( m_pListBoxHelper )
bNowSelected = m_pListBoxHelper->IsEntryPosSelected ((sal_uInt16)i);
+ // IAccessible2 implementation 2009
+ if (bNowSelected)
+ m_nCurSelectedPos = sal_uInt16(i);
VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >(xChild.get());
pItem->SetSelected( bNowSelected );
@@ -350,6 +605,8 @@ Reference<XAccessible> VCLXAccessibleList::CreateChild (sal_Int32 i)
void VCLXAccessibleList::HandleChangedItemList (bool bItemInserted, sal_Int32 nIndex)
{
+ // IAccessible2 implementation 2009
+ /*
if ( !bItemInserted )
{
if ( nIndex == -1 ) // special handling here
@@ -368,7 +625,8 @@ void VCLXAccessibleList::HandleChangedItemList (bool bItemInserted, sal_Int32 nI
}
else
getAccessibleChild(nIndex);
-
+ */
+ clearItems();
NotifyAccessibleEvent (
AccessibleEventId::INVALIDATE_ALL_CHILDREN,
Any(), Any());
@@ -600,6 +858,7 @@ void VCLXAccessibleList::UpdateSelection_Impl(sal_uInt16)
if ( m_pListBoxHelper )
{
sal_uInt16 i=0;
+ m_nCurSelectedPos = LISTBOX_ENTRY_NOTFOUND;
for ( ListItems::iterator aIter = m_aAccessibleChildren.begin();
aIter != m_aAccessibleChildren.end(); ++aIter,++i)
{
@@ -609,6 +868,8 @@ void VCLXAccessibleList::UpdateSelection_Impl(sal_uInt16)
VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >( xHold.get() );
// Retrieve the item's index from the list entry.
sal_Bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i);
+ if (bNowSelected)
+ m_nCurSelectedPos = i;
if ( bNowSelected && !pItem->IsSelected() )
{
@@ -639,14 +900,19 @@ void VCLXAccessibleList::UpdateSelection_Impl(sal_uInt16)
}
}
}
-
- if ( aNewValue.hasValue() || aOldValue.hasValue() )
- NotifyAccessibleEvent(
- AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
- aOldValue,
- aNewValue );
-
- NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+ if (!m_pListBoxHelper->IsInDropDown())
+ {
+ }
+ else
+ {
+ if ( aNewValue.hasValue() || aOldValue.hasValue() )
+ NotifyAccessibleEvent(
+ AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ aOldValue,
+ aNewValue );
+ //the SELECTION_CHANGED is not necessary
+ //NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+ }
}
// -----------------------------------------------------------------------------
@@ -808,10 +1074,12 @@ awt::Rectangle VCLXAccessibleList::implGetBounds() throw (uno::RuntimeException)
if ( pBox )
{
Size aSize = pBox->GetSubEdit()->GetSizePixel();
- aBounds.X += aSize.Height();
- aBounds.Y += aSize.Width();
+ // IAccessible2 implementation, 2009
+ //aBounds.X += aSize.Height();
+ //aBounds.Y += aSize.Width();
+ aBounds.Y += aSize.Height();
aBounds.Height -= aSize.Height();
- aBounds.Width -= aSize.Width();
+ //aBounds.Width -= aSize.Width();
}
}
}
@@ -839,12 +1107,33 @@ awt::Point VCLXAccessibleList::getLocationOnScreen( ) throw (uno::RuntimeExcept
ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
if ( pBox )
{
- aPos.X += pBox->GetSubEdit()->GetSizePixel().Height();
- aPos.Y += pBox->GetSubEdit()->GetSizePixel().Width();
+ //aPos.X += pBox->GetSubEdit()->GetSizePixel().Height();
+ //aPos.Y += pBox->GetSubEdit()->GetSizePixel().Width();
+ aPos.Y += pBox->GetSubEdit()->GetSizePixel().Height();
}
}
}
return aPos;
}
// -----------------------------------------------------------------------------
-
+sal_Bool VCLXAccessibleList::IsInDropDown()
+{
+ return m_pListBoxHelper->IsInDropDown();
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleList::HandleDropOpen()
+{
+ if ( !m_bDisableProcessEvent )
+ UpdateSelection_Impl();
+ if (m_nCurSelectedPos != LISTBOX_ENTRY_NOTFOUND &&
+ m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ Reference< XAccessible > xChild = getAccessibleChild(m_nCurSelectedPos);
+ if(xChild.is())
+ {
+ uno::Any aNewValue;
+ aNewValue <<= xChild;
+ NotifyAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, uno::Any(), aNewValue );
+ }
+ }
+}
diff --git a/accessibility/source/standard/vclxaccessiblelistitem.cxx b/accessibility/source/standard/vclxaccessiblelistitem.cxx
index d20f03910bfd..9c3351126bb9 100644
--- a/accessibility/source/standard/vclxaccessiblelistitem.cxx
+++ b/accessibility/source/standard/vclxaccessiblelistitem.cxx
@@ -317,9 +317,15 @@ Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleListItem::getAccessibleS
if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
{
pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
- pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
- pStateSetHelper->AddState( AccessibleStateType::ENABLED );
- pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+
+ // IAccessible2 implementation, 2009
+ if(m_pListBoxHelper->IsEnabled())
+ {
+ pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+ pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+ }
+
if ( m_bSelected )
pStateSetHelper->AddState( AccessibleStateType::SELECTED );
if ( m_bVisible )
diff --git a/accessibility/source/standard/vclxaccessiblemenu.cxx b/accessibility/source/standard/vclxaccessiblemenu.cxx
index 45e860118d74..9ee230f5758c 100644
--- a/accessibility/source/standard/vclxaccessiblemenu.cxx
+++ b/accessibility/source/standard/vclxaccessiblemenu.cxx
@@ -249,3 +249,14 @@ void VCLXAccessibleMenu::deselectAccessibleChild( sal_Int32 nChildIndex ) throw
}
// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleMenu::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ return ::rtl::OUString( );
+}
+
diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx
index ac1bc4af924c..e8bc42e834e6 100644
--- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx
+++ b/accessibility/source/standard/vclxaccessiblemenuitem.cxx
@@ -191,8 +191,19 @@ Sequence< ::rtl::OUString > VCLXAccessibleMenuItem::getSupportedServiceNames() t
sal_Int16 VCLXAccessibleMenuItem::getAccessibleRole( ) throw (RuntimeException)
{
OExternalLockGuard aGuard( this );
-
- return AccessibleRole::MENU_ITEM;
+ // IA2 CWS. MT: We had the aditional roles in UAA for ever, but never used them anywhere.
+ // Looks reasonable, but need to verify in Orca and VoiceOver.
+ sal_Int16 nRole = AccessibleRole::MENU_ITEM;
+ if ( m_pParent )
+ {
+ sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
+ MenuItemBits nItemBits = m_pParent->GetItemBits(nItemId);
+ if( nItemBits & MIB_RADIOCHECK)
+ nRole = AccessibleRole::RADIO_MENU_ITEM;
+ else if( nItemBits & MIB_CHECKABLE)
+ nRole = AccessibleRole::CHECK_MENU_ITEM;
+ }
+ return nRole;
}
// -----------------------------------------------------------------------------
@@ -454,8 +465,9 @@ sal_Bool VCLXAccessibleMenuItem::doAccessibleAction ( sal_Int32 nIndex ) throw (
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
throw IndexOutOfBoundsException();
-
- return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
+ //IAccessibility2 Impplementaton 2009-----
+ return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_SELECT ) );
+ //-----IAccessibility2 Impplementaton 2009
}
// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
index 1fe1f2423bf2..5c411797f3ed 100644
--- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx
+++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
@@ -197,8 +197,7 @@ sal_Bool VCLXAccessibleRadioButton::doAccessibleAction ( sal_Int32 nIndex ) thro
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
throw IndexOutOfBoundsException();
-
- return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
+ return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_SELECT ) );
}
// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
index 021a603c4757..8384a1f9e0ec 100644
--- a/accessibility/source/standard/vclxaccessiblescrollbar.cxx
+++ b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
@@ -88,7 +88,8 @@ void VCLXAccessibleScrollBar::FillAccessibleStateSet( utl::AccessibleStateSetHel
VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() );
if ( pVCLXScrollBar )
{
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ // IA2 CWS: scroll bar should not have FOCUSABLE state.
+ // rStateSet.AddState( AccessibleStateType::FOCUSABLE );
if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::HORIZONTAL )
rStateSet.AddState( AccessibleStateType::HORIZONTAL );
else if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::VERTICAL )
@@ -274,3 +275,21 @@ Any VCLXAccessibleScrollBar::getMinimumValue( ) throw (RuntimeException)
}
// -----------------------------------------------------------------------------
+
+// IAccessible2 implementation, 2009
+::rtl::OUString VCLXAccessibleScrollBar::getAccessibleName( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString aName;
+ VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() );
+ if ( pVCLXScrollBar )
+ {
+ if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::HORIZONTAL )
+ aName = TK_RES_STRING( RID_STR_ACC_SCROLLBAR_NAME_HORIZONTAL );
+ else if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::VERTICAL )
+ aName = TK_RES_STRING( RID_STR_ACC_SCROLLBAR_NAME_VERTICAL );
+ }
+ return aName;
+}
+
diff --git a/accessibility/source/standard/vclxaccessibletabcontrol.cxx b/accessibility/source/standard/vclxaccessibletabcontrol.cxx
index c8671e371e1e..1718a137ba67 100644
--- a/accessibility/source/standard/vclxaccessibletabcontrol.cxx
+++ b/accessibility/source/standard/vclxaccessibletabcontrol.cxx
@@ -81,7 +81,8 @@ void VCLXAccessibleTabControl::UpdateFocused()
void VCLXAccessibleTabControl::UpdateSelected( sal_Int32 i, bool bSelected )
{
- NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+ // IAccessible2 implementation, 2009
+ //NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
{
diff --git a/accessibility/source/standard/vclxaccessibletextcomponent.cxx b/accessibility/source/standard/vclxaccessibletextcomponent.cxx
index 71ad6ebe472e..2d185dbf6626 100644
--- a/accessibility/source/standard/vclxaccessibletextcomponent.cxx
+++ b/accessibility/source/standard/vclxaccessibletextcomponent.cxx
@@ -190,9 +190,61 @@ Sequence< PropertyValue > VCLXAccessibleTextComponent::getCharacterAttributes( s
if ( GetWindow() )
{
Font aFont = GetWindow()->GetControlFont();
+
sal_Int32 nBackColor = GetWindow()->GetControlBackground().GetColor();
sal_Int32 nColor = GetWindow()->GetControlForeground().GetColor();
+
+ // MT: Code with default font was introduced with the IA2 CWS, but I am not convinced that this is the correct font...
+ // Decide what to do when we have a concrete issue.
+ /*
+ Font aDefaultVCLFont;
+ OutputDevice* pDev = Application::GetDefaultDevice();
+ if ( pDev )
+ {
+ aDefaultVCLFont = pDev->GetSettings().GetStyleSettings().GetAppFont();
+ if ( !aFont.GetName().Len() )
+ {
+ String aDefaultName = aDefaultVCLFont.GetName();
+ aFont.SetName( aDefaultName );
+ }
+ if ( !aFont.GetHeight() )
+ {
+ aFont.SetHeight( aDefaultVCLFont.GetHeight() );
+ }
+ if ( aFont.GetWeight() == WEIGHT_DONTKNOW )
+ {
+ aFont.SetWeight( aDefaultVCLFont.GetWeight() );
+ }
+
+ //if nColor is -1, it may indicate that the default color black is using.
+ if ( nColor == -1)
+ {
+ nColor = aDefaultVCLFont.GetColor().GetColor();
+ }
+ }
+ */
+
+ // MT: Adjustment stuff was introduced with the IA2 CWS, but adjustment is not a character attribute...
+ // In case we reintroduce it, use adjustment as extra parameter for the CharacterAttributesHelper...
+ /*
+ WinBits aBits = GetWindow()->GetStyle();
+ sal_Int16 nAdjust = -1;
+ if ( aBits & WB_LEFT )
+ {
+ nAdjust = style::ParagraphAdjust_LEFT;
+ }
+ else if ( aBits & WB_RIGHT )
+ {
+ nAdjust = style::ParagraphAdjust_RIGHT;
+ }
+ else if ( aBits & WB_CENTER )
+ {
+ nAdjust = style::ParagraphAdjust_CENTER;
+ }
+ */
+
::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
+
aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
}
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx
index a58163c818a6..e4cebc53f461 100644
--- a/accessibility/source/standard/vclxaccessibletoolbox.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx
@@ -208,7 +208,7 @@ VCLXAccessibleToolBoxItem* VCLXAccessibleToolBox::GetItem_Impl( sal_Int32 _nPos,
{
ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos );
// returns only toolbox buttons, not windows
- if ( aIter != m_aAccessibleChildren.end() && !aIter->second.is())
+ if ( aIter != m_aAccessibleChildren.end() && aIter->second.is())
pItem = static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
}
@@ -284,11 +284,14 @@ void VCLXAccessibleToolBox::ReleaseFocus_Impl( sal_Int32 _nPos )
}
}
// -----------------------------------------------------------------------------
-void VCLXAccessibleToolBox::UpdateChecked_Impl( sal_Int32 )
+void VCLXAccessibleToolBox::UpdateChecked_Impl( sal_Int32 _nPos )
{
ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
if ( pToolBox )
{
+ sal_uInt16 nFocusId = pToolBox->GetItemId( (sal_uInt16)_nPos );
+ VCLXAccessibleToolBoxItem* pFocusItem = NULL;
+
for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin();
aIter != m_aAccessibleChildren.end(); ++aIter )
{
@@ -297,7 +300,12 @@ void VCLXAccessibleToolBox::UpdateChecked_Impl( sal_Int32 )
VCLXAccessibleToolBoxItem* pItem =
static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
pItem->SetChecked( pToolBox->IsItemChecked( nItemId ) );
+ if ( nItemId == nFocusId )
+ pFocusItem = pItem;
}
+ //Solution:If the position is not a child item,the focus should not be called
+ if ( pFocusItem && (sal_uInt16)_nPos != TOOLBOX_ITEM_NOTFOUND )
+ pFocusItem->SetFocus( sal_True );
}
}
// -----------------------------------------------------------------------------
@@ -535,23 +543,41 @@ void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindow
// to prevent an early release of the toolbox (VCLEVENT_OBJECT_DYING)
Reference< XAccessibleContext > xTemp = this;
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
switch ( rVclWindowEvent.GetId() )
{
case VCLEVENT_TOOLBOX_CLICK:
+ case VCLEVENT_TOOLBOX_SELECT:
{
if ( rVclWindowEvent.GetData() )
{
UpdateChecked_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
UpdateIndeterminate_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
}
+ else if( pToolBox->GetItemPos(pToolBox->GetCurItemId()) != TOOLBOX_ITEM_NOTFOUND )
+ {
+ UpdateChecked_Impl( pToolBox->GetItemPos(pToolBox->GetCurItemId()) );
+ UpdateIndeterminate_Impl( pToolBox->GetItemPos(pToolBox->GetCurItemId()) );
+ }
break;
}
case VCLEVENT_TOOLBOX_DOUBLECLICK:
case VCLEVENT_TOOLBOX_ACTIVATE:
case VCLEVENT_TOOLBOX_DEACTIVATE:
- case VCLEVENT_TOOLBOX_SELECT:
+ //case VCLEVENT_TOOLBOX_SELECT:
break;
-
+ // IA2 CWS. MT: Still using VCLEVENT_TOOLBOX_CLICK, see comment in vcl/source/window/toolbox2.cxx
+ /*
+ case VCLEVENT_TOOLBOX_ITEMUPDATED:
+ {
+ if ( rVclWindowEvent.GetData() )
+ {
+ UpdateChecked_Impl( TOOLBOX_ITEM_NOTFOUND );
+ UpdateIndeterminate_Impl( (sal_Int32)rVclWindowEvent.GetData() );
+ }
+ break;
+ }
+ */
case VCLEVENT_TOOLBOX_HIGHLIGHT:
UpdateFocus_Impl();
break;
diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
index 40215e9157fc..759afe1bc73a 100644
--- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
@@ -97,6 +97,10 @@ VCLXAccessibleToolBoxItem::VCLXAccessibleToolBoxItem( ToolBox* _pToolBox, sal_In
else if (( ( nBits & TIB_CHECKABLE ) == TIB_CHECKABLE ) ||
( ( nBits & TIB_AUTOCHECK ) == TIB_AUTOCHECK ) )
m_nRole = AccessibleRole::TOGGLE_BUTTON;
+ else if ( (nBits & TIB_DROPDOWN) == TIB_DROPDOWN )
+ {
+ m_nRole = AccessibleRole::BUTTON_DROPDOWN;
+ }
else if ( m_pToolBox->GetItemWindow( m_nItemId ) )
m_nRole = AccessibleRole::PANEL;
break;
@@ -144,6 +148,18 @@ VCLXAccessibleToolBoxItem::~VCLXAccessibleToolBoxItem()
// sRet += String( RTL_CONSTASCII_USTRINGPARAM( " " ) );
// sRet += sWinText;
// }
+ if ( sRet.getLength() == 0 )
+ {
+ Window* pItemWindow = m_pToolBox->GetItemWindow( m_nItemId );
+ if ( m_nRole == AccessibleRole::PANEL && pItemWindow && pItemWindow->GetAccessible().is() &&
+ pItemWindow->GetAccessible()->getAccessibleContext().is() )
+ {
+ ::rtl::OUString sWinText = pItemWindow->GetAccessible()->getAccessibleContext()->getAccessibleName();
+ if ( sWinText.getLength() > 0 )
+ sRet = sWinText;
+ }
+ }
+
}
return sRet;
}
@@ -165,6 +181,8 @@ void VCLXAccessibleToolBoxItem::SetFocus( sal_Bool _bFocus )
// -----------------------------------------------------------------------------
void VCLXAccessibleToolBoxItem::SetChecked( sal_Bool _bCheck )
{
+ if( m_nRole == AccessibleRole::PANEL)
+ return;
if ( m_bIsChecked != _bCheck )
{
Any aOldValue;
@@ -370,11 +388,19 @@ sal_Int16 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleRole( ) throw (Runti
{
OExternalLockGuard aGuard( this );
- ::rtl::OUString sDescription;
- if ( m_pToolBox )
+
+ if(m_nRole == AccessibleRole::PANEL && getAccessibleChildCount() > 0 )
+ {
+ return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_PANEL_DESCRIPTION ) );
+ }
+ else
+ {
+ ::rtl::OUString sDescription;
+ if ( m_pToolBox )
sDescription = m_pToolBox->GetHelpText( m_nItemId );
- return sDescription;
+ return sDescription;
+ }
}
// -----------------------------------------------------------------------------
::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleName( ) throw (RuntimeException)
@@ -404,11 +430,11 @@ Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessib
if ( m_pToolBox && !rBHelper.bDisposed && !rBHelper.bInDispose )
{
pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
- if ( m_bIsChecked )
+ if ( m_bIsChecked && m_nRole != AccessibleRole::PANEL )
pStateSetHelper->AddState( AccessibleStateType::CHECKED );
if ( m_bIndeterminate )
pStateSetHelper->AddState( AccessibleStateType::INDETERMINATE );
- if ( m_pToolBox->IsItemEnabled( m_nItemId ) )
+ if ( m_pToolBox->IsEnabled() && m_pToolBox->IsItemEnabled( m_nItemId ) )
{
pStateSetHelper->AddState( AccessibleStateType::ENABLED );
pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
@@ -674,6 +700,8 @@ Any VCLXAccessibleToolBoxItem::getCurrentValue( ) throw (RuntimeException)
if ( m_pToolBox )
aValue <<= (sal_Int32)m_pToolBox->IsItemChecked( m_nItemId );
+ if( m_nRole == AccessibleRole::PANEL )
+ aValue <<= (sal_Int32)0;
return aValue;
}
// -----------------------------------------------------------------------------