Commits

Anonymous committed 3e17b63

accfixes3: merged IA2-related changes from CWS accstuff

Comments (0)

Files changed (22)

accessibility/inc/accessibility/extended/accessiblelistbox.hxx

 //........................................................................
 namespace accessibility
 {
+	class AccessibleListBoxEntry;
 //........................................................................
 
 	typedef ::cppu::ImplHelper2<  ::com::sun::star::accessibility::XAccessible
 		sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
 		::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
 		void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+		// IA2 CWS
+		sal_Int32 SAL_CALL getRoleType();
+		
 private:
 
 	typedef std::map< SvLBoxEntry*, ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > MAP_ENTRY;
 	MAP_ENTRY m_mapEntry;
 
     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xFocusedChild; 	
+	
+	accessibility::AccessibleListBoxEntry* GetCurEventEntry( const VclWindowEvent& rVclWindowEvent );
+
 	};
 
 //........................................................................

accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx

 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/lang/XEventListener.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
+/*
 #include <cppuhelper/compbase8.hxx>
+*/
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEVALUE_HPP_
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#endif
+#ifndef _CPPUHELPER_COMPBASE9_HXX_
+#include <cppuhelper/compbase9.hxx>
+#endif
 #include <comphelper/broadcasthelper.hxx>
 #include <comphelper/accessibletexthelper.hxx>
 #include <tools/gen.hxx>
 //........................................................................
 
 // class AccessibleListBoxEntry ------------------------------------------
-
+/*
 	typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible
 												, ::com::sun::star::accessibility::XAccessibleContext
 												, ::com::sun::star::accessibility::XAccessibleComponent
 												, ::com::sun::star::accessibility::XAccessibleSelection
 												, ::com::sun::star::accessibility::XAccessibleText
 										    	, ::com::sun::star::lang::XServiceInfo > AccessibleListBoxEntry_BASE;
-
+*/
+	typedef ::cppu::WeakAggComponentImplHelper9< ::com::sun::star::accessibility::XAccessible
+												, ::com::sun::star::accessibility::XAccessibleContext
+												, ::com::sun::star::accessibility::XAccessibleComponent
+												, ::com::sun::star::accessibility::XAccessibleEventBroadcaster
+												, ::com::sun::star::accessibility::XAccessibleAction
+												, ::com::sun::star::accessibility::XAccessibleSelection
+												, ::com::sun::star::accessibility::XAccessibleText
+												, ::com::sun::star::accessibility::XAccessibleValue
+										    	, ::com::sun::star::lang::XServiceInfo > AccessibleListBoxEntry_BASE;
+										    	
 	/** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */
 	class AccessibleListBoxEntry:public ::comphelper::OBaseMutex
 							   	,public AccessibleListBoxEntry_BASE
 		sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
 		::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
 		void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
+		virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue(  ) throw (::com::sun::star::uno::RuntimeException);
+		virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException);
+		virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue(  ) throw (::com::sun::star::uno::RuntimeException);
+		virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue(  ) throw (::com::sun::star::uno::RuntimeException);
     private:
         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > implGetParentAccessible( ) const;
+		SvLBoxEntry* GetRealChild(sal_Int32 nIndex);
+	public:
+		sal_Int32 SAL_CALL getRoleType();
 	};
 
 //........................................................................

accessibility/inc/accessibility/extended/textwindowaccessibility.hxx

 #include <comphelper/accessibletexthelper.hxx>
 #include <rtl/ref.hxx>
 
+// IAccessible2 implementation, 2009
+#ifndef _SVTOOLS_HRC 
+#include "svtools/svtools.hrc" 
+#endif
+#ifndef _SVTOOLS_SVTDATA_HXX 
+#include "svtools/svtdata.hxx" 
+#endif
+#ifndef _SV_SVAPP_HXX 
+#include <vcl/svapp.hxx> 
+#endif
+#ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
+#include <unotools/accessiblerelationsethelper.hxx>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#endif
 #include <memory>
 #include <queue>
 #include <hash_map>
     virtual ::css::uno::Reference< ::css::accessibility::XAccessible >
     SAL_CALL getAccessibleAtPoint(::css::awt::Point const & rPoint)
         throw (::css::uno::RuntimeException);
-
+// IAccessible2 implementation, 2009
+    virtual void	FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+   virtual void	FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
     // ??? Will be called with both the external (Solar) and internal mutex
     // locked:
     virtual void SAL_CALL disposing();
     void handleSelectionChangeNotification();
 
     void notifySelectionChange( sal_Int32 nFirst, sal_Int32 nLast );
+// IAccessible2 implementation, 2009
+    ::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);
 
     void justifySelection( TextPaM& rTextStart, TextPaM& rTextEnd );
 

accessibility/inc/accessibility/helper/accessiblestrings.hrc

 #define RID_STR_ACC_ACTION_DECLINE			( RID_TK_ACC_START +    4 )
 #define RID_STR_ACC_ACTION_INCBLOCK			( RID_TK_ACC_START +    5 )
 #define RID_STR_ACC_ACTION_DECBLOCK			( RID_TK_ACC_START +    6 )
+#define RID_STR_ACC_NAME_PREVIEW            		( RID_TK_ACC_START +    7 )
 
+#define STR_SVT_ACC_ACTION_EXPAND			( RID_TK_ACC_START +    8 )
+#define STR_SVT_ACC_ACTION_COLLAPSE			( RID_TK_ACC_START +    9 )
+#define STR_SVT_ACC_LISTENTRY_SELCTED_STATE		( RID_TK_ACC_START +    10 )
 
 #define	RID_STR_ACC_ACTION_CHECK			( RID_TK_ACC_START +    11 )
 #define	RID_STR_ACC_ACTION_UNCHECK			( RID_TK_ACC_START +    12 )
+#define RID_STR_ACC_ACTION_DOUBLE_CLICK			( RID_TK_ACC_START +    13 )
 #define RID_STR_ACC_SCROLLBAR_NAME_VERTICAL		( RID_TK_ACC_START +    14 )
 #define RID_STR_ACC_SCROLLBAR_NAME_HORIZONTAL		( RID_TK_ACC_START +    15 )
+#define RID_STR_ACC_PANEL_DESCRIPTION  			( RID_TK_ACC_START +    16 )
+
 #define RID_STR_ACC_NAME_BROWSEBUTTON			( RID_TK_ACC_START + 100 )
 #define RID_STR_ACC_DESC_PANELDECL_TABBAR   		( RID_TK_ACC_START + 101 )
 

accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx

 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #endif
 #include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEVALUE_HPP_
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#endif
 #ifndef _CPPUHELPER_IMPLBASE2_HXX
 #include <cppuhelper/implbase2.hxx>
 #endif
 
 
-typedef ::cppu::ImplHelper2<
+typedef ::cppu::ImplHelper3<
     ::com::sun::star::accessibility::XAccessible,
+	::com::sun::star::accessibility::XAccessibleValue,
     ::com::sun::star::accessibility::XAccessibleAction
     > VCLXAccessibleBox_BASE;
 
     */
 	virtual void SAL_CALL disposing (void);
 
+	//=====  XAccessibleValue  ================================================
 
+    virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( )
+        throw (::com::sun::star::uno::RuntimeException);
+
+    virtual sal_Bool SAL_CALL setCurrentValue( 
+        const ::com::sun::star::uno::Any& aNumber ) 
+        throw (::com::sun::star::uno::RuntimeException);
+
+    virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue(  ) 
+        throw (::com::sun::star::uno::RuntimeException);
+
+    virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue(  ) 
+        throw (::com::sun::star::uno::RuntimeException);
+	bool IsDropDownBox() {return m_bIsDropDownBox;};
+	BoxType GetBoxType() { return m_aBoxType;};
 protected:
     /** Specifies whether the box is a combo box or a list box.  List boxes
         have multi selection.
 	virtual void ProcessWindowChildEvent (const VclWindowEvent& rVclWindowEvent);
 	virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent);
 
+// IAccessible2 implementation, 2009
+	virtual void	FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
 
 private:
     /// Index in parent.  This is settable from the outside.

accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx

     /** Process some of the events and delegate the rest to the base classes.
     */
     virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent);
+    virtual void	FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
 
     /** Called on reception of selection events this method checks all known
         list items for a possible change in their selection state and
 	virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
 
 	virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(	) throw (::com::sun::star::uno::RuntimeException);
+	sal_Bool    IsInDropDown();
+	void 		HandleDropOpen();
+	virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent, bool b_IsDropDownList);
+	void UpdateSelection_Acc (::rtl::OUString sTextOfSelectedItem, bool b_IsDropDownList);
+	void UpdateSelection_Impl_Acc (bool b_IsDropDownList);
 
+	void UpdateFocus_Impl_Acc ( sal_uInt16 nPos, bool b_IsDropDownList) ;
+	void NotifyListItem(::com::sun::star::uno::Any& val);
 protected:
     BoxType		m_aBoxType;
 	::accessibility::IComboListBoxHelper* m_pListBoxHelper;
     /// Index in parent.  This is settable from the outside.
 	sal_Int32	m_nIndexInParent;
 	sal_Int32	m_nLastTopEntry;
-	sal_uInt16		m_nLastSelectedPos;
+	sal_uInt16	m_nLastSelectedPos;
 	bool		m_bDisableProcessEvent;
 	bool		m_bVisible;
-
+	sal_uInt16	m_nCurSelectedPos;
 	
 
     /// The currently selected item.

accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx

 		// SHOWING done with mxParent
 		if( implIsShowing() )
 			pStateSetHelper->AddState( AccessibleStateType::SHOWING );
-
+		mpBrowseBox->FillAccessibleStateSet( *pStateSetHelper, getType() ); //Added by yangzhh for SODC_2056
 		BBSolarGuard aSolarGuard;
 		pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
 		pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );

accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx

 		::osl::MutexGuard aGuard( getOslMutex() );
 		ensureIsAlive();
 
-        return /*BBINDEX_FIRSTCONTROL*/ m_nOffset + ( getRowPos() * mpBrowseBox->GetColumnCount() ) + getColumnPos();
+		//o is: return BBINDEX_FIRSTCONTROL + ( getRowPos() * mpBrowseBox->GetColumnCount() ) + getColumnPos();
+		return ( getRowPos() * mpBrowseBox->GetColumnCount() ) + getColumnPos();
 	}
 
 	sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getCaretPosition(  ) throw (::com::sun::star::uno::RuntimeException)

accessibility/source/extended/accessibleeditbrowseboxcell.cxx

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

accessibility/source/extended/accessibleiconchoicectrl.cxx

                     // 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 );
 							uno::Any aOldValue, aNewValue;
 							aNewValue <<= xChild;
 							NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
+							NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOldValue, aNewValue );
 						}
 					}
 					break;
 	// -----------------------------------------------------------------------------
 	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)

accessibility/source/extended/accessibleiconchoicectrlentry.cxx

 	// -----------------------------------------------------------------------------
 	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)

accessibility/source/extended/accessiblelistbox.cxx

 #include <toolkit/helper/convert.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
 
+//#include <vcl/svdata.hxx>
+
 //........................................................................
 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();
-
-						if ( pEntry )
-						{
-							Reference< XAccessible > xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
-							uno::Any aOldValue, aNewValue;
-							aNewValue <<= xChild;
-							NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
-						}
+						return;
+					}
+					AccessibleListBoxEntry* pCurOpEntry = GetCurEventEntry(rVclWindowEvent);
+					if(!pCurOpEntry)
+					{
+						return ;
+					}
+					uno::Any aValue;
+					aValue <<= AccessibleStateType::CHECKED;
+					
+					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;
 				}
 			}
 		}
 	}
+
+	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 ( !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)
 		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  )
+			//end add by duan mei hua, 2007/01/27, for sodc_6862
+			{
+				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)
     	::comphelper::OExternalLockGuard aGuard( this );
 
 		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;
-		}
+//     	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;
 
-    	return nSelCount;
+		int nTestCount =  getListBox()->GetSelectionCount();
+		return nTestCount;
 	}
 	// -----------------------------------------------------------------------------
 	Reference< XAccessible > SAL_CALL AccessibleListBox::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
 
 			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;
 			}
 		}

accessibility/source/extended/accessiblelistboxentry.cxx

 #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>
 #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
 	using namespace ::com::sun::star::uno;
 	using namespace ::com::sun::star::lang;
 	using namespace ::com::sun::star;
-
+	using namespace ::comphelper;
 	DBG_NAME(AccessibleListBoxEntry)
 
 	// -----------------------------------------------------------------------------
 	{
 		::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;
 	}
 	// -----------------------------------------------------------------------------
 		::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();
 
 				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:
     	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)
 		::osl::MutexGuard aGuard( m_aMutex );
 
 		EnsureIsAlive();
+
 		::rtl::OUString sRet;
 		sRet = implGetText();
-		// SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
 
+		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())
 
 		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 );
 		}
     	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 );
 		::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)
 		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;
 	}
 	// -----------------------------------------------------------------------------
 		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)
 		::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();
 
 
 		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
 //........................................................................

accessibility/source/extended/accessibletabbarpagelist.cxx

 
 	void AccessibleTabBarPageList::UpdateSelected( sal_Int32 i, sal_Bool bSelected )
 	{
-		NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+//		NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
 
 		if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
 		{

accessibility/source/extended/accessibletablistboxtable.cxx

 #include <svtools/svtabbx.hxx>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 
+#ifndef _SVTOOLS_ACCESSIBILEBROWSEBOXTABLECELL_HXX
+#include "accessibility/extended/AccessibleBrowseBoxTableCell.hxx"
+#endif
 //........................................................................
 namespace accessibility
 {

accessibility/source/extended/textwindowaccessibility.cxx

 
 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
         // XXX  numeric overflow
 }
 
+//Sym2_6109
+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;
+		// Sym2_6109, 
+		//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())
+	// Sym2_6109, 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(
         aCharAttrSeq[ aRunIter->first ] = aRunIter->second;
     }
 
-    return convertHashMapToSequence( aCharAttrSeq );
+	// Sym2_5078----, added by Steve Yin
+	::css::beans::PropertyValue* pValues = aAttribs.getArray();
+	for (i = 0; i < AttributeCount; i++,pValues++)
+	{
+		aCharAttrSeq[ pValues->Name ] = *pValues;
+	}
+	// ----Sym2_5078
+
+    ::css::uno::Sequence< ::css::beans::PropertyValue > aRes = convertHashMapToSequence( aCharAttrSeq );
+
+	// Sym2_6109, 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(
 		{
 			// #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;
     }
     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()
 {
             ::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())
                         ::css::uno::makeAny(
                             ::css::accessibility::AccessibleStateType::
                             FOCUSED));
-            }
+			*/
             break;
         }
     case VCLEVENT_WINDOW_LOSEFOCUS:
             ::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(
                             FOCUSED),
                         ::css::uno::Any());
             }
+			*/
             break;
         }
     }
     }
 }
 
+::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();
         ::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,
     }
     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
     // notify selection changes
     notifySelectionChange( nFirst1, nLast1 );
     notifySelectionChange( nFirst2, nLast2 );
-
+	*/
     m_nSelectionFirstPara = nNewFirstPara;
     m_nSelectionFirstPos = nNewFirstPos;
     m_nSelectionLastPara = nNewLastPara;

accessibility/source/helper/accessiblestrings.src

 #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
 {
 	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)";
+};
+//===================================================
+//Added by Qu DaoGang, 07/07/2005, CR_ID:SODC_149
+//Solution: Add Resource to set AccessibleName
+//==================================================
+String RID_STR_ACC_NAME_PREVIEW
+{
+	Text [ en-US ] = "Preview";
+};
+//==================================================
+//End Added by Qu DaoGang, 07/07/2005, CR_ID:SODC_149
+//==================================================
+
+//added by duan mei hua, 2006/04/14, for refactor
 String RID_STR_ACC_ACTION_CHECK
 {
 	Text [ en-US ] = "Check";
 {
 	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";
 {
 	Text [ en-US ] = "Horizontal scroll bar";
 };
+
+//Modify by Zijie Jia [12/31/2006] SODC_6571
+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";
 };
+

accessibility/source/standard/vclxaccessiblebox.cxx

 {
 	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:
             break;
         }
 
-		case VCLEVENT_COMBOBOX_SELECT:
+		//case VCLEVENT_COMBOBOX_SELECT:
         case VCLEVENT_COMBOBOX_DESELECT:
         {
             // Selection is handled by VCLXAccessibleList which operates on
 
 		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.
                 }
             }
             break;
-
+		/*
+		// MT: Not sending VCLEVENT_LISTBOX_STATEUPDATE, see comment in ListBox::SelectEntryPos
+		case VCLEVENT_LISTBOX_STATEUPDATE:
+		{
+			// Need to update the INDETERMINATE state sometimes, Sym2_1986
+			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 );
 	}
                 {
                     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);
     // Return the role <const>COMBO_BOX</const> for both VCL combo boxes and
     // VCL list boxes in DropDown-Mode else <const>PANEL</const>.